RedCloth, BlueCloth...

Discussion in 'Ruby' started by Hal Fulton, Apr 15, 2005.

  1. Hal Fulton

    Hal Fulton Guest

    ...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, Apr 15, 2005
    #1
    1. Advertising

  2. > 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 ]
    Stoyan Zhekov, Apr 15, 2005
    #2
    1. Advertising

  3. Hal Fulton

    James Britt Guest

    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
    James Britt, Apr 15, 2005
    #3
  4. Hal Fulton

    Tom Copeland Guest

    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.
    Tom Copeland, Apr 15, 2005
    #4
  5. Hal Fulton

    Bill Guindon Guest

    On 4/14/05, Tom Copeland <> 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.
    >


    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.

    --
    Bill Guindon (aka aGorilla)
    Bill Guindon, Apr 15, 2005
    #5
  6. 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.

    Downside - no Ruby required...
    David Mitchell, Apr 15, 2005
    #6
  7. Hal Fulton

    Mark Hubbart Guest

    On 4/14/05, David Mitchell <> 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
    Mark Hubbart, Apr 15, 2005
    #7
  8. On 4/15/05, Mark Hubbart <> wrote:
    > On 4/14/05, David Mitchell <> 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
    >
    >

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




    --
    Into RFID? www.rfidnewsupdate.com Simple, fast, news.
    Lyndon Samson, Apr 15, 2005
    #8
  9. ....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
    Mike Woodhouse, Apr 15, 2005
    #9
  10. 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.

    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.
    David Mitchell, Apr 15, 2005
    #10
  11. 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 http://www.aaronsw.com/2002/html2text/
    Florian Groß, Apr 15, 2005
    #11
  12. 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>

    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 the lucky stiff, Apr 15, 2005
    #12
  13. why the lucky stiff <> wrote:
    > 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.
    Navindra Umanee, Apr 15, 2005
    #13
  14. Hal Fulton

    Mark Hubbart Guest

    On 4/15/05, David Mitchell <> 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.


    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
    Mark Hubbart, Apr 15, 2005
    #14
  15. Navindra Umanee wrote:

    > 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().
    Florian Groß, Apr 15, 2005
    #15
  16. Hal Fulton

    Jim Freeze Guest

    * why the lucky stiff <> [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.

    ;)

    --
    Jim Freeze
    Code Red. Code Ruby
    Jim Freeze, Apr 16, 2005
    #16
  17. On 4/16/05, Florian Groß <> wrote:
    > 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?

    --
    Dmitry Borodaenko
    Dmitri Borodaenko, Apr 18, 2005
    #17
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Granger
    Replies:
    14
    Views:
    156
    David Heinemeier Hansson
    Apr 16, 2004
  2. Michael Granger

    [ANN] BlueCloth 0.0.2 (beta)

    Michael Granger, Apr 16, 2004, in forum: Ruby
    Replies:
    17
    Views:
    383
    David Heinemeier Hansson
    Apr 20, 2004
  3. Michael Granger

    [ANN] BlueCloth-0.0.3b

    Michael Granger, Apr 30, 2004, in forum: Ruby
    Replies:
    0
    Views:
    83
    Michael Granger
    Apr 30, 2004
  4. Michael Granger

    [ANN] BlueCloth-1.0.0fc3

    Michael Granger, Aug 31, 2004, in forum: Ruby
    Replies:
    0
    Views:
    99
    Michael Granger
    Aug 31, 2004
  5. Brian Schröder

    BlueCloth bug?

    Brian Schröder, Sep 27, 2004, in forum: Ruby
    Replies:
    3
    Views:
    78
    Mauricio Fernández
    Sep 27, 2004
Loading...

Share This Page