From 149b8a25328bf45333bbc9aa4ab5316fdd93e0bb Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 19 Aug 2021 00:50:15 +0200 Subject: docs: Generate keywords helper file for markdown documentation --- docs/tools/tracker-docgen-md.c | 49 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'docs/tools') 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, " \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, " \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); -- cgit v1.2.1