Do some Javascript preprocessing
authorGavin Carothers <gavin@carothers.name>
Wed, 03 Aug 2011 09:31:00 -0700
changeset 109 2034b34bd139
parent 108 1ae29c6f3605
child 110 9b4523cc9347
Do some Javascript preprocessing
rdf-turtle/index.html
--- a/rdf-turtle/index.html	Tue Aug 02 14:13:15 2011 -0700
+++ b/rdf-turtle/index.html	Wed Aug 03 09:31:00 2011 -0700
@@ -3,8 +3,25 @@
     <head>
 	<title>Turtle</title>
 	<meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
+	<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' class='remove'></script>
 	<script src='../ReSpec.js/js/respec.js' class='remove'></script>
 	<script class='remove'>
+      $.fn.renameElement = function (name) {
+        return this.each(function () {
+          var $newElement = $(this.ownerDocument.createElement(name));
+          for (var i = 0, n = this.attributes.length; i < n; i++) {
+            var attribute = this.attributes[i];
+            $newElement[0].setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
+          }
+          $(this).contents().appendTo($newElement);
+          $(this).replaceWith($newElement);
+        });
+      };
+      preprocessTurtle = { apply: function (ignore) {
+          $("script[type='text/turtle']").removeAttr('type').renameElement('div');
+          $("script[type='text/plain']").removeAttr('type').renameElement('div');
+        }
+      }
       var respecConfig = {
 	  // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
 	  specStatus:           "FPWD",
@@ -74,7 +91,8 @@
 	  // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
 	  // Team Contact.
 	  wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/46168/status",
-	  doRDFa: true,
+	  doRDFa: false,
+	  preProcess: [ preprocessTurtle ]
       };
     </script>
     <script class="remove">
@@ -85,7 +103,7 @@
     function esc(doc, content) {
       return doc._esc(content);
     }
-
+    
     </script>
     <style type="text/css">
     /* Style Turtle script blocks to be visable */