W3C home > Mailing lists > Public > www-html@w3.org > November 2003

Re: The <blockcode> and <l> elements

From: Christian Wolfgang Hujer <Christian.Hujer@itcqis.com>
Date: Mon, 10 Nov 2003 12:16:14 +0100
To: Lachlan Hunt <lhunt07@postoffice.csu.edu.au>
Cc: www-html@w3.org
Message-Id: <200311101216.16890.Christian.Hujer@itcqis.com>

Hash: SHA1

Hi Lachlan, dear list members,

Am Sonntag, 9. November 2003 03:11 schrieb Lachlan Hunt:
> Your previous example (The one I previously misunderstood):
> > <blockcode>
> > <h>\chapter{introduction}</h>
> > <p>This is really interesting stuff.</p>
> > </blockcode>
> >
> > Marking up LaTeX or XHTML using XHTML in a <blockcode/> while also
> > demonstrating the results of the markup.
>   It is incorrect to mix source code with presentational output, as your
> example appears to do since, semantically, they are completely
> different.  You should write the source code in a section of <blockcode>
> and the sample output in a separate section of <blocksamp> (if that
> element is introduced).
who says so?

Imagine a source code browser based on XHTML and some Java or Perl or 
whatsoever engine. symbols are hyperlinks, their definitions are sections, 
with their main definition line being the heading.
I want to be able to do this in a single blockcode per source file.
And in that, their main definition lines are the headings, the blocks are the 
If you don't want such a source browser, that's your choice. But I want to 
write such a source browser, and therefor I want to use <section/> and <h/> 
within <blockcode/>.
And therefor I don't want your suggested restriction on <blockcode/>'s content 

> > ...give a resource a Java-ish style by using such section headers:
> > <section>
> > <h><code>public class Hello {</code></h>
> > <!-- ... --->
> > </section>
>   Yes, this is exactly what should be done if you want your heading to
> be a snippet of code!
>   Personally, I would use:
>     1. <h>Hello.java</h> OR
>     2. <h><code><span class="modifier">public class</span>
>        <span class="classname">Hello</span></code></h>
> or something similar, as the heading rather than than the full class
> declaration (with the opening brace '{') as you have done.
>   Version 1 is simple and effective, whereas version 2 is *similar* to
> the way Sun produces their java API docs.
But I don't want to repeat the stuff...

> > But if they all start with their listing, why repeat the first line
> > again? <snip/> (sample code based on above description)
>    Because a document/section heading is... A Heading!  It is NOT part
> of its following content.  A Heading, just like the document's <title>
> element, should be descriptive of the content within it's section, but
> not included within.
But the class declaration is a heading as well. It's the heading of a class.

And please, don't stick too much on the fact that it's Java.
Just try to imagine that there might be cases where some people might want to 
treat a part of a blockcode with some more elements than just <l/> and 
Inline, and that in their eyes that's not completely semantical nonsense but 
truely makes sense to them.

> > Currently there's no restriction in XHTML that requires headings to be
> > used as top level of sections only. And I definitely wouldn't change
> > that.
>   I wouldn't change that either, but headings in code are completely wrong!
> ** I'd like to see an editor that can markup/present headings in code! **
Vim exactly knows what's the heading of a Javadoc comment, for instance, and 
marks it up accordingly.
You call it syntax highlighting, but it's semantically much stronger. Vim 
"knows" what it highlights, and that information can be used for folding 

> -- Some Constructive Feedback and Ideas --
>   Based on how you want to markup your code, and the idea that different
> sections of code should be marked as being so; perhaps, if <blockcode>
> elements could be nested, each with its own title attribute; then each
> function could be semantically seperated from the others, yet still be
> grouped together in a single large block of code.
>   Whether comments have line numbers or not then becomes a presentation
> issue with CSS using appropriate selectors.
>   Maybe <blockcode> should be either:
> 1. <!ELEMENT blockcode (blockcode, l)*>
> 2. <!ELEMENT blockcode (PCDATA | blockcode | Inline)*>
>   Remember, the content model for <l> is <!ELEMENT l (#PCDATA | Inline)*>
> so there is no restriction on using Inline elements for either of these
> two options.
>   I prefer version 1, since it is more strict and forces more structure
> than version 2, though anything that's valid for version 1 MUST also be
> valid for version 2 (since <l> is an Inline element).
Still I cannot agree with you, neither your first nor your second version.
And I do not want to agree with your second one.
I definitely want to be able to use <div/>, <section/> and <h/> in 

>   If you want to break code into sections, The following options would
> still be possible:
> <section>
>     <h/>
>     <blockcode/>
> </section>
> <section>
>     <h/>
>     <blockcode/>
> </section>
> OR perhaps, nested <blockcode> elements may be better:
Argl!!!!! ;-)
That's nonsense to me, sorry!
I want to extract a listing with XPath like this:
Splitting up a single source code into several <blockcode/> elements makes no 
sense because it tears a part a source which logically belongs together.

> <blockcode>
>     <blockcode class="comment javadoc" title"JavaDoc Comments for Method
> A"/>
>     <blockcode id="methoda" title="Method A"/>
>     <l/> <!-- blank line between methods -->
>     <blockcode class="comment javadoc" title"JavaDoc Comments for Method
> B"/>
>     <blockcode id="methodb" title="Method B"/>
> </blockcode>
That's better, but this isn't a listing in a listing.
A listing in a listing would be:
<blockcode class="perl" xml:space="preserve">#!/usr/bin/perl
print <<END;
<blockcode class="http">Content-Type: application/xhtml+xml


print <<END;
<blockcode class="xhtml"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Simple HTML</title></head>
<body><h1>Simple HTML</h1><!-- ... --></body>

<blockcode class="xhtml" xml:space="preserve"><![CDATA[<?xml version="1.0" 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Simple HTML</title></head>
<body><h1>Simple HTML</h1><?cgi]]><blockcode class="perl">
for (1..10) {
<p>Hallo $_</p>
<?cgi]]><blockcode class="perl">

