Tags:
create new tag
, view all tags
Just want to summarize the differences between pre and verbatim tags (and the "="s TWiki markup).

This page is not accurate at this time — it may give you enough clues to figure things out if you're willing to take the time. (If you do, please fix this page.)

Note that this page will (may?) behave differently in different browsers. Particularly look for differences in konqueror vs. IE (and probably Mozilla).

See:

See also BrowserFormattingTestPage.

Contents

Equals

Surrounding text with equals signs is simply TWiki markup to create fixed font text.

I.e., this:

A fragment of text, command, code, or whatever to be rendered as fixed width text.  A little more text to serve as a test for wrapping.

Is rendered as:

A fragment of text, command, code, or whatever to be rendered as fixed width text.  A little more text to serve as a test for wrapping.

Pre

The (a?) standard HTML tag to force text to a fixed (width) font.

At least in konqueror, <pre> tags render multiple (horizontal) spaces as multiple spaces, <verbatim> tags render multiple spaces as a single space. (Need to check behavior in IE and Mozilla and others.)

The same paragraph as the first example, surrounded by <pre> tags

<pre>=A fragment of text, command, code, or whatever to be rendered as fixed width text. A little more text to serve as a test for wrapping.=</pre>

Renders as:

=A fragment of *text,* command, _code,_ or whatever to be rendered as fixed width text.  A little more text to serve as a test for wrapping.=

Verbatim

Verbatim tags are like pre tags except some TWiki markup (and HTML tags?) is "not rendered". I need to come up with a better piece of example text.

At least in konqueror, <pre> tags render multiple (horizontal) spaces as multiple spaces, <verbatim> tags render multiple spaces as a single space. (Need to check behavior in IE and Mozilla and others.)

The same paragraph as the first example, surrounded by <verbatim> tags:

<verbatim>=A fragment of text, command, code, or whatever to be rendered as fixed width text. A little more text to serve as a test for wrapping.=</verbatim>

Renders as:

=A fragment of *text,* command, _code,_ or whatever to be rendered as fixed width text.  A little more text to serve as a test for wrapping.=

Older Notes

Darn, I can't recall now, and I don't want to search for the details. Off the top of my head:

  • The difference between verbatim and pre is that one will "expand" HTML entities (tags), one will not. (And "="s is the same as one of those.)

  • IRI (I Recalled Incorrectly) that one wrapped at the width of a page and one didn't, but I don't think that is correct, and the following tidbits are relevant:

    • There is a difference between IE and Konqueror — IIRC, konqueror will wrap long verbatim or pre tagged text to the width of the page, IE will not. (Not sure about Mozilla).

    • The behavior also depends on whether the verbatim or pre tagged text is part of a table or not. The behavior is nicer (i.e., more likely to wrap) if the text is not enclosed in a table. _If you want to, for example, control the width of your text to a pecentage of your window width, use a div tag instead of a table.

More on these last two points, in particular, on BrowserFormattingTestPage.

from the Agora TWiki: "The pre tag is standard HTML; verbatim is a special TWiki tag that also forces text to fixed font mode, and also prevents other tags and TWiki shortcuts from being expanded."

More Tests or Examples

This provides a little more clarity, at least in konqueror, <pre> tags render multiple (horizontal) spaces as multiple spaces, <verbatim> tags render multiple spaces as a single space. (Shades of konquerors behavior with multiple vertical "spaces" (<p /> tags).)

Indented Lines (pre tags)

Find lines that were indented with (seven) spaces and should remain indented, and replace them with a string with a &nbsp;, etc.

  • Search for:
    \n      (.*)$

  • Replace with:
    \n=\      \1=

Indented Lines (verbatim tags)

Find lines that were indented with (seven) spaces and should remain indented, and replace them with a string with a &nbsp;, etc.

  • Search for:
    \n      (.*)$

  • Replace with:
    \n=\&<nop>nbsp;     \1=

Contributors

  • () RandyKramer - 12 Jun 2003
  • If you edit this page: add your name here; move this to the next line; and if you've used a comment marker (your initials in parenthesis), include it before your WikiName.

Page Ratings

Topic revision: r1 - 2003-06-12 - RandyKramer
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look