convert YAML to HTML?

P

Phlip

Rubies:

This has to have been on the YAML thought leader's Do List.

Is there a library, or a snippet, out there that converts YAML to esthetic,
meaningful XHTML?

I don't want to load the document into Ruby variables then stream them with
RedCloth because I'd lose the comments.

Can I load the comments, too, and stream everything?
 
P

Phlip

Phlip said:
This has to have been on the YAML thought leader's Do List.

Is there a library, or a snippet, out there that converts YAML to esthetic,
meaningful XHTML?

I don't want to load the document into Ruby variables then stream them with
RedCloth because I'd lose the comments.

Can I load the comments, too, and stream everything?

Here's JB's Syntax module:

http://jamisbuck.org/jamis/blog.cgi/programming/ruby/Syntax 0.7_20050323235420.tx

Here's a sample output:

<span class="punct">-</span> [ formatWiki, this is ''em''phatic text, this
is &lt;em&gt;em&lt;/em&gt;phatic text ]

That's not cute enough. It's essentially a syntax highlighter for YAML. (And
as such, it missed the [] tags and lexically significant commas , .)

I need <table> output with cute <tr><td> tags around the arrays. To use
Ruby's magical extensiveness on Jamis Buck's Syntax::Convertors::HTML class,
I would also need the lexer to parse [] and , properly.

I might just spark up a TDD session and see how far I get with app-specific
code...
 
J

Jamis Buck

Phlip said:
This has to have been on the YAML thought leader's Do List.

Is there a library, or a snippet, out there that converts YAML to esthetic,
meaningful XHTML?

I don't want to load the document into Ruby variables then stream them with
RedCloth because I'd lose the comments.

Can I load the comments, too, and stream everything?

Here's JB's Syntax module:

http://jamisbuck.org/jamis/blog.cgi/programming/ruby/
Syntax%200.7_20050323235420.tx

Here's a sample output:

<span class="punct">-</span> [ formatWiki, this is ''em''phatic text,
this
is &lt;em&gt;em&lt;/em&gt;phatic text ]

That's not cute enough. It's essentially a syntax highlighter for
YAML. (And
as such, it missed the [] tags and lexically significant commas , .)

Yes, it is not a complete YAML parser. A patch would be more than
welcome, though. If you (or anyone else) improves an existing lexer or
adds a new one, I would love to add your changes to the Syntax lib.

- Jamis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top