RedCloth, BlueCloth...

H

Hal Fulton

...OldCloth, NewCloth? (Sorry, I went to a Dr. Seuss exhibit
here in town.)

I want to know what's the best way to manage a file that has
both text and HTML versions. (Yes, I'm talking about the
comp.lang.ruby FAQ, which should autopost tomorrow.)

In the past, I've done this the worst possible way -- keeping
them manually in sync. I've also done some playing with
textual browsers and such.

What's a good/easy way to do this? Lynx, links? RedCloth,
BlueCloth, PlaidCloth? MarkDown, MarkUp, MarkTwain?


Thanks,
Hal
 
S

Stoyan Zhekov

What's a good/easy way to do this? Lynx, links? RedCloth,
BlueCloth, PlaidCloth? MarkDown, MarkUp, MarkTwain?

Markdown and Textile are standarts, RedCloth and BlueCloth -
implementations.

RedCloth is the way i think - it give you support for Markdown,
Textile + mix of both. Just decide which markup you like.
From somebody's post: "Markdown is for emails, textile
- for the web". In general: textile, implemented with RedCloth
is my opinion.

Or just go with some text to html convertor:
- [ http://txt2html.sourceforge.net/ ]
- [ http://www.methods.co.nz/asciidoc/index.html ]
 
J

James Britt

Hal said:
...OldCloth, NewCloth? (Sorry, I went to a Dr. Seuss exhibit
here in town.)

That's OK; when I read the subject line, I filled in the rest of it with
" ... 1 2 3!"
I want to know what's the best way to manage a file that has
both text and HTML versions. (Yes, I'm talking about the
comp.lang.ruby FAQ, which should autopost tomorrow.)

In the past, I've done this the worst possible way -- keeping
them manually in sync. I've also done some playing with
textual browsers and such.

What's a good/easy way to do this? Lynx, links? RedCloth,
BlueCloth, PlaidCloth? MarkDown, MarkUp, MarkTwain?

Once upon a time I had a similar issue with the ruby-doc weekly news
summary. I wanted an RSS feed, an E-mail posting, and something else I
cannot recall.

This may have been before Textile/Markdown, but I used something along
those lines. I wrote a small app that grabbed a single input file and
ran it through assorted transformers to produce the .eml file, the RSS,
and whatever else.

Textile is quite nice for generating HTML; Markdown is handy because it
is ready-made for plain-text E-mail.

I would opt for Markdown here, though, as it can go straight to
ruby-talk as-is.



James
 
T

Tom Copeland

...OldCloth, NewCloth? (Sorry, I went to a Dr. Seuss exhibit
here in town.)

Try them, try them, you will see!

Tom, who has read Green Eggs and Ham many, many times.
 
B

Bill Guindon

Try them, try them, you will see!

Tom, who has read Green Eggs and Ham many, many times.

I will not merge text and HTML
I will not merge them so said Hal
I will not merge them in a file
I will not merge them in a pile
I will not merge them on your desk
I will not merge them within Plesk
I will not merge them in email
if I tried, I'd surely fail

I wonder what "Suess, the new programming language" would look like.
 
D

David Mitchell

..OldCloth, NewCloth? (Sorry, I went to a Dr. Seuss exhibit
here in town.)

I want to know what's the best way to manage a file that has
both text and HTML versions. (Yes, I'm talking about the
comp.lang.ruby FAQ, which should autopost tomorrow.)

I realise this is the Ruby newsgroup and it's the Ruby FAQ you're talking
about, but you could maintain a single XML-based version and use XSLT to
extract both text and HTML (and just about any other format you care to
mention) using tools that are on every modern Windows PC or Linux system.

Downside - no Ruby required...
 
M

Mark Hubbart

I realise this is the Ruby newsgroup and it's the Ruby FAQ you're talking
about, but you could maintain a single XML-based version and use XSLT to
extract both text and HTML (and just about any other format you care to
mention) using tools that are on every modern Windows PC or Linux system.

ow ow ow. Maybe it's just me, but maintaining a large document like
the FAQ in xml seems masochistic, when there are nice human readable
formats like markdown or textile around.
Downside - no Ruby required...

Actually, I suspect the tools for markdown and textile are more widely
available than you think. I know that if I was handed an xml/xslt
combo doc, and a markdown doc, I'd have a much better idea of what to
do with the markdown one. And I could do it in Ruby, Perl, Python,
PHP, or even paste it into a web form, to get the html out.

cheers,
Mark
 
L

Lyndon Samson

ow ow ow. Maybe it's just me, but maintaining a large document like
the FAQ in xml seems masochistic, when there are nice human readable
formats like markdown or textile around.


Actually, I suspect the tools for markdown and textile are more widely
available than you think. I know that if I was handed an xml/xslt
combo doc, and a markdown doc, I'd have a much better idea of what to
do with the markdown one. And I could do it in Ruby, Perl, Python,
PHP, or even paste it into a web form, to get the html out.

cheers,
Mark
<faq>
<contact>
</contact>
<questions>
<question>
<asked>Why is ruby sooo nice?</asked>
<answered>PoLS</answered>
<question>
<questions>
</faq>

Looks pretty neat to me, and maintainable, and you can do all sorts of
re-organisation/filtering ( with XSLT ) and querying (XPath/XQuery et
al) as well. Plenty of GUI/Web tools to let you view/edit as a tree if
you are that way inclined otherwise VIM and Emacs have support for XML
editing.
 
M

Mike Woodhouse

....and I could do it in Ruby
and I could do it in PHP
and with Perl on
and with Python
and I would code them up in C
they are so good, so good you see

I was reading GE&H with my 4 year-old last night...

Mike

*oops
 
D

David Mitchell

ow ow ow. Maybe it's just me, but maintaining a large document like
the FAQ in xml seems masochistic, when there are nice human readable
formats like markdown or textile around.

Bit of finger dyslexia...

The bit I thought I typed, but obviously didn't, is that you can generate
and maintain XML using a nice friendly tool like OpenOffice. Load the FAQ
into OpenOffice, edit it, save it in OpenOffice's native format.

Then write a (Ruby?) script to unzip (gunzip?) the OpenOffice file into
the underlying XML format, run XSLT over it and you've got your ASCII
text, HTML, whatever equivalent document.

Reading my earlier post, my brain just must have turned off at some point
because what I set out to write is nothing like what actually came out of
my fingers. Friday night here, so that's probably the explanation.

Dave M.
 
F

Florian Groß

Hal said:
I want to know what's the best way to manage a file that has
both text and HTML versions. (Yes, I'm talking about the
comp.lang.ruby FAQ, which should autopost tomorrow.)

In the past, I've done this the worst possible way -- keeping
them manually in sync. I've also done some playing with
textual browsers and such.

What's a good/easy way to do this? Lynx, links? RedCloth,
BlueCloth, PlaidCloth? MarkDown, MarkUp, MarkTwain?

I'd go with MarkDown through BlueCloth here (though RedCloth recently
seems to have learned bits of that markup as well), but you could in
theory as well go back from the HTML to plain text via lynx --dump or
just go from HTML to MarkDown via http://www.aaronsw.com/2002/html2text/
 
W

why the lucky stiff

Christian said:
Could someone with RedCloth experience please make some statements on

the Markdown support? Is it possible to use Markdown only and to what
extent?
Right now most answers concerning RedCloth3 can be found at:
<http://redhanded.hobix.com/inspect/usingRedcloth3.html>

The section "Line Breaking with a Sledgehammer" talks about the
subtleties between Textile and Markdown's whitespace and entity
handling, which is often ignored but very pertinent.

RedCloth currently supports the following Markdown:
* Setext-style headers, which look like:

Welcome to Harold's Whistle Emporium
=========================

* Blockquotes, which are:
There is no stopping the white robot.

- Gerald Hanover, King of the Red Robots

And you can embed other elements in blockquotes.
There is no stopping the white robot.

p(said). Gerald Hanover, King of the Red Robots

So all the "nested" examples work.

* Indented code blocks work.
* Horizontal rules
* Inline links, like: [hobix](http://hobix.com "Hobix is the white
pantsuit of weblahhging")

However, RedCloth does not currently support:
* ATX-style headers
* Markdown lists starting with '-', '+' or /\d+\./
* Reference-style links
* Markdown emphasis (these are handled using Textile rules)
* Backtick code fragments
* Images
* Automatic links

I have figured out how to weave each of the above into Textile, but
haven't implemented them yet.

This message was written hastily, so I may be wrong about any of the
above. However, I know myself pretty well and I am inclined to believe
it is all correct.

_why
 
N

Navindra Umanee

why the lucky stiff said:
Right now most answers concerning RedCloth3 can be found at:
<http://redhanded.hobix.com/inspect/usingRedcloth3.html>

The section "Line Breaking with a Sledgehammer" talks about the
subtleties between Textile and Markdown's whitespace and entity
handling, which is often ignored but very pertinent.

Why would you side with:

<p>4 > 5</p>

over:

<p>4 &gt; 5</p>

That seems like a rather bad idea.

Anyone know if there's any support to verify whether the HTML and URLs
are safe -- in the sense that they aren't JavaScript hacks or image
insertions or the such?

This would be useful if using *Cloth in a web-application where you
might want to severely restrict the kind of HTML that can get used.

Thanks,
Navin.
 
M

Mark Hubbart

Bit of finger dyslexia...

The bit I thought I typed, but obviously didn't, is that you can generate
and maintain XML using a nice friendly tool like OpenOffice. Load the FAQ
into OpenOffice, edit it, save it in OpenOffice's native format.

Then write a (Ruby?) script to unzip (gunzip?) the OpenOffice file into
the underlying XML format, run XSLT over it and you've got your ASCII
text, HTML, whatever equivalent document.

With that idea added, it sounds much better :) OOo was something I
hadn't thought of; the implications of it's native xml format hadn't
immediately been obvious to me either. Thanks.

cheers,
Mark
 
F

Florian Groß

Navindra said:
Anyone know if there's any support to verify whether the HTML and URLs
are safe -- in the sense that they aren't JavaScript hacks or image
insertions or the such?

This would be useful if using *Cloth in a web-application where you
might want to severely restrict the kind of HTML that can get used.

AFAIK RedCloth has multiple modes. It can either disallow HTML and
inline styles completely or use a tag filter list. While the latter
might sound like the more graceful of the two approaches there is IMHO
lots of subtle cases where browsers will parse obscure syntax different
than HTML filters which could lead to malicious code slipping through.
Just have a look at all the trouble eBay has been having despite their
claim of already using heavy-weight filters.

Allowing CSS might appear safe at first, but the major browsers all
support schemes for behavior binding at the style level and Internet
Explorer also allows for interpolation of arbitrary JavaScript code via
expression().
 
J

Jim Freeze

* why the lucky stiff said:
This message was written hastily, so I may be wrong about any of the
above. However, I know myself pretty well and I am inclined to believe
it is all correct.

Reminds me of a quote by Benjamin Franklin ...that most people
have never met anyone who is always correct, other than themselves.

;)
 
D

Dmitri Borodaenko

Allowing CSS might appear safe at first, but the major browsers all
support schemes for behavior binding at the style level and Internet
Explorer also allows for interpolation of arbitrary JavaScript code via
expression().

Yup, CSS is a weak spot in my Samizdat::Sanitize: I can parse and
filter XHTML via REXML just fine, but I don't know of any CSS parser
that I could use. Any ideas?
 

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
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top