[ANN] TagTreeScanner 0.6

From http://phrogz.net/RubyLibs/rdoc/OWLScribble/doc/tts.html:

"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

Hi,

···

2005/7/5, Gavin Kistner <gavin@refinery.com>:

From http://phrogz.net/RubyLibs/rdoc/OWLScribble/doc/tts.html:

"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

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/TagTreeScanner.rb

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

and get at things like test cases.

···

On Jul 5, 2005, at 4:25 AM, Takashi Sano wrote:

From http://phrogz.net/RubyLibs/rdoc/OWLScribble/doc/tts.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.

Oops, I overlooked that link. Thanks!

Takashi Sano

···

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/doc/tts.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.

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/TagTreeScanner.rb