Skip to content

Commit

Permalink
Aligned with the LC version of HTML5+RDFa, passes all the current (up…
Browse files Browse the repository at this point in the history
…dated) tests.
  • Loading branch information
iherman committed Feb 1, 2013
1 parent 4a7f830 commit c293249
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
16 changes: 9 additions & 7 deletions pyRdfa/host/html5.py
Expand Up @@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down
19 changes: 12 additions & 7 deletions pyRdfa/termorcurie.py
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit c293249

Please sign in to comment.