Re: Automatic line numbering on PRE elements - Solved, sort of
- From: Wayne <nospam@xxxxxxxxxxxxxx>
- Date: Sat, 29 Dec 2007 23:29:59 -0500
RobG wrote:
Wayne wrote:
Anthony Levensalor wrote:
Wayne said:
[snip]
Would it be reasonable to post the code here, and have
some of you experts fix it up so it works in all
browsers?
I expect that something like this is much better done on the server -
use a suitably styled ol element and you should be able to overcome most
browser differences.
Doing this on the client just doesn't make sense.
I would agree, I am also working on a PHP app for a source code
viewer. Then I could use an iframe or something similar to include
the listings in other documents. I am also playing with OpenGrok
and other code lister apps for this. Such an approach also allows
one to HTML-encode the text.
But not all PRE elements that I want numbered contain program
code. And I have hundreds of pages already that use PRE, and could
easily be changed to add a class="numbered" attribute to the tag.
I *could* just say this is for an AJAX app, that seems to be an excuse
to do anything on the client! :-) But a better reason is that
I expect CSS 3 to include the '::line-marker' pseudo selector, allowing
an easy way to number my PRE tags. So it does make sense, even if not
a lot, to use JavaScript for this, for now.
I am still learning JavaScript (and have been, on and off, for 10 years).
Mastering a new technique like correctly numbering lines is also a
way to sharpen my coder skills.
-Wayne
.
- References:
- Automatic line numbering on PRE elements - Solved, sort of
- From: Wayne
- Re: Automatic line numbering on PRE elements - Solved, sort of
- From: Anthony Levensalor
- Re: Automatic line numbering on PRE elements - Solved, sort of
- From: Wayne
- Re: Automatic line numbering on PRE elements - Solved, sort of
- From: RobG
- Automatic line numbering on PRE elements - Solved, sort of
- Prev by Date: Re: Automatic line numbering on PRE elements - Solved, sort of
- Next by Date: Re: History exercise: Mac IE and XMLHttpRequest
- Previous by thread: Re: Automatic line numbering on PRE elements - Solved, sort of
- Next by thread: Regular Expression help: multi-line mode
- Index(es):
Relevant Pages
|
Loading