Convert all inline examples to use <script>
authorGavin Carothers <gavin@carothers.name>
Tue, 05 Jul 2011 13:32:26 -0700
changeset 62 92ed5110270c
parent 61 12d0b1bd351a
child 63 da8f7f171635
Convert all inline examples to use <script>
rdf-turtle/index.html
--- a/rdf-turtle/index.html	Tue Jul 05 13:17:01 2011 -0700
+++ b/rdf-turtle/index.html	Tue Jul 05 13:32:26 2011 -0700
@@ -88,6 +88,7 @@
 
     </script>
     <style type="text/css">
+    /* Style Turtle <script> blocks to be visable */
     pre.example script {
         display:block;
     }
@@ -190,27 +191,25 @@
 				example, the qualified name <code>foo:bar</code> is a shorthand for
 				the URI <code>http://example.org/ns#bar</code>.</p>
 
-				<pre class="example">
-# this is a complete turtle document
-@prefix foo: &lt;http://example.org/ns#&gt; .
-@prefix : &lt;http://other.example.org/ns#&gt; .
+				<pre class="example"><script type="text/turtle"># this is a complete turtle document
+@prefix foo: <http://example.org/ns> .
+@prefix : <http://other.example.org/ns> .
 foo:bar foo: : .
 :bar : foo:bar .
-				</pre>
+</script></pre>
 
 				<p>Literals are written either using double-quotes when they do not
 				contain linebreaks like <code>"simple literal"</code> or
 				<code>"""long literal"""</code> when they may contain linebreaks.
 				</p>
 
-				<pre class="example">
-# this is not a complete turtle document
+				<pre class="example"><script type="text/turtle"># this is not a complete turtle document
 "a string"
 """a string"""
 """a string
 with newlines
 """
-				</pre>
+</script></pre>
 
 				<p>Literals have either a language suffix or a datatype URI
 				but not both.  Languages are indicated by appending the simple
@@ -221,15 +220,13 @@
 				shortcut for a literal with the type xsd:string.</span>
 				</p>
 
-				<pre class="example">
-
-# this is not a complete turtle document
+				<pre class="example"><script type="text/turtle"># this is not a complete turtle document
 "chat"
 "chat"@en
 "chat"@fr
-"foo"^^&lt;http://example.org/my/datatype&gt;
+"foo"^^<http://example.org/my/datatype>
 """10"""^^xsd:decimal
-				</pre>
+</script></pre>
 
 				<p>
 				  The <code>"chat"</code> above is equivalent to <code>"chat"^^xsd:string</code>.
@@ -248,11 +245,10 @@
 				or the root of the <a href="#prod-turtle2-collection">collection</a>.
 				</p>
 
-				<pre class="example">
-# this is not a complete turtle document
+				<pre class="example"><script type="text/turtle"># this is not a complete turtle document
 _:me
 _:a1234
-				</pre>
+</script></pre>
 
 
 				<p>Literals <span class="non-issue">, prefixed names</span>and URIs may also contain escapes to encode surrounding
@@ -297,34 +293,31 @@
 				qualified names, prefix directives as well as later base directives.
 				</p>
 
-				<pre class="example">
-# this is a complete turtle document
+				<pre class="example"><script type="text/turtle"># this is a complete turtle document
 # In-scope base URI is the document URI at this point
-&lt;a1&gt; &lt;b1&gt; &lt;c1&gt; .
-@base &lt;http://example.org/ns/&gt; .
+<a1> <b1> <c1> .
+@base <http://example.org/ns/> .
 # In-scope base URI is http://example.org/ns/ at this point
 
-&lt;a2&gt; &lt;http://example.org/ns/b2&gt; &lt;c2&gt; .
-@base &lt;foo/&gt; .
+<a2> <http://example.org/ns/b2> <c2> .
+@base <foo/> .
 # In-scope base URI is http://example.org/ns/foo/ at this point
-&lt;a3&gt; &lt;b3&gt; &lt;c3&gt; .
-@prefix : &lt;bar#&gt; .
+<a3> <b3> <c3> .
+@prefix : <bar#> .
 :a4 :b4 :c4 .
