Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Avoiding code tag considerations

by belg4mit (Prior)
on Feb 02, 2007 at 20:45 UTC ( #598011=pmdevtopic: print w/ replies, xml ) Need Help??
belg4mit has raised the following topic:

What do people think of a patch to grep new nodes during preview page for /[@$%]/ and on finding a few, carping if no code tags are also seen?

--
In Bob We Trust, All Others Bring Data.

Comment on Avoiding code tag considerations
Download Code
Re: Avoiding code tag considerations
by Trizor (Pilgrim) on Feb 02, 2007 at 21:39 UTC
    It would certainly be useful when posting scatterbrained or in a hurry. Perhaps this could go a step further and have the option to auto-add code tags arround lines that look like code.
      That's far heavier and more comlpicated, if not intractable, than a simple test & warn.

      --
      In Bob We Trust, All Others Bring Data.

Re: Avoiding code tag considerations
by BrowserUk (Pope) on Feb 02, 2007 at 22:16 UTC

      Great idea. Just have it be the default User Template in the Signature Settings. Then they can change it whenever they want. Just add a link to that page of user settings in the bullet points below the textbox.

      Personally, I have a template already with some standard stuff like blockquote, para, code, list so I don't have to retype it. New users might like this rather than find it annoying.

      -xdg

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

        I don't think you can easily hijack the signature for this because of the div wrappers. It's also not an obvious place for the code to live.

        --
        In Bob We Trust, All Others Bring Data.

      I like the sentiment of the idea, but I wouldn't be surprised if we ended up with nearly as many posts like the one below (which subsequently get considered to move the code into the template*). xdg's suggestion to make recommended tags more prominent could help but certainly wouldn't solve the problem. I suspect diligence, patience, and gentle reminders to new users will continue to be required.

      *Update: Then again, it might be possible to automatically remove empty templated code blocks after hitting the Preview button, since the text (if left unmodified) would be easy to identify. That would prevent considerations for superfluous template but would not solve the original problem of missing code tags.

      Example post:

      I want to use a regex to find all of the 2 digit numbers in a string like 'abc1cdef23gh456ijl78mn' but I can't get it to work. All of the digits are returned one at a time, but I only want the numbers that contain 2 digits (like 23 and 78). Can you help me? Here is my code: my $string = 'abc1cdef23gh456ijl78mn'; while( $string =~ m/(\d)/g ) { print "found $1\n"; }

      Any code goes here

      As for customizability, that's why I suggested "on preview", which is something that people can eventually choose to bypass (not that I advocate it).

      --
      In Bob We Trust, All Others Bring Data.

Re: Avoiding code tag considerations
by xdg (Monsignor) on Feb 02, 2007 at 22:49 UTC

    I would recommend making the recommended tags more obvious for new posters. Right now they are buried on the fourth bullet point under the text-entry box and that reads as a point about <pre> tags. What about putting "use <p></p> for text and <c></c> for code" in a really obvious spot in small text to the right of the "Your Question" header or the "Preview" button?

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2014-09-23 14:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (223 votes), past polls