[tracker/wip/carlosg/hotdoc: 43/47] docs: Generate keywords helper file for markdown documentation
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/hotdoc: 43/47] docs: Generate keywords helper file for markdown documentation
- Date: Thu, 26 Aug 2021 12:06:34 +0000 (UTC)
commit 7eb862caf126b2a2eb1d999aeeaeb833c9acef60
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Aug 19 00:50:15 2021 +0200
docs: Generate keywords helper file for markdown documentation
.../reference/libtracker-sparql/install-devhelp.sh | 21 ++++++++++
docs/tools/tracker-docgen-md.c | 49 +++++++++++++++++++++-
2 files changed, 69 insertions(+), 1 deletion(-)
---
diff --git a/docs/reference/libtracker-sparql/install-devhelp.sh
b/docs/reference/libtracker-sparql/install-devhelp.sh
new file mode 100755
index 000000000..685ae99c2
--- /dev/null
+++ b/docs/reference/libtracker-sparql/install-devhelp.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+cd ${MESON_BUILD_ROOT}/docs/reference/libtracker-sparql/
+
+# Step 1. Build devhelp documentation (we let meson do this)
+# hotdoc run --conf-file tracker-doc.json --devhelp-activate
+
+# Step 2. Fix .devhelp2 file so it contains keywords from out ontologies
+cat *doc/devhelp/books/tracker/*.devhelp2 | sed "s/<\/functions>//" - | sed "s/<\/book>//" - >fixed.devhelp2
+
+for i in *-ontology.keywords
+do
+ cat $i >>fixed.devhelp2
+done
+
+echo -e " </functions>\n</book>" >>fixed.devhelp2
+mv fixed.devhelp2 *doc/devhelp/books/tracker/*.devhelp2
+
+# Step 3. Install all files
+mkdir -p ${MESON_INSTALL_PREFIX}/share/devhelp/books
+cp -a *doc/devhelp/books/tracker ${MESON_INSTALL_PREFIX}/share/devhelp/books/
diff --git a/docs/tools/tracker-docgen-md.c b/docs/tools/tracker-docgen-md.c
index 411d8c7f7..4d4d929fb 100644
--- a/docs/tools/tracker-docgen-md.c
+++ b/docs/tools/tracker-docgen-md.c
@@ -494,7 +494,52 @@ print_toc_extra_properties (FILE *f,
g_fprintf (f, "\n\n");
}
-/* Generate docbook markdown document for one ontology. */
+void
+generate_keywords (TrackerOntologyModel *model,
+ TrackerOntologyDescription *description,
+ GFile *output_location,
+ GList *classes,
+ GList *properties)
+{
+ gchar *path, *filename;
+ GFile *file;
+ GList *l;
+ FILE *f;
+
+ filename = g_strdup_printf ("%s-ontology.keywords", description->localPrefix);
+ file = g_file_get_child (output_location, filename);
+ g_free (filename);
+
+ path = g_file_get_path (file);
+ f = fopen (path, "w");
+ g_assert (f != NULL);
+ g_free (path);
+
+ for (l = classes; l != NULL; l = l->next) {
+ TrackerOntologyClass *klass;
+
+ klass = tracker_ontology_model_get_class (model, l->data);
+ g_fprintf (f, " <keyword type=\"rdf-class\" name=\"%s\" link=\"%s-ontology.html#%s\"/>\n",
+ klass->shortname,
+ description->localPrefix,
+ klass->shortname);
+ }
+
+ for (l = properties; l != NULL; l = l->next) {
+ TrackerOntologyProperty *prop;
+
+ prop = tracker_ontology_model_get_property (model, l->data);
+ g_fprintf (f, " <keyword type=\"rdf-property\" name=\"%s\" link=\"%s-ontology.html#%s\"/>\n",
+ prop->shortname,
+ description->localPrefix,
+ prop->shortname);
+ }
+
+ g_object_unref (file);
+ fclose (f);
+}
+
+/* Generate markdown document for one ontology. */
void
ttl_md_print (TrackerOntologyDescription *description,
TrackerOntologyModel *model,
@@ -574,6 +619,8 @@ ttl_md_print (TrackerOntologyDescription *description,
print_md_footer (f, description);
+ generate_keywords (model, description, output_location, classes, properties);
+
g_free (upper_name);
g_free (introduction);
g_object_unref (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]