Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Aligned with the LC version of HTML5+RDFa, passes all the current (up…

…dated) tests.
  • Loading branch information...
commit c293249289863c99883c5a6bd7db4bae70eb0cb7 1 parent 4a7f830
@iherman iherman authored
Showing with 21 additions and 14 deletions.
  1. +9 −7 pyRdfa/host/html5.py
  2. +12 −7 pyRdfa/termorcurie.py
View
16 pyRdfa/host/html5.py
@@ -12,8 +12,8 @@
"""
"""
-$Id: html5.py,v 1.12 2013-01-10 10:42:07 ivan Exp $
-$Date: 2013-01-10 10:42:07 $
+$Id: html5.py,v 1.13 2013-02-01 10:53:48 ivan Exp $
+$Date: 2013-02-01 10:53:48 $
"""
try :
from functools import reduce
@@ -190,11 +190,13 @@ def _set_time(value) :
node.setAttribute("content",value)
# end _set_time
- if node.hasAttribute("datetime") :
- _set_time( node.getAttribute("datetime") )
- elif node.tagName == "time" and not node.hasAttribute("content") :
- # Note that a possible @datetime value has already been taken care of
- _set_time( _get_literal(node) )
+ if not node.hasAttribute("content") :
+ # @content has top priority over the others...
+ if node.hasAttribute("datetime") :
+ _set_time( node.getAttribute("datetime") )
+ elif node.tagName == "time" :
+ # Note that a possible @datetime value has already been taken care of
+ _set_time( _get_literal(node) )
def remove_rel(node, state):
"""
View
19 pyRdfa/termorcurie.py
@@ -19,8 +19,8 @@
"""
"""
-$Id: termorcurie.py,v 1.10 2012/11/16 17:51:53 ivan Exp $
-$Date: 2012/11/16 17:51:53 $
+$Id: termorcurie.py,v 1.11 2013-02-01 10:11:28 ivan Exp $
+$Date: 2013-02-01 10:11:28 $
"""
import re, sys
@@ -210,11 +210,16 @@ def check_prefix(pr) :
if default_vocab.vocabulary :
self.default_term_uri = default_vocab.vocabulary
- # see if there is local vocab
- def_term_uri = self.state.getURI("vocab")
- if def_term_uri :
- self.default_term_uri = def_term_uri
- self.graph.add((URIRef(self.state.base),RDFA_VOCAB,URIRef(def_term_uri)))
+ # see if there is local vocab that would override previous settings
+ # However, care should be taken with the vocab="" value that should not become a URI...
+ # Indeed, this value is used to 'vipe out', ie, get back to the default vocabulary...
+ if self.state.node.hasAttribute("vocab") and self.state.node.getAttribute("vocab") == "" :
+ self.default_term_uri = default_vocab.vocabulary
+ else :
+ def_term_uri = self.state.getURI("vocab")
+ if def_term_uri and def_term_uri != "" :
+ self.default_term_uri = def_term_uri
+ self.graph.add((URIRef(self.state.base),RDFA_VOCAB,URIRef(def_term_uri)))
else :
self.default_term_uri = None
Please sign in to comment.
Something went wrong with that request. Please try again.