On Sun, Jun 25, 2006 at 12:26:36PM -0600, Chad Perrin wrote:
And it would probably be appropriate to have a good way of doing that. Source code doesn't necessarily demand lack of line wrapping.
It doesn't?
Certainly there are languages in which wrapping a line breaks the syntax; the Bourne Shell is only the first one that comes to mind...
If by "wrapping a line" you mean inserting a linebreak, yes, you're absolutely correct. Others include Logo, BASIC, and Python (though Logo at least provides for the ability to break a line on the page without breaking a semantic line of code via a work-around syntax).
On the other hand, the words "doesn't necessarily" seem technically accurate, since there are many languages that don't care what linebreaks you have in a file, with the possible exception of linebreaks in the midst of comments and partway through keywords, function names, et cetera. I suppose the question that needs to be asked at this point is whether the necessities of some languages suggest that we should impose the same limits on presentation of other languages that do not share those necessities.
Certainly, you might add an attribute like "linebreak=ok", though I'm not sure how the HTML markup would have to go there...
While we're at it, we might consider whether to allow line wrapping, but provide a line-wrap indicator syntax to show that what appears on a separate line of the page is in fact meant to be part of the same semantic line of code. I'm thinking of examples such as the plus-syntax used on websites such as perlmonks.org. An example of this usage might look something like this:
|while (<>) { | if ( $scalar_foo <= $scalar_bar ) && ( $scalar_bar <= $array_qux[2] +|) { | print; | } |}
. . . where the plus character is typically some differentiating color, such as red. That may or may not be appropriate for something like MediaWiki -- I only bring it up as something to consider.
Mutt does that with wrapped URL's in my mail. It's a pain because you can't then paste the copied text in without having to fix it.
On one-line URL's, this is practical.
If it's a couple hundred lines of code, maybe not so much.
Cheers, -- jra