RedCloth, BlueCloth

...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

Hal Fulton wrote:

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.)

Then you put in the same directory your faq.txt, and a Rakefile with tasks for rendering and publishing.
The task for rendering may look like (this is working code that I use for reformatting my CV):

QTE render.rb
require 'redcloth'

Dir['*.txt'].each do |txt|
  html = RedCloth.new(File.read(txt), [:hard_breaks]).to_html
  name = File.basename(txt).sub(/\.txt$/, '')
  File.delete(name + '.html') if File.exists?(name + '.html')
  File.open(name + '.html', 'w+') { |f| f.write html }
end
UNQTE

···

--

Best regards,

Alexey Verkhovsky

Ruby Forum: http://ruby-forum.org (moderator)
RForum: http://rforum.andreas-s.net (co-author)
Instiki: http://instiki.org (maintainer)

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 ]

Hal Fulton wrote:

...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

Try them, try them, you will see!

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

···

On Fri, 2005-04-15 at 09:31 +0900, Hal Fulton wrote:

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

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...

···

On Fri, 15 Apr 2005 09:31:59 +0900, Hal Fulton wrote:

..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.)

Hal Fulton wrote:

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 html2text: THE ASCIINATOR (aka html2txt)

Stoyan Zhekov wrote:

From somebody's post: "Markdown is for emails, textile

- for the web".

If the source text should look like a plain text, compare

h2. Textile Header

Markdown Header

···

=======================

and tell me which one do you like best.

RedCloth implements Textile plus most (but not all) Markdown elements, including the header style shown above. If you don't mind learning a bit if both markups (both are simple to learn), this mixture is a good choice.

--
Best regards,

Alexey Verkhovsky

Ruby Forum: http://ruby-forum.org (moderator)
RForum: http://rforum.andreas-s.net (co-author)
Instiki: http://instiki.org (maintainer)

Alexey Verkhovsky wrote:

Hal Fulton wrote:

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.)

Oops, sorry. There was supposed to be a line advocating Markdown here, as something that looks better when viewed as a plain text. Something ate it in the process of merciless refactoring. :slight_smile:

···

Then you put in the same directory your faq.txt, and a Rakefile with tasks for rendering and publishing.
The task for rendering may look like (this is working code that I use for reformatting my CV):

--
Best regards,

Alexey Verkhovsky

Ruby Forum: http://ruby-forum.org (moderator)
RForum: http://rforum.andreas-s.net (co-author)
Instiki: http://instiki.org (maintainer)

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.

···

On 4/14/05, Tom Copeland <tom@infoether.com> wrote:

On Fri, 2005-04-15 at 09:31 +0900, Hal Fulton wrote:
> ...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.

--
Bill Guindon (aka aGorilla)

> ..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.

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

···

On 4/14/05, David Mitchell <monch1962@gmail.com> wrote:

On Fri, 15 Apr 2005 09:31:59 +0900, Hal Fulton wrote:

Florian Groß <florgro@gmail.com> writes:

Hal Fulton wrote:

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
html2text: THE ASCIINATOR (aka html2txt)

Could someone with RedCloth experience please make some statements on
the Markdown support? Is it possible to use Markdown only and to what
extent?

···

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

<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.

···

On 4/15/05, Mark Hubbart <discordantus@gmail.com> wrote:

On 4/14/05, David Mitchell <monch1962@gmail.com> wrote:
> On Fri, 15 Apr 2005 09:31:59 +0900, Hal Fulton wrote:
>
> > ..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.

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

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

....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

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.

···

On Fri, 15 Apr 2005 15:33:03 +0900, Mark Hubbart wrote:

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.

Christian Neukirchen wrote:

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&gt;

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

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.

···

why the lucky stiff <ruby-talk@whytheluckystiff.net> wrote:

Right now most answers concerning RedCloth3 can be found at:
<http://redhanded.hobix.com/inspect/usingRedcloth3.html&gt;

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.

With that idea added, it sounds much better :slight_smile: 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

···

On 4/15/05, David Mitchell <monch1962@gmail.com> wrote:

On Fri, 15 Apr 2005 15:33:03 +0900, Mark Hubbart wrote:

> 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.

* why the lucky stiff <ruby-talk@whytheluckystiff.net> [2005-04-16 01:33:19 +0900]:

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.

:wink:

···

--
Jim Freeze
Code Red. Code Ruby

why the lucky stiff <ruby-talk@whytheluckystiff.net> writes:

Christian Neukirchen wrote:

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&gt;

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:
* Blockquotes, which are:
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

Ok, I guess I'll wait a bit with my transition then.

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.

Another question, to what extend does RedCloth quote < and > ?
I'd like to write RedCloth *in* Vooly markup, say

    <<quote This message was written *hastily*,
    so I may be _wrong_ about any of the above.
    --- [Why the Lucky Stiff](http://...) >>

Simple cases seem to work, but maybe you know about any traps. If
this works, I'm likely to switch to RedCloth for Anarchaia, as
BlueCloth currently either destroys the << or doesn't markup it.

···

_why

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org