Skip to content

Commit

Permalink
Make contributor records to be hyperlink if email or URL
Browse files Browse the repository at this point in the history
email matching is quite rudimentary but I think should work here.

Note: did not test if works, mostly chatgpt creation ;-)
  • Loading branch information
yarikoptic committed Jul 2, 2024
1 parent 88b5fcc commit bf53465
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions databook_utils/insert_authors_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,16 @@ def run(self):

line_block = nodes.line_block()
for property in properties[1:]:
if property != "":
if not property:
continue
elif property.startswith("https://") or property.startswith("http://"):
link_node = nodes.reference(text=property, refuri=property)
line_block.append(link_node)
elif "@" in property:
mailto_link = f"mailto:{property}"
email_node = nodes.reference(text=property, refuri=mailto_link)
line_block.append(email_node)
else:
line_block.append(nodes.line(text=property))
line_block.append(nodes.line(text=""))

Expand All @@ -153,4 +162,4 @@ def setup(app):
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
}

0 comments on commit bf53465

Please sign in to comment.