Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/creactistore/_templates/lib/rdflib/plugins/parsers/rdfa/transform/headabout.py
diff options
context:
space:
mode:
Diffstat (limited to 'creactistore/_templates/lib/rdflib/plugins/parsers/rdfa/transform/headabout.py')
-rw-r--r--creactistore/_templates/lib/rdflib/plugins/parsers/rdfa/transform/headabout.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/creactistore/_templates/lib/rdflib/plugins/parsers/rdfa/transform/headabout.py b/creactistore/_templates/lib/rdflib/plugins/parsers/rdfa/transform/headabout.py
new file mode 100644
index 0000000..0cf8f7a
--- /dev/null
+++ b/creactistore/_templates/lib/rdflib/plugins/parsers/rdfa/transform/headabout.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+"""
+Simple transfomer: the C{@about=""} is added to the C{<head>} and C{<body>} elements (unless something is already there).
+Note that this transformer is always invoked by the parser because this behaviour is mandated by the RDFa syntax.
+
+@summary: Add a top "about" to <head> and <body>
+@requires: U{RDFLib package<http://rdflib.net>}
+@organization: U{World Wide Web Consortium<http://www.w3.org>}
+@author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">}
+@license: This software is available for use under the
+U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">}
+@contact: Ivan Herman, ivan@w3.org
+"""
+
+def head_about_transform(html, options):
+ """
+ @param html: a DOM node for the top level html element
+ @param options: invocation options
+ @type options: L{Options<pyRdfa.Options>}
+ """
+ for top in html.getElementsByTagName("head"):
+ if not top.hasAttribute("about"):
+ top.setAttribute("about", "")
+ for top in html.getElementsByTagName("body"):
+ if not top.hasAttribute("about"):
+ top.setAttribute("about", "")
+