W3C home > Mailing lists > Public > public-html-comments@w3.org > March 2015

Re: <code> element and scripting languages

From: Martin Janecke <w3.org@prlbr.com>
Date: Fri, 27 Mar 2015 13:37:30 +0100
To: "public-html-comments@w3.org" <public-html-comments@w3.org>, "Andrea Rendine" <master.skywalker.88@gmail.com>
Message-ID: <op.xv5pcsij4j822h@localhost>
Am 27.03.2015, 02:22 Uhr, schrieb Andrea Rendine  
<master.skywalker.88@gmail.com>:

> […]
>
> I close with a request. Marking code snippets with their <code> tag and  
> an
> attribute-based programming language distinction, could equally be useful
> for some purposes, namely, search engine indexing and syntax highlight
> (custom-made
> or even native for some languages, now it doesn't matter).

It could be. But I suggest getting feedback from search engine operators  
whether there is real interest and use for it.

I suppose syntax highlighters already demonstrate some use for a  
programming language indicator, but I would like to know why the way they  
work now isn't sufficient. Maybe something like: a standard attribute  
enables authors to switch a syntax highlighter without having to change  
their markup? Then: do people switch syntax highlighters? Are syntax  
highlighter programmers willing to support the new attribute? How do they  
want the attribute (values) to be in order to support it?

So I think it would be better to have a practical approach than a  
theoretical one alone.


> @class and
> @data-* are used and (in the case of @class) loosely fit. But a new
> @language attribute could fit better. It is suggested by the class value
> proopsed in the spec (class="language-pascal" in the example) and it is
> also known to authors, as everybody knows (it was incorrectly specified  
> on
> <script> tags). It's not an important issue, but I hope to see it  
> realised
> in a consistent manner someday.

Please do not implement an attribute @language for this. It is too similar  
to @lang. "lang" is just an abbreviation of "language". Nothing in these  
attribute names indicates which is supposed to be used for which use case.  
I suspect it would cause confusion, i.e. some people would start  
erroneously using @language instead of @lang and vice versa.

It seems much less likely to me that @plang (as in Michael A. Peters  
example  
https://lists.w3.org/Archives/Public/public-html-comments/2015Mar/0027.html)  
would be erroneously used instead of @lang. The "p" for "programming"  
indicates what that attribute is for. Even if you don't know what "p"  
stands for you wouldn't use this attribute for a human language … (Isn't  
"plang" the sound of an empty soda can hitting a steel plate?)

Martin
Received on Monday, 30 March 2015 08:30:19 UTC

This archive was generated by hypermail 2.3.1 : Monday, 30 March 2015 08:30:20 UTC