[tracker: 12/20] docs: Fix xrefs to glib docs



commit 2c777421afb384eadbd23b678ff37d683da27fd0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Oct 13 12:11:39 2018 +0200

    docs: Fix xrefs to glib docs
    
    So we get proper links to glib types.

 docs/reference/libtracker-control/meson.build |  1 +
 docs/reference/libtracker-miner/meson.build   |  1 +
 docs/reference/libtracker-sparql/meson.build  |  4 +++-
 docs/reference/meson.build                    | 12 ++++++++++++
 docs/reference/ontology/meson.build           | 14 ++------------
 docs/tools/ttl2sgml.c                         |  7 ++++++-
 docs/tools/ttl_sgml.c                         | 16 ++++++++++++----
 docs/tools/ttl_sgml.h                         |  3 ++-
 8 files changed, 39 insertions(+), 19 deletions(-)
---
diff --git a/docs/reference/libtracker-control/meson.build b/docs/reference/libtracker-control/meson.build
index 907e8231e..cb011d9b6 100644
--- a/docs/reference/libtracker-control/meson.build
+++ b/docs/reference/libtracker-control/meson.build
@@ -8,4 +8,5 @@ gnome.gtkdoc('libtracker-control',
     content_files: ['migrating-1to2.xml'],
     dependencies: tracker_control_dep,
     gobject_typesfile: 'libtracker-control.types',
+    fixxref_args: fixxref_args,
     install: true)
diff --git a/docs/reference/libtracker-miner/meson.build b/docs/reference/libtracker-miner/meson.build
index ff987b07a..5f748303f 100644
--- a/docs/reference/libtracker-miner/meson.build
+++ b/docs/reference/libtracker-miner/meson.build
@@ -8,4 +8,5 @@ gnome.gtkdoc('libtracker-miner',
     content_files: ['overview.sgml', 'migrating-1to2.xml'],
     dependencies: tracker_miner_dep,
     gobject_typesfile: 'libtracker-miner.types',
+    fixxref_args: fixxref_args,
     install: true)
diff --git a/docs/reference/libtracker-sparql/meson.build b/docs/reference/libtracker-sparql/meson.build
index ccf3d1d7e..68e9889dc 100644
--- a/docs/reference/libtracker-sparql/meson.build
+++ b/docs/reference/libtracker-sparql/meson.build
@@ -6,7 +6,8 @@ generated = custom_target('base-ontology-doc-generated',
     output: 'gen-doc.stamp',
     command: [ttl2sgml,
               '-d', join_paths(source_root, 'src/ontologies/'),
-              '-o', join_paths(meson.current_build_dir(), 'xml/')],
+              '-o', join_paths(meson.current_build_dir(), 'xml/'),
+              '-e', meson.current_source_dir()],
     depends: ttl2sgml,
     # FIXME: this shouldn't be necessary, but currently the 'dependencies'
     # parameter to gnome.gtkdoc() doesn't actually trigger building of custom
@@ -33,4 +34,5 @@ gnome.gtkdoc('libtracker-sparql',
     content_files: ['overview.sgml', 'examples.sgml', 'ontologies.sgml', 'private-store.xml', 
'migrating-1to2.xml', example_files],
     dependencies: tracker_sparql_dep,
     gobject_typesfile: 'libtracker-sparql.types',
+    fixxref_args: fixxref_args,
     install: true)
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index b87eb61ac..f6af841d4 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -1,3 +1,15 @@
+glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
+glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+
+docpath = join_paths(datadir, 'gtk-doc', 'html')
+
+fixxref_args = [
+    '--html-dir=@0@'.format(docpath),
+    '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
+    '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
+    '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
+]
+
 subdir('libtracker-control')
 subdir('libtracker-miner')
 subdir('libtracker-sparql')
diff --git a/docs/reference/ontology/meson.build b/docs/reference/ontology/meson.build
index 320b1bb0e..60ac90654 100644
--- a/docs/reference/ontology/meson.build
+++ b/docs/reference/ontology/meson.build
@@ -2,22 +2,12 @@ version_xml = configure_file(input: 'version.xml.in',
     output: 'version.xml',
     configuration: conf)
 
