By jhallida on
In my fresh Drupal 7.2 install, I'm trying to use the <pre> tag to post some preformatted text (computer code). However, when attempting to do this (with the Full HTML filter), it's still trying to process the '<' tags, and thus my output is messed up.
Note that I don't want to use the <code> tag instead, since it doesn't maintain spacing. Also note that this used to work just fine in Drupal 6.
Bug? Ideas?
Comments
A Drupal 7.4 substitute for the <pre> element.
===========================
Update 2012.03.28 - This comment is Deprecated. See the next comment below.
===========================
I forget when it was months, and months ago;
and what the circumstances were when I first discovered
that I could no longer use the <pre> element tags
in my html.
Was it not when I moved up to HTML 4.01 from 4?
Or was it xHTML? I forget.
Then by my research and trial-and-error
I found that the CSS code
white-space: pre-wrap;
worked just as well, and so I have been
a happy boy since then; confidently using that code
for the few occasions that I needed it.
Today I am freaked out that that CSS code
is not working on my Drupal 7.4 site.
Ala (aka God) only knows how many problems
I now have on my site.
I was Not freaked out at first,
but after hours of fruitless work I am
because I can not believe there is not a simple
answer.
I do have a solution, but it aint simple.
It is hack, hack, hack, baby. (Somebody help me; please; I beg you)
A solution
Although the following procedure
is by no means an ideal solution,
this procedure does work for my present
limited needs.
I imagine that there is some sort of size limits
on these conversions, but I do not know what they are;
and although I remember hitting the limit at MikeZilla once
years ago, it has a fairly size-able allowance; and
the texthandler.com is new to me today.
Unfortunately the HTML code you will be putting into your
Drupal 7 page will be one long character string.
But the code characters will display properly
with line-breaks where you have them.
This procedure does, however, remove any blank-spaces at the beginning
of lines with characters if you have any indentation,
so to preserve any blank spaces that you want at the beginning
of any line containing characters,
add the following code for each blank space you want.
===
Tip: "Copy"-ing and "Paste"-ing huge character sets
inside of small field-boxes;
using the Windows Operating System.
To Copy
To Paste
===
The Procedure
Do Not include paragraph ("<p>") or line-break ("<br />") element tags
in your code.
"Copy" all of the code you want to use.
Go to the webpage "Text to HTML converter" - http://texthandler.com/?module=text_to_html
"Paste" your code into the upper field-box.
By default, each and every 'line-breaks' will be preserved with a <br />
with the exception that blank lines will initiate the creation
of paragraphs.
By default, a 'blank-line', will create a paragraph
for each set of consecutive lines that contain characters
by using <p> and </p>.
By default, if more than one blank line separates paragraphs,
an extra line break will be added for each additional blank line.
If you only un-check the "<p> - use paragraph tag" option,
the paragraph element tags will not be used, and each line break
will simply get its own <br />.
If you only un-check the "<br /> - use line break tag" option,
your line breaks will be lost, and blank lines will end a paragraph,
and immediately start a new paragraph.
If you un-check both of the "break" and "paragraph" options,
your code will be un-changed.
<p>
...with ...
<p>
</p>
... with ...
</p>
<br />
... with ...
<br />
then also replace ...
&nbsp;
... with ...
Good luck
and have fun;
like I do.
- chris
---
Drupal_8 is gonna be Great.
Come on D8; where are ya, baby?
I have been prefixing all D7 file and folder names
with "archive-" since 2009.07.
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
Continued elsewhere
I re-opened this can-of-worms. It is continued at the Forum page...
Drupal 7 - Displaying pre-formatted text & code on your site - HowTo
http://drupal.org/node/1505188
Thee intended eventual consolidation of this issue is...
===
Drupal.org documentation handbook page...
Drupal 7 - Displaying pre-formatted text & code on your site - HowTo
http://drupal.org/node/1505310
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *