-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi there,
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 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:
==================================================
class RDoc::CodeObject
LATEX_FORMATTER = RDoc::Markup::ToLaTeX.new
#…
def latex_description
LATEX_FORMATTER.convert(comment)
end
end
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)?
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? If so, why is there a such small
amount of documentation of adding new subclasses of
RDoc::Markup::Formatter?
(I’m using Ruby 1.9.2-p290 and RDoc 3.8)
Valete,
Marvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJOJvfaAAoJELh1XLHFkqhaAjsH/3NkI1DxvE4ByWn5TJP8kC03
cjL4YxNzOfQCxGqcrEUUk/oFRbe3cqykt0iaoj7aTI8QvXnu6xUyxGBzrrXwHuXJ
p/S+mNgnIcTiKzhSA/Cb5vggHkzLaqQKvKJKFfZQHDy7UmPWsqmzfDbPJ7PG849D
IERSUYnK4kxC0f/TG8izYf5582op8J2Lni+3mFX2gxnQpGk+GKCfi9pVlmIm4/Ab
DXtQJk3HUIKobkFJqzpNQXWZkeP3sAhnhHOzXJqdcmHXjKnAwanZdt9oN2ZldqAx
9HBRVQVl7Bw1NJlJcZPoF6qchexSwnqZP4uucXuAXqH0cIZPu3LiihLnsFmRtQE=
=4poA
-----END PGP SIGNATURE-----