-
-#for f in `find $ONTOLOGIES_DATA_DIR -name "*.description"` ; do
-#    # ../../src/ontologies/XX-aaa.description -> PREFIX=aaa
-#    TMPNAME=${f%.description}
-#    PREFIX=${TMPNAME#*-}
-#    echo "- Generating $PREFIX documentation"
-#
-#    $TTL2SGML -d $f -o $BUILD_DIR/$PREFIX-ontology.xml \
-#        -e $ONTOLOGIES_INFO_DIR/$PREFIX/explanation.xml
-
-
 generated = custom_target('ontology-doc-generated',
     output: 'gen-doc.stamp',
     command: [ttl2sgml,
               '-d', join_paths(source_root, 'src/ontologies/nepomuk'),
-              '-o', join_paths(meson.current_build_dir(), 'xml/')],
+              '-o', join_paths(meson.current_build_dir(), 'xml/'),
+              '-e', meson.current_source_dir()],
     depends: ttl2sgml,
     # FIXME: this shouldn't be necessary, but currently the 'dependencies'
     # parameter to gnome.gtkdoc() doesn't actually trigger building of custom
diff --git a/docs/tools/ttl2sgml.c b/docs/tools/ttl2sgml.c
index cc0de0c62..433e44315 100644
--- a/docs/tools/ttl2sgml.c
+++ b/docs/tools/ttl2sgml.c
@@ -28,6 +28,7 @@
 
 static gchar *ontology_dir = NULL;
 static gchar *output_dir = NULL;
+static gchar *description_dir = NULL;
 
 static GOptionEntry   entries[] = {
        { "ontology-dir", 'd', 0, G_OPTION_ARG_FILENAME, &ontology_dir,
@@ -38,6 +39,10 @@ static GOptionEntry   entries[] = {
          "File to write the output (default stdout)",
          NULL
        },
+       { "description-dir", 'e', 0, G_OPTION_ARG_FILENAME, &description_dir,
+         "Directory to find ontology descriptions",
+         NULL
+       },
        { NULL }
 };
 
@@ -161,7 +166,7 @@ main (gint argc, gchar **argv)
                ttl_loader_load_ontology (file_ontology, ttl_file);
                ttl_loader_load_prefix_from_description (ontology, description);
 
-               ttl_sgml_print (description, file_ontology, ttl_output_file);
+               ttl_sgml_print (description, file_ontology, ttl_output_file, description_dir);
 
                ttl_loader_free_ontology (file_ontology);
                ttl_loader_free_description (description);
diff --git a/docs/tools/ttl_sgml.c b/docs/tools/ttl_sgml.c
index 317801e71..2c1063a29 100644
--- a/docs/tools/ttl_sgml.c
+++ b/docs/tools/ttl_sgml.c
@@ -146,10 +146,11 @@ print_ontology_class (Ontology      *ontology,
 void
 ttl_sgml_print (OntologyDescription *description,
                 Ontology            *ontology,
-                GFile               *file)
+                GFile               *file,
+                const gchar         *description_dir)
 {
        GHashTableIter iter;
-       gchar *upper_name, *path;
+       gchar *upper_name, *path, *introduction, *basename;
        OntologyClass *def;
        FILE *f;
 
@@ -160,8 +161,14 @@ ttl_sgml_print (OntologyDescription *description,
         upper_name = g_ascii_strup (description->localPrefix, -1);
        print_sgml_header (f, description);
 
-       g_fprintf (f, "<xi:include href='../%s-introduction.xml'><xi:fallback/></xi:include>",
-                  description->localPrefix);
+       basename = g_strdup_printf ("%s-introduction.xml", description->localPrefix);
+       introduction = g_build_filename (description_dir, basename, NULL);
+       g_free (basename);
+
+       if (g_file_test (introduction, G_FILE_TEST_EXISTS)) {
+               g_fprintf (f, "<xi:include href='%s'><xi:fallback/></xi:include>",
+                          introduction);
+       }
 
         g_fprintf (f, "<section id='%s-classes'>\n", description->localPrefix);
        g_fprintf (f, "<title>%s Ontology Classes</title>\n", upper_name);
@@ -175,5 +182,6 @@ ttl_sgml_print (OntologyDescription *description,
        print_sgml_footer (f);
 
        g_free (upper_name);
+       g_free (introduction);
        fclose (f);
 }
diff --git a/docs/tools/ttl_sgml.h b/docs/tools/ttl_sgml.h
index ece602ee8..6558d6929 100644
--- a/docs/tools/ttl_sgml.h
+++ b/docs/tools/ttl_sgml.h
@@ -28,7 +28,8 @@ G_BEGIN_DECLS
 
 void ttl_sgml_print (OntologyDescription *description,
                      Ontology            *ontology,
-                     GFile               *file);
+                     GFile               *file,
+                     const gchar         *description_dir);
 
 G_END_DECLS
 


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