-@prefix : &lt;http://example.org/ns2#&gt; .
-:a5 :b5 :c5 .
-				</pre>
+@prefix : <http://example.org/ns2#> .
+:a5 :b5 :c5 .</script></pre>
 
 
 				<p>The token <code>a</code> is equivalent to the URI
 				<code>&lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;</code>
 				</p>
 
-				<pre class="example">
-# this is a complete turtle document
-@prefix doc: &lt;http://example.org/#ns&gt; .
+				<pre class="example"><script type="text/turtle"># this is a complete turtle document
+@prefix doc: <http://example.org/#ns> .
 
-&lt;http://example.org/path&gt; a doc:Document .
-				</pre>
+<http://example.org/path> a doc:Document .
+                </script></pre>
 				</section>
 				<section id="abbrev">
 				<h3 >Abbreviating common datatypes</h3>
@@ -334,7 +327,7 @@
 				<a href="http://www.w3.org/TR/xmlschema-2/#integer">xsd:integer</a>.
 				in both syntax and datatype URI.</p>
 
-				<pre class="example">
+				<pre class="example"><script type="text/turtle">
 # this is not a complete turtle document
 -5
 0
@@ -343,8 +336,8 @@
 +1
 # some long form examples
 "-5"^^xsd:integer
-"10"^^&lt;http://www.w3.org/2001/XMLSchema#integer&gt;
-				</pre>
+"10"^^<http://www.w3.org/2001/XMLSchema#integer>
+				</script></pre>
 
 				<p>Decimal floating point double/fixed precision numbers may be written
 				directly and correspond to the XML Schema Datatype
@@ -352,15 +345,15 @@
 				in both syntax and datatype URI.
 				</p>
 
-				<pre class="example">
+				<pre class="example"><script type="text/turtle">
 # this is not a complete turtle document
 1.3e2
 10e0
 -12.5e10
 # some long form examples
 "1.3e2"^^xsd:double
-"-12.5e10"^^&lt;http://www.w3.org/2001/XMLSchema#double&gt;
-				</pre>
+"-12.5e10"^^<http://www.w3.org/2001/XMLSchema#double>
+				</script></pre>
 
 				<p>Decimal floating point arbitrary precision numbers may be written
 				directly and correspond to the XML Schema Datatype
@@ -368,7 +361,7 @@
 				in both syntax and datatype URI.
 				</p>
 
-				<pre class="example">
+				<pre class="example"><script type="text/turtle">
 # this is not a complete turtle document
 0.0
 1.0
@@ -376,9 +369,9 @@
 -5.0
 # some long form examples
 "0.0"^^xsd:decimal
-"-5.0"^^&lt;http://www.w3.org/2001/XMLSchema#decimal&gt;
+"-5.0"^^<http://www.w3.org/2001/XMLSchema#decimal>
 
-				</pre>
+				</script></pre>
 
 				<p>Boolean may be written directly as <code>true</code> or
 				<code>false</code> and correspond to the
@@ -387,14 +380,14 @@
 				in both syntax and datatype URI.
 				</p>
 
-				<pre class="example">
+				<pre class="example"><script type="text/turtle">
 # this is not a complete turtle document
 true
 false
 # same in long form
 "true"^^xsd:boolean
-"false"^^&lt;http://www.w3.org/2001/XMLSchema#boolean&gt;
-				</pre>
+"false"^^<http://www.w3.org/2001/XMLSchema#boolean>
+				</script></pre>
 			</section>
 
 			<section  id="groups">
@@ -403,22 +396,22 @@
 				<p>The <code>,</code> symbol may be used to repeat the subject and
 				predicate of triples that only differ in the object RDF term.</p>
 
-				<pre class="example">
+				<pre class="example"><script type="text/turtle">
 # this is not a complete turtle document
 :a :b :c ,
 	:d .
 # the last triple is :a :b :d .
-				</pre>
+				</script></pre>
 
 				<p>The <code>;</code> symbol may be used to repeat the subject of
 				of triples that vary only in predicate and object RDF terms.</p>
 
-				<pre class="example">
+				<pre class="example"><script type="text/turtle">
 # this is not a complete turtle document
 :a :b :c ;
 :d :e .
 # the last triple is :a :d :e .
-				</pre>
+				</script></pre>
 
 				</section>
 				<section id="collections">
@@ -431,7 +424,7 @@
 				in further abbreviations.
 				</p>
 
