| 1 |
|
| 2 |
""" |
| 3 |
Simple transfomer for Atom: the C{@typeof=""} is added to the C{<entry>} element (unless something is already there). |
| 4 |
|
| 5 |
@summary: Add a top "about" to <head> and <body> |
| 6 |
@requires: U{RDFLib package<http://rdflib.net>} |
| 7 |
@organization: U{World Wide Web Consortium<http://www.w3.org>} |
| 8 |
@author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} |
| 9 |
@license: This software is available for use under the |
| 10 |
U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">} |
| 11 |
@contact: Ivan Herman, [email protected] |
| 12 |
""" |
| 13 |
|
| 14 |
""" |
| 15 |
$Id: atom.py,v 1.3 2013-01-07 13:03:16 ivan Exp $ |
| 16 |
$Date: 2013-01-07 13:03:16 $ |
| 17 |
""" |
| 18 |
|
| 19 |
def atom_add_entry_type(node, _state): |
| 20 |
""" |
| 21 |
@param node: the current node that could be modified |
| 22 |
@param state: current state |
| 23 |
@type state: L{Execution context<pyRdfa.state.ExecutionContext>} |
| 24 |
""" |
| 25 |
def res_set(node) : |
| 26 |
return True in [node.hasAttribute(a) for a in ["resource", "about", "href", "src"]] |
| 27 |
|
| 28 |
if node.tagName == "entry" and not res_set(node) and node.hasAttribute("typeof") == False : |
| 29 |
node.setAttribute("typeof","") |