Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

RE: Automatic CODE tags

by jjhorner (Hermit)
on Jun 20, 2000 at 16:50 UTC ( #18992=note: print w/replies, xml ) Need Help??

in reply to Automatic CODE tags

Another solution would be to look for the hash-bang line that would seem to denote the start of code, then collect it and everything up to and including the last semi-colon, and wrap in code tags. Not a perfect solution, and I'm not sure how feasible (what with everyone having different hash-bang lines and all), but a possible solution.

We could just make everything in the text box preformatted with a PRE tag. That wouldn't be a perfect solution either, but still a possible solution.


use warnings;
use strict;

#testing pre and code


After seeing kudra's response, it shouldn't be that hard to run a regexp against everyone's post (non-greedy) to be able to split up code and text. Having two code blocks could be as easy as a good rexexp.

J. J. Horner
Linux, Perl, Apache, Stronghold, Unix

Replies are listed 'Best First'.
RE: RE: Automatic CODE tags
by dempa (Friar) on Jun 20, 2000 at 16:54 UTC
    Why not just put a big All code should be inside <code></code> tags! on the edit page? I know it's a bit naive to assume that everyone who comes here can read, but anyway... :)
      I think that their should be some help at the top of the postings area. You could even have it only pop up when is user is below a level. Cuz I am pretty sure most people once they get to level 2 or so know how to do it. Also they could put the <code> put code here </code> inside of the text area that we have to put data into.
      <TEXTAREA WRAP=VIRTUAL NAME="reply" ROWS=10 COLS=60> <CODE>put code here&lt;/CODE> </TEXTAREA>

      Maybe even put the code tags into the text area so that all they have to do is get the insertion point in the right place. I suppose it is all a matter of getting the balance right -easy for first timers but without annoying the more experienced users.

      I think there is an assumption that people are comfortable with this type of HTMLish structure that perhaps has never been challenged.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://18992]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2020-04-05 01:52 GMT
Find Nodes?
    Voting Booth?
    The most amusing oxymoron is:

    Results (33 votes). Check out past polls.