Skip to content

Commit

Permalink
Fix Issue #155
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholascar committed Nov 23, 2021
1 parent e7ea515 commit 2b35232
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pylode/profiles/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,15 @@ def _make_agent(self, agent_node):
elif p in [FOAF.mbox, SDO.email]:
org_email = str(o2).split("/")[-1].split("#")[-1] # remove base URI leaving only email address

# use the URI of the Agent for its URL if no FOAF.homepage or SDO.identifier has been set
if url is None and type(agent_node) == URIRef:
url = str(agent_node)

# use the URI of the Agent for its URL if no FOAF.homepage or SDO.identifier has been set
if url is None and type(agent_node) == URIRef:
url = str(agent_node)

if name is None:
if type(agent_node) == Literal:
name = agent_node
if type(agent_node) == URIRef:
name = agent_node.split("/")[-1].split("#")[-1]
agent = self._make_agent_link(name, url=url, email=email)

if org_name is not None:
Expand Down
15 changes: 15 additions & 0 deletions tests/test_issue_155.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).absolute().parent.parent))
from pylode.common import MakeDocco


def test_issue_155():
m = MakeDocco(input_data_file=str(Path(__file__).parent.parent / "pylode" / "examples" / "examples-ont" / "examples.ttl"))
html = m.document()

assert '<a href="https://linked.data.gov.au/org/surround">surround</a>' in html


if __name__ == "__main__":
test_issue_155()

0 comments on commit 2b35232

Please sign in to comment.