<pre> in exported HTML?

Mitchell L Model MLMLists at Comcast.net
Mon Mar 14 19:21:19 PST 2005


About 20 hours ago I wrote:

>How can I get a <pre>...</pre> included when exporting to HTML, DHTML, or Word (HTML)?  I need to include chunks of computer code in my document.  I can format these in OO3 using <option>-<tab> and <option>-<return>, but the white space disappears on export.
>
>...

and about 9 hours ago I wrote:

>In exports to "Word (HTML)" text formatting styles (for instance, I have one for Code that uses a monospaced font) applied to part of a row's text are specified using <span class="...">.  That's wonderful, since it preserves the logical connotation of the style, and I can reformat the style however I want in the HTML by changing its CSS specification for the style.  However, if you apply a style to the entire text in the first column of a row, either by selecting the whole row and applying the style, or editing the text in the first colum, selecting all of the text, and applying the style, what gets exported is a span that specifies the style details rather than a class.  [This is easily reproduced by first selecting all the text and exporting, then selecting all but the last character and exporting, and comparing the results.]
>
>This can't be right.  All styled text should be exported with class-labelled spans.  Of course text that is arbitrarily formatted by specifying bold, or font size, or typeface, etc., would always be output with a span detailing the formatting, and therefore if one wants to preserve the style tags (either for their logical connotation or to change their CSS specification) one should always apply a style rather than arbitrary formatting.
>
>I am working around this by adding an extra space at the end of the text and avoiding selecting it when I apply style to the entire text, but really this is a major gotcha that should be fixed ASAP.

Selecting all but the last character, to ensure that class-based <span>'s are used rather than <span>'s with arbitrary styles, leads to further difficulties in the attempt to produce fixed-format (e.g., computer code) output: now, each line gets its own class-based <span>, even though all those spans are the same.  Each newline inserted with <option>-<return> (<option>-<enter>) are replaced with a space.  I was wrong in my initial method about tabs, though -- they do get preserved; however, since the resulting <span>'s affect character formatting, not block layout, they disappear when the HTML is displayed.

What I need, and this can't be all that unusual, is to be able to designate as <pre> an entire paragraph in a row cell or in a row's notes.  This is vaguely related to the discussions about whether notes should contain meta-content or body text -- either way, I need to designate some text as preformatted.  And then I would want to be able to apply a style to the <pre> as a whole, not have each line enclosed in the same <span>.  I'm supposed to be able to write books, courses, papers, etc. with OO3, right?  But not if the material includes computer code?



More information about the OmniOutliner-Users mailing list