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

A

Andreas Semt

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
 
C

Cristi BALAN

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

Andreas Semt

Cristi said:
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
 
P

Patrick Spence

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

Andreas Semt

Patrick said:
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
 

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

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top