diff --git a/ontopy/ontodoc_rst.py b/ontopy/ontodoc_rst.py
index 20ac86a5f..1c07c76ca 100644
--- a/ontopy/ontodoc_rst.py
+++ b/ontopy/ontodoc_rst.py
@@ -3,6 +3,7 @@
"""
# pylint: disable=fixme,too-many-lines,no-member,too-many-instance-attributes
+# pylint: disable=invalid-name
import html
import re
import time
@@ -60,6 +61,10 @@ def __init__(
self.individuals = set()
self.datatypes = set()
+ # All navigation IDs added by the ontology. Used to warn about
+ # dublicated IDs
+ self.navids = set()
+
if ontology:
self.add_ontology(ontology)
@@ -137,7 +142,7 @@ def get_refdoc(
subsections: str = "all",
header: bool = True,
) -> str:
- # pylint: disable=too-many-branches,too-many-locals
+ # pylint: disable=too-many-branches,too-many-locals,too-many-statements
"""Return reference documentation of all module entities.
Arguments:
@@ -186,15 +191,31 @@ def add_header(name):
]
)
- def add_keyvalue(key, value, escape=True, htmllink=True):
- """Help function for adding a key-value row to table."""
- if escape:
- value = html.escape(str(value))
- if htmllink:
- value = re.sub(
- r"(https?://[^\s]+)", r'\1', value
- )
- value = value.replace("\n", "
")
+ def add_keyvalue(
+ key, value, escape=True, htmllink=True, show_figure=True
+ ):
+ """Help function for adding a key-value row to table.
+
+ Arguments:
+ key: Key to show in the table.
+ value: Value to show in the table.
+ htmllink: Whether to add html link to value.
+ show_figure: Whether to show figure in value column.
+
+ """
+ if show_figure and re.match(
+ r"^https?://[a-zA-Z0-9.+?@/_-]+\.(png|jpg|jpeg|svg|gif)$",
+ asstring(value, ontology=self.ontology),
+ ):
+ value = f''
+ else:
+ if escape:
+ value = html.escape(str(value))
+ if htmllink:
+ value = re.sub(
+ r"(https?://[^\s]+)", r'\1', value
+ )
+ value = value.replace("\n", "
")
lines.extend(
[
"