Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

code tags only for actual code?

by mischief (Hermit)
on Dec 17, 2001 at 23:56 UTC ( [id://132637]=monkdiscuss: print w/replies, xml ) Need Help??

I just saw this note attached to a node that had been edited by japhy: ]

Edited by japhy -- please reserve

<code>...</code>
tags for actual code

Can someone tell me why this is the case, and whether others agree? Using <pre> tags means you get to keep the same screen width all the time. That's good. What's bad about using <code> tags?

Edit Masem - 2001-12-17 - replaced lt and gt entities with HTML friendly ones for understandability

Replies are listed 'Best First'.
(ar0n) Re: code tags only for actual code?
by ar0n (Priest) on Dec 18, 2001 at 00:56 UTC
    Using <pre> tags means you get to keep the same screen width all the time

    But what it also means is that pages can become hideously wide if a piece of code happens to have a long line. <code> tags get parsed by the PM engine which inserts line breaks every 70 characters or so (it depends on your user settings). That's fine for people with big screens, but it's less nice to people on a 640x480.

    On the other hand, using <code> tags for all text isn't such a good idea, as it usually means the font is smaller, and it makes the code hard to differentiate from the text.

    [ ar0n -- want job (boston) ]

      errr... that was meant to say "using <code> tags means you get to keep the same screen width all the time"! *sigh*

      edit: btw, <code> tags on my machine are all the same font size.

(zdog) Re: code tags only for actual code?
by zdog (Priest) on Dec 18, 2001 at 02:22 UTC
    Another factor is that the "d/l code" link beneath each post downloads whatever is between <code> tags. So if you have actual code in your post and someone wants to download it, it is easier for them if you only have the code between the tags. Otherwise, everything would be downloaded and things can get messy and annoying.

    Zenon Zabinski | zdog | zdog@perlmonk.org

(tye)Re: code tags only for actual code?
by tye (Sage) on Dec 18, 2001 at 03:15 UTC
Re: code tags only for actual code?
by japhy (Canon) on Dec 18, 2001 at 00:03 UTC
    I guess I wasn't clear. The original post had <code> tags around the entire text.
    In other words, it looked like this. It's my understand (so stop me if I'm wrong) that the <code> tags are meant for code (and output) samples. There are other tags (like <p> and <br>) that offer formatting. I guess <pre> tags are ok. Maybe I was wrong in my edit.

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

      Per what Ar0n said further on, <code> tags are better because the PM engine parses them differently than <pre> tags and gives the site more functionality, like the download code link.

      You were right to point out the gaffe.
      Ah, OK. My apologies then. There are other tags like <p> and <br> that offer formatting, but I find it handy to use <code> tags to save me having to type &lt; and &gt; all the time. I was also specifically thinking about output samples - lots of posters paste huge lines which make pages 100s of characters wide, and the stuff they're pasting wouldn't be considered code.
Re: code tags only for actual code?
by ralphie (Friar) on Dec 18, 2001 at 22:26 UTC
    a little while ago i included exerpts from a log file within code tags after going to the how-to to see if i could find anything about them being specfically reserved for code, at least in part with the download function in mind. the how-to mentions the code tags, at least in what i was reading, specifically as a formatting convenience so i went ahead and used them. in my post the download function was largely irrelevant, but i could envision others in which that was not the case. w/o getting long-winded, it might not be a bad idea to reserve code tags for code, but we should probably make sure that is reflected in the docs.
Re: code tags only for actual code?
by mischief (Hermit) on Dec 17, 2001 at 23:58 UTC
    Hmm. That didn't come out very well, did it? Silly me, using <pre> tags.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: monkdiscuss [id://132637]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2024-04-18 16:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found