[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] TagTreeScanner 0.6

Gavin Kistner

7/4/2005 11:41:00 PM

From http://phrogz.net/RubyLibs/rdoc/OWLScribble/do...:

"The TagTreeScanner class provides a generic framework for creating a
nested hierarchy of tags and text (like XML or HTML) by parsing text.
An example use (and the reason it was written) is to convert a wiki
markup syntax into HTML."

It's not yet as easy as I'd like to understand the core concepts, but
in a nutshell you specify a series of states which your parser may go
through, and for each state supply a set of tags to look for in that
state. Though both it and the Syntax library use StringScanner (and
thus regular expressions) to do the job, TagTreeScanner is distinct
in that:

1) It automatically handles the opening and closing of tags for you
(particularly the "close_match" property of a TagFactory)

2) It automatically handles state (the @tag_genres hash and the
allowed_genre property of factories)

3) It keeps track of a nested tree during building, automatically
pushing and popping nodes as necessary, and (when no tags can be
found) pushing text into the current tag.

I'm not yet cool enough to put this into a gem...hopefully I'll do
that in the next week or so.

This library is useless by itself; it exists to allow you to define
your own syntax parser as a subclass of TagTreeScanner. Which is what
I've done with the OWLScribble class, documented along side
TagTreeScanner.

I appreciate all feedback, positive and negative, about the
efficiency of the code, clarity of the documentation, or interface to
the class.


--
"When I am working on a problem I never think about beauty. I only
think about how to solve the problem. But when I have finished, if
the solution is not beautiful, I know it is wrong."
- R. Buckminster Fuller



3 Answers

Takashi Sano

7/5/2005 10:26:00 AM

0

Hi,

2005/7/5, Gavin Kistner <gavin@refinery.com>:
> From http://phrogz.net/RubyLibs/rdoc/OWLScribble/do...:
>
> "The TagTreeScanner class provides a generic framework for creating a
> nested hierarchy of tags and text (like XML or HTML) by parsing text.
> An example use (and the reason it was written) is to convert a wiki
> markup syntax into HTML."
>

I'm very interested in this library, but where can I download it? It
seems that the link above only takes me to its rdoc. Thanks.

Takashi Sano


Gavin Kistner

7/5/2005 3:40:00 PM

0

On Jul 5, 2005, at 4:25 AM, Takashi Sano wrote:
>> From http://phrogz.net/RubyLibs/rdoc/OW...do...:
>
> I'm very interested in this library, but where can I download it? It
> seems that the link above only takes me to its rdoc. Thanks.

Sorry, I should have pointed that out.
The TagTreeScanner.rb page has in its documentation a link to the
TagTreeScanner.rb file, at:
http://phrogz.net/RubyLibs/rdoc/OW...TagTree...

You can also just browse the directory at:
http://phrogz.net/RubyLibs/rdoc/OW...

and get at things like test cases.

Takashi Sano

7/6/2005 1:15:00 AM

0

2005/7/6, Gavin Kistner <gavin@refinery.com>:
> On Jul 5, 2005, at 4:25 AM, Takashi Sano wrote:
> >> From http://phrogz.net/RubyLibs/rdoc/OWLScribble/do...:
> >
> > I'm very interested in this library, but where can I download it? It
> > seems that the link above only takes me to its rdoc. Thanks.
>
> Sorry, I should have pointed that out.
> The TagTreeScanner.rb page has in its documentation a link to the
> TagTreeScanner.rb file, at:
> http://phrogz.net/RubyLibs/rdoc/OWLScribble/TagTree...
>

Oops, I overlooked that link. Thanks!

Takashi Sano