[tracker] Add support for textual verbose documenation in the ontology web pages
- From: Ivan Frade <ifrade src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] Add support for textual verbose documenation in the ontology web pages
- Date: Mon, 16 Nov 2009 11:08:16 +0000 (UTC)
commit 165dd5558edb1e194514b9f7aa41bbc079513cfc
Author: Ivan Frade <ivan frade nokia com>
Date: Sun Nov 15 18:42:32 2009 +0200
Add support for textual verbose documenation in the ontology web pages
utils/services/gen-doc.sh | 7 ++++++-
utils/services/ttl2html.c | 7 ++++++-
utils/services/ttl_html.c | 19 ++++++++++++++++++-
utils/services/ttl_html.h | 3 ++-
4 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/utils/services/gen-doc.sh b/utils/services/gen-doc.sh
index 3b566fb..c780589 100755
--- a/utils/services/gen-doc.sh
+++ b/utils/services/gen-doc.sh
@@ -34,7 +34,12 @@ for f in `find ../../data/ontologies -name "*.description"` ; do
PREFIX=${TMPNAME#*-}
echo "Generating $PREFIX"
mkdir -p $BUILD_DIR/$PREFIX
- ./ttl2html -d $f -o $BUILD_DIR/$PREFIX/index.html -l file-class.cache
+ # Copy before because we check in the code if the documentation exists
+ if [ -e ../../docs/ontologies/$PREFIX ]; then
+ cp -r ../../docs/ontologies/$PREFIX/* $BUILD_DIR/$PREFIX/ ;
+ fi
+ ./ttl2html -d $f -o $BUILD_DIR/$PREFIX/index.html -l file-class.cache \
+ -e ../../docs/ontologies/$PREFIX/explanation.html
done
echo "Copying resources"
diff --git a/utils/services/ttl2html.c b/utils/services/ttl2html.c
index 8e7591b..c8a30af 100644
--- a/utils/services/ttl2html.c
+++ b/utils/services/ttl2html.c
@@ -9,6 +9,7 @@
static gchar *desc_file = NULL;
static gchar *output_file = NULL;
static gchar *class_location_file = NULL;
+static gchar *explanation_file = NULL;
static GOptionEntry entries[] = {
{ "desc", 'd', 0, G_OPTION_ARG_FILENAME, &desc_file,
@@ -23,6 +24,10 @@ static GOptionEntry entries[] = {
"File with pairs: (prefix where the class is defined, class)",
NULL
},
+ { "explanation", 'e', 0, G_OPTION_ARG_FILENAME, &explanation_file,
+ "Verbosy explanation file in HTML format to include in the webpage",
+ NULL
+ },
{ NULL }
};
@@ -79,7 +84,7 @@ main (gint argc, gchar **argv)
g_free (ttl_file);
g_free (dirname);
- ttl_html_print (description, ontology, f, class_location_file);
+ ttl_html_print (description, ontology, f, class_location_file, explanation_file);
ttl_loader_free_ontology (ontology);
ttl_loader_free_description (description);
diff --git a/utils/services/ttl_html.c b/utils/services/ttl_html.c
index 86732ee..c7d4802 100644
--- a/utils/services/ttl_html.c
+++ b/utils/services/ttl_html.c
@@ -84,6 +84,21 @@ print_html_header (FILE *f, OntologyDescription *desc)
g_fprintf (f,"<hr />\n");
+}
+
+static void
+print_html_explanation (FILE *f, const gchar *explanation_file)
+{
+ gchar *raw_content;
+ gint length;
+
+ if (explanation_file && g_file_test (explanation_file, G_FILE_TEST_EXISTS)) {
+ if (!g_file_get_contents (explanation_file, &raw_content, &length, NULL)) {
+ g_error ("Unable to load '%s'", explanation_file );
+ }
+ g_fprintf (f, "%s", raw_content);
+ }
+ g_fprintf (f,"<hr />\n");
}
@@ -211,11 +226,13 @@ void
ttl_html_print (OntologyDescription *description,
Ontology *ontology,
FILE *f,
- const gchar *class_location_file)
+ const gchar *class_location_file,
+ const gchar *explanation_file)
{
qname_init (description->baseUrl, description->localPrefix, class_location_file);
print_html_header (f, description);
+ print_html_explanation (f, explanation_file);
g_fprintf (f,"<h2>Ontology Classes Descriptions</h2>");
g_hash_table_foreach (ontology->classes, print_ontology_class, f);
g_fprintf (f,"<h2>Ontology Properties Descriptions</h2>");
diff --git a/utils/services/ttl_html.h b/utils/services/ttl_html.h
index 6c47f8b..b85463c 100644
--- a/utils/services/ttl_html.h
+++ b/utils/services/ttl_html.h
@@ -10,7 +10,8 @@ G_BEGIN_DECLS
void ttl_html_print (OntologyDescription *description,
Ontology *ontology,
FILE *output,
- const gchar *class_location);
+ const gchar *class_location,
+ const gchar *explanation_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]