pyRdfa.host.atom
Simple transfomer for Atom: the C{@typeof=""} is added to the C{
@summary: Add a top "about" to
and @requires: U{RDFLib packagehttp://rdflib.net} @organization: U{World Wide Web Consortiumhttp://www.w3.org} @author: U{Ivan Herman} @license: This software is available for use under the U{W3C® SOFTWARE NOTICE AND LICENSE1# -*- coding: utf-8 -*- 2""" 3Simple 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 10U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">} 11@contact: Ivan Herman, ivan@w3.org 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 19def 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","")
def
atom_add_entry_type(node, _state):
20def atom_add_entry_type(node, _state): 21 """ 22 @param node: the current node that could be modified 23 @param state: current state 24 @type state: L{Execution context<pyRdfa.state.ExecutionContext>} 25 """ 26 def res_set(node) : 27 return True in [node.hasAttribute(a) for a in ["resource", "about", "href", "src"]] 28 29 if node.tagName == "entry" and not res_set(node) and node.hasAttribute("typeof") == False : 30 node.setAttribute("typeof","")
@param node: the current node that could be modified @param state: current state @type state: L{Execution context<pyRdfa.state.ExecutionContext>}