From: Austin Ziegler Date: 2005-01-18T04:43:13+09:00 Subject: Re: What's the best way to write a Textile-to-PDF::Writer converter? On Tue, 18 Jan 2005 03:47:41 +0900, Andreas Semt wrote: > Austin Ziegler wrote: >> On Mon, 17 Jan 2005 03:51:29 +0900, Andreas Semt >> wrote: >>> I am relative new to Ruby, so i ask: What's the best way to >>> develop a *pure* Ruby Textile-to-PDF::Writer converter? I use >>> the Soks Wiki (http://rubyforge.org/projects/soks/ by Tom >>> Counsell) for documentation purpose on work (on a W2K Pro Box). >>> This wiki saves the page content in flat text files in the >>> Textile Markup language, so i want a converter to generate PDF >>> files from these Textile files. Austin Ziegler has a RubyForge >>> project (http://rubyforge.org/projects/ruby-pdf/ ) for writing >>> PDF files in Ruby. So all parts of my imaginary pure Ruby >>> Textile-to-PDF::Writer converter are there, however i wonder how >>> to use them? >> I don't know, offhand, but if you want to definitely do this and >> contribute it to PDF::Writer, I will happily work with you on >> that -- this has been part of a goal of PDF::Writer (the >> specification of a better formatting language than the simple one >> that I support right now). >> >> My problem is mostly that I don't really know Textile, and I'm >> deep in the middle of Text::Format, with a bit of review of a new >> port of Text::Reform. After that, I *must* work on Diff::LCS and >> Ruwiki again, but I also need to get a PDF::Writer release out >> the door that captures a font fix that I made last week (so you >> definitely want the CVS HEAD version of PDF::Writer). >> >> By contributing something like this to PDF::Writer, I will also >> make sure that as the API for PDF::Writer changes (and I promise >> that it will), the converter is kept up to date. > Hello Austin! > > a question to your "readme.rb" example file: In the "data.txt" > file you say: --- snip --- # can be used within > the text with gleeful abandon --- snap --- > > Could you *please* explain how you parse these "bold" and "italic" > tags in the "readme.rb" file? I have not discovered it yet :-( Look at writer.rb:398 (set_current_font); it refers to @current_text_state. This is set (currently) in prvt_check_text_directive1 (line 646). It's an awful hack, but this is what was in the original code. This is the sort of thing that I hope to greatly improve in the future. That is to say that and are built into the writer and are only supported if the font(s) involved support them. That latter restriction will probably always be true, but ... -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca