On Sun, Jun 25, 2006 at 01:32:53PM -0400, Jay R. Ashworth wrote:
On Sun, Jun 25, 2006 at 07:22:53PM +0200, Steve
Bennett wrote:
We do,
however, quite often want source code in our articles.
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.
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.
--
CCD CopyWrite Chad Perrin [
http://ccd.apotheon.org ]
"A script is what you give the actors. A program
is what you give the audience." - Larry Wall