[uf-discuss] Formating Code

Tantek Ç elik tantek at cs.stanford.edu
Mon Oct 31 23:31:42 PST 2005


On 10/31/05 10:49 PM, "Charles Iliya Krempeaux" <supercanadian at gmail.com>
wrote:

<snip>

> Just to throw in my comments.  When I include "code", I usually do it like
> this:
> 
>   <pre>
>       <code>
> 
>           class HellWorld {
>               public static void main(String args[]) {
>                   System.out.println("Hello World");
>               }
>           }
> 
>       </code>
>   </pre>
> 
> 
> That way you get the semantics that this is "code" -- from the <code>
> element.  And <pre> element tells the browser that the white space is
> significant.

Wow!  I came to the same conclusion Charles.

I've labeled such uses of multiple XHTML Elements in combination to form a
new meaning an "XHTML Compound".

Originally:
 http://tantek.com/presentations/2005/03/elementsofxhtml/
Most recently:
 http://tantek.com/presentations/2005/09/elements-of-xhtml/

I've been referring to the <pre><code> construct as a blockcode, as that was
the obvious name that we (W3C HTML WG at the time) came up with for an
element for the block version of a code element years ago.

Shortly after that I realized two key things:

1. It was really dumb to have two of the same element just to represent some
odd inline vs. block content nesting concept which was useless to web
authors, who could use CSS to affect the presentation anyway.  The whole
inline vs. block content model thing has been nothing but trouble.

2. There was no need to wait for XHTML2 and a new <blockcode> tag when
<pre><code> captured the necessary semantic (in the same number of
characters).

Thanks,

Tantek



More information about the microformats-discuss mailing list