Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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.

#!/usr/bin/perl

use warnings;
use strict;

#testing pre and code

Update:

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
jhorner@knoxlug.org http://www.knoxlug.org/


Comment on RE: Automatic CODE tags
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... :)
      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.
      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>


      --BigJoe

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2014-08-23 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (173 votes), past polls