Why "pre" AND "code" tags in Textile Markup?

Discussion in 'Ruby' started by Andreas Semt, Jan 13, 2005.

  1. Andreas Semt

    Andreas Semt Guest

    Hello list!

    I use Instiki and Soks ("Soks rocks." TM by James Britt ;-)) as personal
    and working Wiki apps. Both support the Textile Markup language - which
    is a *really good* one, i think. However I don't understand why there
    are _two_ tags for code formatting in Textile. From the Textile
    reference (http://hobix.com/textile/)
    --- snip ---
    For example, long code blocks belong between pre and code tags. Please
    also indent your code inside the tags to be sure that all Textile
    processors out there will ignore the contents.
    --- snap ---

    Why "pre" *and* "code"? If i use only one of them, the rendered wiki
    page output is identical to the output where i used both of them.
    So why?

    Greetings,
    Andreas
    Andreas Semt, Jan 13, 2005
    #1
    1. Advertising

  2. Andreas Semt

    Cristi BALAN Guest

    On Fri, 14 Jan 2005 00:00:56 +0900, Andreas Semt <> wrote:
    > Hello list!
    >
    > I use Instiki and Soks ("Soks rocks." TM by James Britt ;-)) as personal
    > and working Wiki apps. Both support the Textile Markup language - which
    > is a *really good* one, i think. However I don't understand why there
    > are _two_ tags for code formatting in Textile. From the Textile
    > reference (http://hobix.com/textile/)
    > --- snip ---
    > For example, long code blocks belong between pre and code tags. Please
    > also indent your code inside the tags to be sure that all Textile
    > processors out there will ignore the contents.
    > --- snap ---
    >
    > Why "pre" *and* "code"? If i use only one of them, the rendered wiki
    > page output is identical to the output where i used both of them.
    > So why?
    >
    > Greetings,
    > Andreas
    >


    I haven't tried what you asked but, I think they actually meant use
    pre _or_ code however you see fit, because pre and code do the same
    thing but one is an inline element and one is a block.

    Example:
    <html>
    <body>
    111<code>aaaa
    bbbb</code>222

    111<pre>aaaa
    bbbb</pre>222
    </body>
    </html>


    --
    Cristi BALAN
    Cristi BALAN, Jan 13, 2005
    #2
    1. Advertising

  3. Andreas Semt

    Andreas Semt Guest

    Cristi BALAN wrote:

    > On Fri, 14 Jan 2005 00:00:56 +0900, Andreas Semt <> wrote:
    >
    >>Hello list!
    >>
    >>I use Instiki and Soks ("Soks rocks." TM by James Britt ;-)) as personal
    >>and working Wiki apps. Both support the Textile Markup language - which
    >>is a *really good* one, i think. However I don't understand why there
    >>are _two_ tags for code formatting in Textile. From the Textile
    >>reference (http://hobix.com/textile/)
    >>--- snip ---
    >>For example, long code blocks belong between pre and code tags. Please
    >>also indent your code inside the tags to be sure that all Textile
    >>processors out there will ignore the contents.
    >>--- snap ---
    >>
    >>Why "pre" *and* "code"? If i use only one of them, the rendered wiki
    >>page output is identical to the output where i used both of them.
    >>So why?
    >>
    >>Greetings,
    >>Andreas
    >>

    >
    >
    > I haven't tried what you asked but, I think they actually meant use
    > pre _or_ code however you see fit, because pre and code do the same
    > thing but one is an inline element and one is a block.
    >
    > Example:
    > <html>
    > <body>
    > 111<code>aaaa
    > bbbb</code>222
    >
    > 111<pre>aaaa
    > bbbb</pre>222
    > </body>
    > </html>
    >
    >


    Hello Cristi!

    Yes ... "code" could is an inline tag and "pre" a block tag. However,
    the Textile Reference (http://hobix.com/textile/) shows following example:

    --- snip ---
    <pre>
    <code>
    a.gsub!( /</, '' )
    </code>
    </pre>
    --- snap ---

    Both tags are used in conjunction. And *now* i know why!
    The "pre" tag indents the whole content of the "code" tag. Without "pre"
    it's all at the beginning of the line, not indented. "pre" creates an
    indented block with formatted text, "code" just prints formatted text,
    nothing more.

    Sorry for asking a stupid question.

    Greetings,
    Andreas
    Andreas Semt, Jan 13, 2005
    #3
  4. I'd like to clarify a few things. The <pre> tag's purpose is to
    display pre-formated text exactly as input. Normal HTML will ignore
    leading, trailing, and consecutive whitespace, but inside <pre> tags,
    the tabs and whatnot are all rendered on-screen. Also, the <pre> tag
    typically renders the text in a monospace font.

    The <code> tag also renders text in a monospace font, but (to the best
    of my knowledge) doesn't do to whitespace what <pre> does. It also
    adds additional semantic meaning to the text: "This text is code."


    On Fri, 14 Jan 2005 01:15:47 +0900, Andreas Semt <> wrote:
    > Both tags are used in conjunction. And *now* i know why!
    > The "pre" tag indents the whole content of the "code" tag. Without "pre"
    > it's all at the beginning of the line, not indented. "pre" creates an
    > indented block with formatted text, "code" just prints formatted text,
    > nothing more.
    Patrick Spence, Jan 13, 2005
    #4
  5. Andreas Semt

    Andreas Semt Guest

    Patrick Spence wrote:
    > I'd like to clarify a few things. The <pre> tag's purpose is to
    > display pre-formated text exactly as input. Normal HTML will ignore
    > leading, trailing, and consecutive whitespace, but inside <pre> tags,
    > the tabs and whatnot are all rendered on-screen. Also, the <pre> tag
    > typically renders the text in a monospace font.
    >
    > The <code> tag also renders text in a monospace font, but (to the best
    > of my knowledge) doesn't do to whitespace what <pre> does. It also
    > adds additional semantic meaning to the text: "This text is code."
    >


    Hello Patrick!

    Thanks for your clarification! So <pre> saves the whitespace (tested in
    the Soks wiki), <code> does not (also tested ;-)). Both render text in a
    monospace font, <code> adds semantic meaning to the text surrounded by
    <code> tags.

    Greetings,
    Andreas

    >
    > On Fri, 14 Jan 2005 01:15:47 +0900, Andreas Semt <> wrote:
    >
    >>Both tags are used in conjunction. And *now* i know why!
    >>The "pre" tag indents the whole content of the "code" tag. Without "pre"
    >>it's all at the beginning of the line, not indented. "pre" creates an
    >>indented block with formatted text, "code" just prints formatted text,
    >>nothing more.

    >
    >
    >
    >
    Andreas Semt, Jan 18, 2005
    #5
    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. Rocky Moore
    Replies:
    7
    Views:
    1,734
    mikeb
    Jan 14, 2004
  2. Victoria
    Replies:
    1
    Views:
    524
    Collin VanDyck
    Mar 1, 2004
  3. Mike

    Noob: Code & Pre tags...

    Mike, Jul 3, 2006, in forum: HTML
    Replies:
    6
    Views:
    377
    Toby Inkster
    Jul 6, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,804
    Smokey Grindel
    Dec 2, 2006
  5. Nathan Sokalski

    Typing Markup Tags Ending in />

    Nathan Sokalski, Dec 30, 2006, in forum: ASP .Net
    Replies:
    14
    Views:
    707
    _AnonCoward
    Jan 2, 2007
Loading...

Share This Page