Vaska.WSG schrieb:

Actually, because I can't really find a way to get by on the word-wrap issue and also the use of indents (as they appear in the code) I've done all of this in php without code or pre. It uses  's for the tabs (preg_replace("/\t/"...). ...
If you are curious this is what an output looks like ...

<strong>1</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php<br />
<strong>2</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<strong>3</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function rowNumber($i)<br />

When you are using php, you can do this with

<ol class="csshtml">
  <li class="t01"><code>&lt;?php</code></li>
  <li class="t02"><code>function rowNumber($i)</code></li>

and so on. I saw this on

and I think it makes much sense to put a source listing in a <ol> and the tabulator as a class for <li> and the line code in <code>.

And it's flexible enough for indenting, hovering and so on. Now you can style the classes and code for your needs.

For example, I don't use the line numbers for short code snippets in my demo here:
see what happens when the line wraps: the indention/tab takes effect.

( IMHO that's better than
pre { white-space: -moz-pre-wrap; white-space: pre-wrap;}
starts at the beginning of the line after a wrap)

Should be usable even when CSS is off.

Another way without php might be to leave the pre on the page

<pre> ... </pre>

and to write a javascript injection routine for this to get

<ol class="csshtml">
  <li class="t01"><code>&lt;?php</code></li>

automagically. Anyone sure can do this, might be practical for pages with listings.


The discussion list for

for some hints on posting to the list & getting help

Reply via email to