[#385051] How to order Structs based on two fields — Iñaki Baz Castillo <ibc@...>

Hi, I've a struct like this:

20 messages 2011/07/01
[#385052] Re: How to order Structs based on two fields — Iñaki Baz Castillo <ibc@...> 2011/07/01

2011/7/1 I=C3=B1aki Baz Castillo <ibc@aliax.net>:

[#385057] Re: How to order Structs based on two fields — Robert Klemme <shortcutter@...> 2011/07/01

On Fri, Jul 1, 2011 at 12:55 PM, I=F1aki Baz Castillo <ibc@aliax.net> wrote=

[#385069] Offering Help — Joe Peric <peric.joe@...>

I'm new to Ruby and I am willing to learn. Anyone need help on a

18 messages 2011/07/01
[#385072] Re: Offering Help — Jeremy Heiler <jeremyheiler@...> 2011/07/01

On Fri, Jul 1, 2011 at 11:43 AM, Joe Peric <peric.joe@gmail.com> wrote:

[#385073] Re: Offering Help — Joe Peric <peric.joe@...> 2011/07/01

Never heard of it, but I'll get right on it. Thanks.

[#385082] Re: Offering Help — Joe Peric <peric.joe@...> 2011/07/02

Just finished this. I had to find some more info on exceptions to get

[#385083] Re: Offering Help — Jeremy Heiler <jeremyheiler@...> 2011/07/02

On Sat, Jul 2, 2011 at 1:39 PM, Joe Peric <peric.joe@gmail.com> wrote:

[#385102] symbol vs string for hash keys — Intransition <transfire@...>

What are the important factors to consider when deciding whether to

12 messages 2011/07/03

[#385160] Fatal Error with Ruby/GTK2, Homebrew, Green Shoes, and OSX Snow Leopard — Timothy Barnes <barnes7td@...>

I posted the below question to the Shoes mailing list and got back the

10 messages 2011/07/09

[#385194] RubyInstaller Extras — Jon <jon.forums@...>

Since 2009, we've been pleased to include Huw Collingbourne's The Book of Ruby with RubyInstaller. Well now, Huw has a newly updated version, and he's published it with No Starch Press.

11 messages 2011/07/12

[#385207] Creating a range of directories — Simon Harrison <simon@...>

I'm wanting to create a range of directories with a prefix, like the

13 messages 2011/07/13

[#385276] Is there a more efficient way to remove data from a string? — Eddie Catflap <catflaporama@...>

Hi

9 messages 2011/07/15

[#385297] Help needed for a new release of text-hyphen — Austin Ziegler <halostatue@...>

I've had folks asking me for a release of text-hyphen that works with

12 messages 2011/07/15

[#385326] Comparing hashes based on their keys — Stefano Mioli <stefano.mioli@...>

Hi list,

13 messages 2011/07/15

[#385342] moving a 1.8.6 install? — Roggie Boone <rogboone@...>

Is it possible to move the gems from a Ruby 1.8.6 install on an (old)

10 messages 2011/07/15

[#385410] Better name for #zip_with — Intransition <transfire@...>

Any ideas for a better name for:

13 messages 2011/07/18

[#385452] Ruby + USB + CCTV Camera Driver? — "Bob Carpenter." <rgc3679@...>

I want to write a Ruby driver that handles the feed from A CCTV camera.

23 messages 2011/07/18
[#385459] Re: Ruby + USB + CCTV Camera Driver? — William Rutiser <wruyahoo05@...> 2011/07/18

On 2011-07-18 1:00 PM, Bob Carpenter. wrote:

[#385461] Re: Ruby + USB + CCTV Camera Driver? — "Bob Carpenter." <rgc3679@...> 2011/07/18

William Rutiser wrote in post #1011466:

[#385462] Re: Ruby + USB + CCTV Camera Driver? — Hassan Schroeder <hassan.schroeder@...> 2011/07/18

On Mon, Jul 18, 2011 at 11:51 AM, Bob Carpenter. <rgc3679@yahoo.com> wrote:

[#385464] Re: Ruby + USB + CCTV Camera Driver? — "Bob Carpenter." <rgc3679@...> 2011/07/18

Hassan Schroeder wrote in post #1011472:

[#385471] Re: Ruby + USB + CCTV Camera Driver? — Hassan Schroeder <hassan.schroeder@...> 2011/07/18

On Mon, Jul 18, 2011 at 12:58 PM, Bob Carpenter. <rgc3679@yahoo.com> wrote:

[#385474] Re: Ruby + USB + CCTV Camera Driver? — Phillip Gawlowski <cmdjackryan@...> 2011/07/18

On Tue, Jul 19, 2011 at 12:18 AM, Hassan Schroeder

[#385477] Re: Ruby + USB + CCTV Camera Driver? — "Bob Carpenter." <rgc3679@...> 2011/07/19

Phillip Gawlowski wrote in post #1011503:

[#385509] A beginner question. — "Cajus A." <cajus_@...>

Hi i'm trying to write and example program where you speak to a

12 messages 2011/07/19

[#385542] Splitting strings — Ryan Mckenzie <ryan@...>

Hi all,

18 messages 2011/07/19

[#385565] error building ruby p290 — Dev Guy <devguy.ca@...>

I get the following build error on my Linux box while trying to build

12 messages 2011/07/20

[#385629] Are Job Ads OK? — Lee Hughes <lee@...>

Is it OK to post Ruby job ads on this forum?

12 messages 2011/07/21

[#385847] String manuplation example — kotin 76 <kotin76@...>

Hi,

15 messages 2011/07/27

[#385860] Counting lines of code in a ruby code file ignoring method code lines in the process — Harry Truax <htruax@...>

Hello,

8 messages 2011/07/27

[#385936] Help in Pointer — Tridib Bandopadhyay <tridib04@...>

Hello

18 messages 2011/07/29

[#386012] Ruby a "4th generation language"? Credible sources? — Albert Schlef <albertschlef@...>

I've noticed that Wikipedia says that "C#, Java" are 3'rd generation

13 messages 2011/07/31

[#386050] system stack error in ObjectSpace.each_object — luke gruber <luke.gru@...>

Hey guys, I'm just starting to mess around with metaprogramming in Ruby,

14 messages 2011/07/31
[#386052] Re: system stack error in ObjectSpace.each_object — Josh Cheek <josh.cheek@...> 2011/07/31

On Sun, Jul 31, 2011 at 4:29 PM, luke gruber <luke.gru@gmail.com> wrote:

[#386055] Re: system stack error in ObjectSpace.each_object — luke gruber <luke.gru@...> 2011/08/01

> Typically, SystemStackError is due to recursing for too long, perhaps I

[#386058] Re: system stack error in ObjectSpace.each_object — Robert Klemme <shortcutter@...> 2011/08/01

On Mon, Aug 1, 2011 at 3:56 AM, luke gruber <luke.gru@gmail.com> wrote:

Re: [RDoc internals] Changing the RDoc formatter

From: Eric Hodel <drbrain@...7.net>
Date: 2011-07-21 00:18:13 UTC
List: ruby-talk #385581
On Jul 20, 2011, at 8:44 AM, Quintus wrote:
> I'm currently writing on a PDF generator for RDoc based on LaTeX. I'm
> already achieving my first readable results, but now I wanted to add
> that nice cross-referencing support we see in the Darkfish-generated
> pages. I know the responsible class is RDoc::Markup::ToHtmlCrossref =
and
> wrote a class RDoc::Markup::ToLaTeXCrossref that basicly does the same
> thing as the ToHtmlCrossref class, just using \href instead of <a> and =
a
> labeling mechanism. However, I can't figure out how to make RDoc use =
the
> formatter *correctly*. At the moment, I'm doing it by hand using an =
ugly
> monkeypatch of RDoc:
>=20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> class RDoc::CodeObject
>=20
>    LATEX_FORMATTER =3D RDoc::Markup::ToLaTeX.new
>=20
>   #...
>=20
>   def latex_description
>     LATEX_FORMATTER.convert(comment)
>   end
>=20
> end
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
>=20
> This allows me in my LaTeX ERB templates to just call the
> #latex_description method of a CodeObject (instead of #description,
> which seems to default always to the ToHtmlCrossref formatter) to get
> the fully formatted comment. Do I really have to do this monkeypatch?
> Isn't there another way, like, say, setting the wanted formatter on an
> instance of the generator class (in my case =
RDoc::Generator::PDF_LaTeX)?

In RDoc this happens using rdoc/generator/markup.rb

(The code is in a separate module to allow smaller parts of RDoc to be =
loaded depending upon what you're doing.  For example `ri` shouldn't =
need to load all the generators and markup parsers).

I think it's just fine to create a separate module for Latex formatting =
and cross-referencing and including it in the same places that =
RDoc::Generator::Markup is used.

I would do it this way:

require 'rdoc/generator/markup'

module RDoc::Generator::LatexMarkup
  def formatter
    # make latex formatter like RDoc::Generator::Markup#formatter
  end
end

class RDoc::CodeObject
  include RDoc::Generator::LatexMarkup
end

class RDoc::Context::Section
  include RDoc::Generator::LatexMarkup
end

While this allows only HTML or only LaTeX output per run of RDoc I don't =
think that's much of a problem.

I should be able to allow RDoc to support a preferred formatter per =
generator in a future release.  Cross-reference formatters require a =
context object so I'm not sure what the API will look like.

> And btw, why do we need a separate Generator and Formatter class? =
Nearly
> the whole work of processing the parsed input is done in the =
formatter,
> the generator then just writes it out to a file or whereever. Is this
> really the sole purpose of a generator?

A Generator turns an RDoc::CodeObject tree into some kind of output.  =
That output may be a set of HTML files, an ri data store, a PDF or =
records in a database.

A Formatter turns a parsed block of text into another form of output.

In the case of ri, RDoc::Generator::RI turns the RDoc::CodeObject tree =
into a set of Marshal files and a cache file describing the data.

When ri runs it examines the cache file, loads the correct data files, =
extracts the comment and uses the appropriate RDoc::Markup::Formatter to =
display the pre-parsed data.

(There's also `rdoc --pipe` which uses the HTML formatter.)

Since formatters get used in various different places they need to be =
separate from the generators.

> If so, why is there a such small amount of documentation of adding new =
subclasses of RDoc::Markup::Formatter?

I haven't had time to write it and few people have expressed interest in =
needing it.  I'm also not sure what I should write about it.  Using the =
visitor pattern makes the formatters rather simple to write.

Please take a look at RDoc::Markup::FormatterTestCase.  Subclassing it =
should help you immensely as it provides tests for everything you need =
to implement.  (There's also RDoc::markup::TextFormatterTestCase)

If I had an idea of what things you wish you'd know I can use that to =
write documentation.

Also, where is your project hosted?  I'd like to take a look at it.=

In This Thread

Prev Next