Hello list!
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?
Thanks for any help or suggestions!
Greetings,
Andreas
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.
-austin
···
On Mon, 17 Jan 2005 03:51:29 +0900, Andreas Semt <as@computer-leipzig.de> 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?
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca
I think it would make more sense to work on an HTML to PDF writer.
It's an extra-step from textile, but it shouldn't slow you down any,
and will be more useful.
From there you can also work on CSS support. Which would give you the
ability to control colors, font and quite a bit of other formatting.
There is even CSS for supporting page-breaks[1]. I'm not suggesting
you write a full pure-ruby CSS parser (I wouldn't wish that on anyone)
but you should be able to get a specific sub-set that would be
particularly useful for PDFing.
[1]: Paged media
Anyway, just a thought.
-- Xian
···
On Mon, 17 Jan 2005 03:51:29 +0900, Andreas Semt <as@computer-leipzig.de> wrote:
Hello list!
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.
(This is mostly a response to Andreas; it probably won't be news to Austin.)
I've been using PDF::Writer to do some graphical charting, so I'm not so familiar with its text processing. But I'll take a guess on how to do this.
When you use the #ez_text method, the text you pass in can be a big block of text, possibly spanning multiple pages. The text can have HTML-like markup. The text processing code in PDF::Writer will apparently handle all the details of wrapping lines, spacing paragraphs, and breaking pages. So for a first pass (assuming you don't need to control page breaks), you might work on a simple Textile-to-ez_text converter.
If you haven't seen it, you should look at RedCloth, which is an implementation of a Textile-to-HTML converter. It doesn't appear to be very extensible -- its HTML generation seems all wrapped up in the parsing -- but at only 1000 lines of code, maybe it would be a good thing to build on.
···
On Jan 16, 2005, at 12:32 PM, Austin Ziegler wrote:
On Mon, 17 Jan 2005 03:51:29 +0900, Andreas Semt > <as@computer-leipzig.de> 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 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).
--
John Labovitz
Macintosh support, research, and software development
John Labovitz Consulting, LLC
johnl@johnlabovitz.com | +1 503.949.3492 | www.johnlabovitz.com/consulting
Austin Ziegler 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.
-austin
Hello Austin!
a question to your "readme.rb" example file: In the "data.txt" file you say:
--- snip ---
# <b></b> <i></i> 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 
John Labovitz wrote:
Ah. #ez_text supports "callbacks" for formatting, but #add_text (in the base class) *does* support <b> and <i> formatting.
Hello John!
Thanks ... will use the #add_text method.
Greetings,
Andreas
···
On Mon, 17 Jan 2005 03:51:29 +0900, Andreas Semt <as@computer-leipzig.de> wrote:
John Labovitz wrote:
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).
Hello Austin!
I want just a little converter for my Soks content, no big deal. However i could (later) expand this little converter to a more general tool for converting Textile-to-PDF using PDF::Writer.
(This is mostly a response to Andreas; it probably won't be news to Austin.)
I've been using PDF::Writer to do some graphical charting, so I'm not so familiar with its text processing. But I'll take a guess on how to do this.
When you use the #ez_text method, the text you pass in can be a big block of text, possibly spanning multiple pages. The text can have HTML-like markup. The text processing code in PDF::Writer will apparently handle all the details of wrapping lines, spacing paragraphs, and breaking pages. So for a first pass (assuming you don't need to control page breaks), you might work on a simple Textile-to-ez_text converter.
Hello John!
Thanks for that hint. However "ez_text" does not support formatting of any kind (for example: bold, italic, ...). So i will use other methods.
If you haven't seen it, you should look at RedCloth, which is an implementation of a Textile-to-HTML converter. It doesn't appear to be very extensible -- its HTML generation seems all wrapped up in the parsing -- but at only 1000 lines of code, maybe it would be a good thing to build on.
Yes, it's a good starting point. "redcloth.rb" and Austin Ziegler's "readme.rb" example will guide me 
Greetings,
Andreas
···
On Jan 16, 2005, at 12:32 PM, Austin Ziegler wrote:
--
John Labovitz
Macintosh support, research, and software development
John Labovitz Consulting, LLC
johnl@johnlabovitz.com | +1 503.949.3492 | www.johnlabovitz.com/consulting
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 <b> and
<i> 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
···
On Tue, 18 Jan 2005 03:47:41 +0900, Andreas Semt <as@computer-leipzig.de> wrote:
Austin Ziegler wrote:
On Mon, 17 Jan 2005 03:51:29 +0900, Andreas Semt >> <as@computer-leipzig.de > 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 --- # <b> </b> <i> </i> 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 
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca
Ah. #ez_text supports "callbacks" for formatting, but #add_text (in the base class) *does* support <b> and <i> formatting.
···
On Jan 17, 2005, at 6:00 AM, Andreas Semt wrote:
Thanks for that hint. However "ez_text" does not support formatting of any kind (for example: bold, italic, ...). So i will use other methods.
--
John Labovitz
Macintosh support, research, and software development
John Labovitz Consulting, LLC
johnl@johnlabovitz.com | +1 503.949.3492 | www.johnlabovitz.com/consulting