[uf-discuss] Formating Code

Charles Iliya Krempeaux supercanadian at gmail.com
Mon Oct 31 22:49:11 PST 2005


Hello,

On 10/31/05, Jacob Ham <hakejam at gmail.com> wrote:
> I was just thinking today about the way we format code.  After playing with
> it a little, I thought why not create a Microformat for formatting code?  As
> I see it, formatting code in this matter can reap the benefits that
> microformat provide.  Here is just a small example (very quick):
>
> <div class="hCode">
>     <div id="vCard"><a class="url fn" href="http://www.hakejam.com">Jacob
> Ham</a></div>
>     <a href="http://creativecommons.org/licenses/by/2.0/"
> rel="license">cc by 2.0</a>
>     <span class="version"> 0.0.1</span>
>     <abbr class="created"
> title="20051031">10-31-2005</abbr>
>     <span class="summary">A simple program that prints out Hello
> World.</span>
>      <code class="Java">
>         class HellWorld {
>             public static void main(String args[]) {
>                 System.out.println("Hello World");
>             }
>         }
>     </code>
> </div>
>
> The microformat coding format could include:
>
> - author (vCard)
> - version number
> - a small summary of what the code does
> - the type of code it is
> - licenses it may use
>
>
>
> Sniplet repositories like, Snippets
> (http://www.bigbold.com/snippets/), other kinds of
> paste-bins, tutorials, documentation, and so on.
>
> If there is enough interest, I can start a brainstorming page for it.

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.


See ya

--
     Charles Iliya Krempeaux, B.Sc.

     charles @ reptile.ca
     supercanadian @ gmail.com

     developer weblog: http://ChangeLog.ca/
___________________________________________________________________________
 Never forget where you came from


More information about the microformats-discuss mailing list