docs: generate settings-spec.xml from libnm-util/nm-setting-docs.xml
authorDan Winship <danw@gnome.org>
Fri, 13 Jun 2014 15:08:56 +0000 (11:08 -0400)
committerDan Winship <danw@gnome.org>
Thu, 19 Jun 2014 21:45:02 +0000 (17:45 -0400)
Generate docs/api/settings-spec.xml via an XSLT stylesheet applied to
libnm-util/nm-setting-docs.xml.

.gitignore
docs/api/Makefile.am
docs/api/settings-spec.xsl [new file with mode: 0644]

index 8c9b09c..71b4f61 100644 (file)
@@ -115,7 +115,6 @@ valgrind-*.log
 /docs/libnm-util/version.xml
 
 /docs/api/version.xml
-/docs/api/generate-settings-spec
 /docs/api/settings-spec.html
 /docs/api/settings-spec.xml
 /docs/api/spec.html
index 3ca4603..219aff3 100644 (file)
@@ -20,9 +20,8 @@ spec.html: $(XMLS) $(OTHER_FILES) html-build.stamp
        mkdir -p $(builddir)/html/
        cp spec.html $(builddir)/html/
 
-settings-spec.xml: $(top_builddir)/tools/generate-settings-spec $(top_builddir)/libnm-util/libnm-util.la
-       rm -f $(builddir)/settings-spec.xml
-       $(top_builddir)/tools/generate-settings-spec book $(builddir)/settings-spec.xml
+settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml
+       $(AM_V_GEN) xsltproc --output $@ $^
 
 all: $(GENERATED_FILES)
 
@@ -47,6 +46,9 @@ MKDB_OPTIONS=--sgml-mode --output-format=xml
 # Extra options to supply to gtkdoc-mktmpl
 MKTMPL_OPTIONS=
 
+# Extra options to supply to gtkdoc-mkhtml
+MKHTML_OPTIONS=--path="$(abs_srcdir)"
+
 # Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE)
 content_files = \
        version.xml \
@@ -57,9 +59,10 @@ include $(top_srcdir)/gtk-doc.make
 
 ####################################
 
-EXTRA_DIST += version.xml.in $(GENERATED_FILES)
+EXTRA_DIST += version.xml.in settings-spec.xsl $(GENERATED_FILES)
 CLEANFILES += html/* tmpl/* xml/* \
        NetworkManager-sections.txt \
-       NetworkManager-overrides.txt \
-       $(GENERATED_FILES)
+       NetworkManager-overrides.txt
+
+DISTCLEANFILES = $(GENERATED_FILES)
 
diff --git a/docs/api/settings-spec.xsl b/docs/api/settings-spec.xsl
new file mode 100644 (file)
index 0000000..14163e2
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:output
+      method="xml"
+      doctype-public="-//OASIS//DTD DocBook XML V4.3//EN"
+      doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+      />
+
+  <xsl:template match="nm-setting-docs">
+    <section>
+      <title>Configuration Settings</title>
+      <xsl:apply-templates/>
+    </section>
+  </xsl:template>
+
+  <xsl:template match="setting">
+    <para>
+      <table>
+       <title><xsl:value-of select="@name"/> setting</title>
+       <tgroup cols="4">
+         <thead>
+           <row>
+              <entry>Key Name</entry>
+              <entry>Value Type</entry>
+              <entry>Default Value</entry>
+              <entry>Value Description</entry>
+           </row>
+         </thead>
+         <tbody>
+           <xsl:apply-templates/>
+         </tbody>
+       </tgroup>
+      </table>
+    </para>
+  </xsl:template>
+
+  <xsl:template match="property">
+    <xsl:variable name="setting_name" select="../@name"/>
+    <row>
+      <entry><screen><xsl:value-of select="@name"/></screen></entry>
+      <entry><screen><xsl:value-of select="@type"/></screen></entry>
+      <entry><screen><xsl:value-of select="@default"/></screen></entry>
+      <entry><xsl:value-of select="@description"/><xsl:if test="contains(@name,'-flags') and $setting_name != 'dcb'"> (see <xref linkend="secrets-flags"/> for flag values)</xsl:if></entry>
+    </row>
+  </xsl:template>
+
+</xsl:stylesheet>