From b96839e61b21ae69becf52cebb42efe755ea9ad0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 19 Mar 2020 17:54:22 +0100 Subject: lv2specgen: Clean up linkification code --- lv2specgen/lv2specgen.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index 75415d4..d4d360a 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -177,11 +177,12 @@ def getLabel(m, urinode): else: return '' -def linkify(string): +def linkifyCodeIdentifiers(string): + "Add links to code documentation for identifiers" + if linkmap == {}: return string - "Add links to code documentation for identifiers" if string in linkmap.keys(): # Exact match for complete string return linkmap[string] @@ -229,7 +230,7 @@ def getComment(m, urinode, classlist, proplist, instalist): markup = code_rgx.sub(code_str, markup, 1) # Add links to code documentation for identifiers - markup = linkify(markup) + markup = linkifyCodeIdentifiers(markup) # Transform prefixed names like eg:something into links if possible rgx = re.compile('([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)') @@ -537,7 +538,7 @@ def extraInfo(term, m): if isResource(getObject(p)): doc += getProperty(getTermLink(getObject(p), term, getPredicate(p)), first) elif isLiteral(getObject(p)): - doc += getProperty(linkify(str(getObject(p))), first) + doc += getProperty(linkifyCodeIdentifiers(str(getObject(p))), first) elif isBlank(getObject(p)): doc += getProperty(str(blankNodeDesc(getObject(p), m)), first) else: -- cgit v1.2.1