-				<pre class="example">
+				<pre class="example"><script type="text/turtle">
 # this is a complete turtle document
 @prefix : &lt;http://example.org/foo&gt; .
 # the value of this triple is the RDF collection blank node
@@ -439,7 +432,7 @@
 
 # an empty collection value - rdf:nil
 :subject :predicate2 () .
-				</pre>
+				</script></pre>
 
 				<p>See section <a href="#sec-collections">Collections</a> for
 				the details on the long form of the generated triples.
@@ -678,13 +671,14 @@
           <h3>Parsing Example (Informative)</h3>
 
           <p>The following informative example shows the semantic actions performed when  parsing this Turtle document with an LALR(1) parser:</p>
-          <pre class="example">
-@prefix ericFoaf: &lt;http://www.w3.org/People/Eric/ericP-foaf.rdf#&gt; .
-@prefix : &lt;http://xmlns.com/foaf/0.1/&gt; .
+          <pre class="example"><script type="text/turtle">
+@prefix ericFoaf: <http://www.w3.org/People/Eric/ericP-foaf.rdf#> .
+@prefix : <http://xmlns.com/foaf/0.1/> .
 ericFoaf:ericP :givenName "Eric" ;
-              :knows &lt;http://norman.walsh.name/knows/who/dan-brickley&gt; ,
-                      [ :mbox &lt;mailto:timbl@w3.org&gt; ] ,
-                      &lt;http://getopenid.com/amyvdh&gt; .</pre>
+              :knows <http://norman.walsh.name/knows/who/dan-brickley> ,
+                      [ :mbox <mailto:timbl@w3.org> ] ,
+                      <http://getopenid.com/amyvdh> .
+          </script></pre>
 
               <ul>
                 <li>Map the prefix <code>ericFoaf</code> to the IRI <code>http://www.w3.org/People/Eric/ericP-foaf.rdf#</code>.</li>
@@ -724,10 +718,10 @@
 
 
           <p>An example of an RDF collection of two literals.</p>
-          <pre class="example">
-@prefix : &lt;http://example.org/stuff/1.0/&gt; .
+          <pre class="example"><script type="text/turtle">
+@prefix : <http://example.org/stuff/1.0/> .
 :a :b ( "apple" "banana" ) .
-          </pre>
+          </script></pre>
           <p>which is short for (<a href="examples/example2.ttl">example2.ttl</a>):</p>
 
           <div data-include="examples/example2.ttl" data-oninclude="updateExample"></div>
@@ -743,23 +737,23 @@
 
           <p>For example,</p>
 
-          <pre class="example untested">(1 2.0 3E1) :p "w" .</pre>
+          <pre class="example untested"><script type="text/turtle">(1 2.0 3E1) :p "w" .</script></pre>
 
           <p>is syntactic sugar for (noting that the blank nodes <code>b0</code>, <code>b1</code> and <code>b2</code> do not occur anywhere else in the RDF graph):</p>
 
-<pre class="example untested">    _:b0  rdf:first  1 ;
+<pre class="example untested"><script type="text/turtle">    _:b0  rdf:first  1 ;
           rdf:rest   _:b1 .
     _:b1  rdf:first  2.0 ;
           rdf:rest   _:b2 .
     _:b2  rdf:first  3E1 ;
           rdf:rest   rdf:nil .
-    _:b0  :p         "w" . </pre>
+    _:b0  :p         "w" . </script></pre>
 
           <p>RDF collections can be nested and can involve other syntactic forms:</p>
 
           <pre class="example untested">(1 [:p :q] ( 2 ) ) .</pre>
 
-          <p>is syntactic sugar for:</p><pre class="example untested">    _:b0  rdf:first  1 ;
+          <p>is syntactic sugar for:</p><pre class="example untested"><script type="text/turtle">    _:b0  rdf:first  1 ;
           rdf:rest   _:b1 .
     _:b1  rdf:first  _:b2 .
     _:b2  :p         :q .
@@ -767,7 +761,7 @@
     _:b3  rdf:first  _:b4 .
     _:b4  rdf:first  2 ;
           rdf:rest   rdf:nil .
-    _:b3  rdf:rest   rdf:nil .</pre>
+    _:b3  rdf:rest   rdf:nil .</script></pre>
         </section>
         <section id="sec-identifiers">
           <h2>Identifiers for the Turtle Language</h2>