[tracker/sam/ontology-docs: 20/25] docs: Add anchors for external use



commit 6f7709ee1e2157cc9e42f9fd77f65cbd420bc3bd
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Apr 12 23:27:15 2020 +0200

    docs: Add anchors for external use
    
    This allows us to use normal rdf-style URL fragments, like
    <http://api.gnome.org/ontologies/v3/nao#Tag>.

 docs/tools/ttlresource2xml.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/docs/tools/ttlresource2xml.c b/docs/tools/ttlresource2xml.c
index b48b8b0a5..02ce115aa 100644
--- a/docs/tools/ttlresource2xml.c
+++ b/docs/tools/ttlresource2xml.c
@@ -592,8 +592,10 @@ print_property_table (FILE          *f,
                g_fprintf (f, "<td>");
                g_fprintf (f, "<indexterm zone='%s.%s'><primary sortas='%s'>%s</primary></indexterm>",
                           id, prop_id, shortname, shortname);
-               g_fprintf (f, "<anchor id='%s.property.%s' />",
-                          id, basename);
+               /* This anchor is globally unique and can be used for internal links */
+               g_fprintf (f, "<anchor id='%s.property.%s' />", id, basename);
+               /* This anchor is unique within the refentry and can be used for external links */
+               g_fprintf (f, "<anchor id='%s' />", basename);
                g_fprintf (f, "%s", basename);
                g_fprintf (f, "</td>");
 
@@ -686,6 +688,9 @@ print_ontology_class (Ontology      *ontology,
        name = ttl_model_name_to_basename (ontology, klass->classname);
        id = ttl_model_name_to_shortname (ontology, klass->classname, "-");
 
+       /* Anchor for external links. */
+       g_fprintf (f, "<anchor id='%s' />\n", name);
+
        g_fprintf (f, "<refsect2 id='%s'>\n", id);
        g_fprintf (f, "<title>%s</title>\n", name);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]