Skip to content

Commit

Permalink
Merge pull request #177 from cydanil/fix/176
Browse files Browse the repository at this point in the history
Check for type when extracting RDFa content
  • Loading branch information
lopuhin committed Jul 22, 2021
2 parents 8a795f5 + 529796c commit 518cc39
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion extruct/rdfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ def extract_items(self, document, base_url=None, expanded=True):
refresh_vocab_cache=False,
check_lite=False)
g = PyRdfa(options, base=base_url).graph_from_DOM(document, graph=Graph(), pgraph=Graph())
jsonld_string = g.serialize(format='json-ld', auto_compact=not expanded).decode('utf-8')
jsonld_string = g.serialize(format='json-ld', auto_compact=not expanded)

# rdflib may return either bytes or strings
if isinstance(jsonld_string, bytes):
jsonld_string = jsonld_string.decode('utf-8')

try:
# hack to fix the ordering of multi-value properties (see issue 116)
Expand Down

0 comments on commit 518cc39

Please sign in to comment.