- From: Francois Stragier <stragier@email.enst.fr>
- Date: Wed, 1 May 1996 16:52:37 +0200 (MET DST)
- To: murray@spyglass.com (Murray Altheim)
- Cc: www-html@w3.org
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
Received on Wednesday, 1 May 1996 10:54:43 UTC