Re: Digressions (was: Footnotes)

Francois Stragier (stragier@email.enst.fr)
Wed, 1 May 1996 16:52:37 +0200 (MET DST)


From: Francois Stragier <stragier@email.enst.fr>
Message-Id: <199605011452.QAA04009@charpentier.enst.fr>
Subject: Re: Digressions (was: Footnotes)
To: murray@spyglass.com (Murray Altheim)
Date: Wed, 1 May 1996 16:52:37 +0200 (MET DST)
Cc: www-html@w3.org
In-Reply-To: <v02110101adad3225f2ee@[140.186.34.50]> from "Murray Altheim" at May 1, 96 10:32:54 am

Murray Altheim said:
> 
> I was responding to your proposal on using a LANG attribute on CODE, and
> looking for an appropriate breaking element, since CODE is inline. Given
> that PRE means 'preformatted', and that is what a code fragment might be
> (whether in C, Pascal, etc.), I don't see what other element would be more
> appropriate.

I probably wasn't clear... (but why isn't this mailing-list in 
french ? ;-) ).

I just wanted to point out that in a <CODE> tag, we are not supposed
to indicate the carriage returns, whereas the <PRE> tag will print
the carriage returns we chose.

An example may explain what I mean :

Some people write C code like that:

int my_function() {
    printf("hello there!\n");
    printf("again\n"); }

I personnally would prefer:

int my_function ()
{
  printf ("hello there!\n");
  printf ("again\n");
}

So, if the source code is written in HTML between <PRE> codes,
the browser will have to display it in a manner I don't like
(although the colors of the syntax highlighting would be mine),
since the carriage returns have to be kept.

We could write it between <CODE> tags, letting the browser decide
when it should go to the next line, how to make the indentation etc.
If my preferences are a two-spaces indentations, "{" or "}" alone
in a line, the browser will respect these.

I know the <CODE> tag should only be used inline, but while we
discuss about syntax highlighting, why not find the best way to
display code? If <PRE> isn't fine because of the end-of-line,
<CODE> isn't fine because of the inline constraint, maybe
we'll need another tag. I wouldn't like it because it suppresses
the backward compatibility, and would be one tag more...
    
> I deliberately chose 'Pascal' to point out the assumptions inherent in
> using this idea. It would be a great feature if a set of stylesheets could
> be developed to handle common notations (such as computer languages) and
> then applied to specific PRE or CODE elements. Since you're calling this
> thread 'Digressions' I thought I'd throw that in the hopper.

It definitely was a fine contribution.

I hope I'm clear this time... :-)

Francois

--
 Francois Stragier - stragier@email.enst.fr - http://www-stud.enst.fr/~stragier
 Snail: 212 rue de Tolbiac - 75013 Paris - France - Phone: +33-1-45.81.72.46