RedCloth/Textile question

Discussion in 'Ruby' started by Jim Menard, Jun 10, 2004.

  1. Jim Menard

    Jim Menard Guest

    How do I escape naked markup characters like "*" and "+"?

    _why_, I've also added a few new bug reports to the Rubyforge tracker.

    Jim
    --
    Jim Menard, , http://www.io.com/~jimm/
    "333: Eric the Half A Beast" -- Tim Allen in rec.humor.oracle.d
    Jim Menard, Jun 10, 2004
    #1
    1. Advertising

  2. Jim Menard

    Jim Menard Guest

    Jim Menard writes:
    > How do I escape naked markup characters like "*" and "+"?


    More information: a single character works as expected. For example, with the
    input

    This is * intersting.

    the asterisk is output. But this

    This is "*" interesting because I am talking about "*" characters.

    outputs the text between the asterisks as bold. Is there any way to turn off
    the meaning of "*", "+", etc. so that it does not start a region of marked up
    text?

    Another question: can I insert literal HTML characters like &42; (which is an
    asterisk)?

    Jim
    --
    Jim Menard, , http://www.io.com/~jimm/
    "An object at rest cannot be stopped!"
    -- The Evil Midnight Bomber What Bombs At Midnight
    Jim Menard, Jun 10, 2004
    #2
    1. Advertising

  3. Jim Menard wrote:

    >But this
    >
    > This is "*" interesting because I am talking about "*" characters.
    >
    >outputs the text between the asterisks as bold. Is there any way to turn off
    >the meaning of "*", "+", etc. so that it does not start a region of marked up
    >text?
    >
    >

    For protecting short phrases from RedCloth's processor, surround with
    double equals signs.

    in: ==This is "*" interesting because I am talking about "*" characters.==
    out: This is "*" interesting because I am talking about "*" characters.

    in: This *bold* but this is ==*asterisked*==.
    out: This <strong>bold</strong> but this is *asterisked*.

    If you have a large block of text you want protected, you can surround
    it with <notextile> tags. In addition, <pre> and <code> contents are
    protected from Textile formatting.

    I'll clarify this in the reference @ http://hobix.com/textile/

    >Another question: can I insert literal HTML characters like &42; (which is an
    >asterisk)?
    >
    >

    You should be able to. Looks like this is broken (frown) but I will put
    this in the stack. Thanks for the bug report, Jim.

    _why
    why the lucky stiff, Jun 10, 2004
    #3
  4. On Friday, June 11, 2004, 5:47:07 AM, why wrote:

    > If you have a large block of text you want protected, you can surround
    > it with <notextile> tags. In addition, <pre> and <code> contents are
    > protected from Textile formatting.


    If you want to use some formatting (bold, italic, ...) in a code
    block, are there any good methods?

    Gavin
    Gavin Sinclair, Jun 11, 2004
    #4
  5. Gavin Sinclair wrote:
    > On Friday, June 11, 2004, 5:47:07 AM, why wrote:
    >
    >>If you have a large block of text you want protected, you can surround
    >>it with <notextile> tags. In addition, <pre> and <code> contents are
    >>protected from Textile formatting.

    >
    > If you want to use some formatting (bold, italic, ...) in a code
    > block, are there any good methods?
    >


    I haven't thought much about this. Immediately, I'd say you would need
    to use a tag other than <pre> or <code>. Right now I just wrap those
    sorts of code blocks in <div class="formattedCode"> tags and then be
    sure to give the formattedCode class <pre>-like css properties.

    With RedCloth 2.1, you'll also be able to override RedCloth's default
    handling of elements. Would that be okay?

    _why
    why the lucky stiff, Jun 11, 2004
    #5
  6. Jim Menard

    Jim Menard Guest

    why the lucky stiff writes:
    > Gavin Sinclair wrote:
    > > On Friday, June 11, 2004, 5:47:07 AM, why wrote:
    > >
    > >>If you have a large block of text you want protected, you can surround
    > >>it with <notextile> tags. In addition, <pre> and <code> contents are
    > >>protected from Textile formatting.

    > >
    > > If you want to use some formatting (bold, italic, ...) in a code
    > > block, are there any good methods?
    > >

    >
    > I haven't thought much about this. Immediately, I'd say you would need
    > to use a tag other than <pre> or <code>. Right now I just wrap those
    > sorts of code blocks in <div class="formattedCode"> tags and then be
    > sure to give the formattedCode class <pre>-like css properties.
    >
    > With RedCloth 2.1, you'll also be able to override RedCloth's default
    > handling of elements. Would that be okay?


    Hmm...I did not see Gavin's message or any others except my original post and
    this one.

    I didn't know about <notextile> or ==notextile==. I'll give them a try. Time
    to read the source code.

    Jim
    --
    Jim Menard, , http://www.io.com/~jimm/
    "Build a man a fire and he's warm for the rest of the evening.
    Set a man on fire and he's warm for the rest of his life."
    -- Steve Taylor, in comp.lang.smalltalk
    Jim Menard, Jun 11, 2004
    #6
  7. On Friday, June 11, 2004, 12:04:41 PM, why wrote:

    > Gavin Sinclair wrote:
    >> On Friday, June 11, 2004, 5:47:07 AM, why wrote:
    >>
    >>>If you have a large block of text you want protected, you can surround
    >>>it with <notextile> tags. In addition, <pre> and <code> contents are
    >>>protected from Textile formatting.

    >>
    >> If you want to use some formatting (bold, italic, ...) in a code
    >> block, are there any good methods?
    >>


    > I haven't thought much about this. Immediately, I'd say you would need
    > to use a tag other than <pre> or <code>. Right now I just wrap those
    > sorts of code blocks in <div class="formattedCode"> tags and then be
    > sure to give the formattedCode class <pre>-like css properties.


    > With RedCloth 2.1, you'll also be able to override RedCloth's default
    > handling of elements. Would that be okay?


    I'm curious more than anything. I'd rather see a standard for this
    sort of thing than have to roll my own, but again I'm not aching for
    it.

    Thanks,
    Gavin
    Gavin Sinclair, Jun 11, 2004
    #7
    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. why the lucky stiff
    Replies:
    0
    Views:
    109
    why the lucky stiff
    Feb 6, 2004
  2. why the lucky stiff
    Replies:
    0
    Views:
    93
    why the lucky stiff
    Apr 2, 2004
  3. why the lucky stiff
    Replies:
    0
    Views:
    95
    why the lucky stiff
    Apr 8, 2004
  4. why the lucky stiff
    Replies:
    0
    Views:
    102
    why the lucky stiff
    Apr 14, 2004
  5. why the lucky stiff
    Replies:
    0
    Views:
    96
    why the lucky stiff
    Apr 16, 2004
Loading...

Share This Page