That's source within source.
That's where it makes sense to nest blockcode.
But just to give structural parts of the same source a class or id or title, 
nesting blockcodes is semantically wrong to me, because I can't see other 
code there.

Saying a class switch also is not appropriate. Just think of a perl script 
that generates perl scripts or contains an eval expression.

> > Another point of view is given by a comparison with <blockquote/>.
> > A blockquote must be able to contain headings...
> > Why should <blockcode/> differ so much from that?
>   Code is nothing like a quote.  Code is, and forever will be **Plain
> Text** (with structure)!  Code is more like <pre> (Preformatted Text)
> which, presentationally, is what it is, though semantically it's more
> than that.  <pre> cannot contain any Block level elements:
>   <!ELEMENT pre (PCDATA | Inline)*>
> And neither should <blockcode> (with the exception of nested <blockcode>
> elements).
Code is like a quote.
It's the language and purpose that differs, but it's a fluent border.
Code is like a quote. It's a quote of Java or C or Perl instead of German or 
English or Chinese. Semantically, the heading is a main central point giving 
a semantical anchor for a section of text. I don't see why "chapter 01: 
introduction" or "public class Hello {" differ in the definition of a 

And think of texts where a blockcode is a poem.

<blockcode xml:space="preserve">
<h2># I try to sort</h2><![CDATA[
$in = shift @ARGV || "-";
$out = shift @ARGV || "-";
open IN, "<$in" or die "oh my god I failed at $in";
open OUT, "<$out" or die "oh my god I faild at $out";
@it = <IN>;
@it = sort @it;
@it = reverse @it;
print @it;

I as a little perl poet demand that I may tag my blockcodes the same way I tag 
blockquotes. Perl poets over the world, unite!
(of course above little program could nearly also be written print reverse 
sort <> but who cares, it's poetry!)

Just google for perl poetry.
Most of these in fact are listings and it's intended that you try to compile 
and run them. So <blockcode/> is an appropriate form of markup. Still they 
are poems, and as such they also may have headings etc..

> [empty <l/>]
I gave such an example of a valid empty <l/> ~6 months ago on this list, if I 
remember correctly :-)

- -- 
Christian Wolfgang Hujer
Geschäftsführender Gesellschafter (Shareholding CEO)
Telefon: +49  (0)89  27 37 04 37
Telefax: +49  (0)89  27 37 04 39
E-Mail: Christian.Hujer@itcqis.com
WWW: http://www.itcqis.com/
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

Received on Monday, 10 November 2003 07:36:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:40:09 UTC