diff options
author | David Robillard <d@drobilla.net> | 2020-03-19 17:54:22 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-28 17:10:05 +0100 |
commit | b96839e61b21ae69becf52cebb42efe755ea9ad0 (patch) | |
tree | d70ba5ac7c0860060ec498dac6d3bec5e8ed92b8 /lv2specgen | |
parent | 96e5616beee2b8910c1597c6299e63043f95f9d7 (diff) | |
download | lv2-b96839e61b21ae69becf52cebb42efe755ea9ad0.tar.xz |
lv2specgen: Clean up linkification code
Diffstat (limited to 'lv2specgen')
-rwxr-xr-x | lv2specgen/lv2specgen.py | 9 |
1 files 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: |