[libvirt] [PATCH 4/7] docs: generate API reference pages for admin, qemu & lxc libraries

Daniel P. Berrangé berrange at redhat.com
Wed Nov 20 15:28:45 UTC 2019


Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 docs/Makefile.am  | 44 +++++++++++++++++++++++++++++++++++++++++++-
 docs/docs.html.in |  4 ++++
 docs/newapi.xsl   | 13 +++++++------
 3 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/docs/Makefile.am b/docs/Makefile.am
index a360b546d6..db9470ae07 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -35,6 +35,10 @@ modules = \
 	virterror \
 	$(NULL)
 
+modules_admin = libvirt-admin
+modules_qemu = libvirt-qemu
+modules_lxc = libvirt-lxc
+
 apihtml = \
   html/index.html \
   $(apihtml_generated)
@@ -43,6 +47,30 @@ apihtml_generated = \
 	$(addprefix html/libvirt-,$(addsuffix .html,$(modules))) \
 	$(NULL)
 
+apiadminhtml = \
+  html/index-admin.html \
+  $(apiadminhtml_generated)
+
+apiadminhtml_generated = \
+	$(addprefix html/libvirt-,$(addsuffix .html,$(modules_admin))) \
+	$(NULL)
+
+apiqemuhtml = \
+  html/index-qemu.html \
+  $(apiqemuhtml_generated)
+
+apiqemuhtml_generated = \
+	$(addprefix html/libvirt-,$(addsuffix .html,$(modules_qemu))) \
+	$(NULL)
+
+apilxchtml = \
+  html/index-lxc.html \
+  $(apilxchtml_generated)
+
+apilxchtml_generated = \
+	$(addprefix html/libvirt-,$(addsuffix .html,$(modules_lxc))) \
+	$(NULL)
+
 apipng = \
   html/left.png \
   html/up.png \
@@ -50,7 +78,7 @@ apipng = \
   html/right.png
 
 apirefdir = $(HTML_DIR)/html
-apiref_DATA = $(apihtml) $(apipng)
+apiref_DATA = $(apihtml) $(apiadminhtml) $(apiqemuhtml) $(apilxchtml) $(apipng)
 
 css = \
   generic.css \
@@ -188,6 +216,9 @@ aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \
 CLEANFILES = \
   $(dot_html) \
   $(apihtml) \
+  $(apiadminhtml) \
+  $(apiqemuhtml) \
+  $(apilxchtml) \
   $(internals_html) \
   $(kbase_html) \
   $(api_DATA) \
@@ -252,6 +283,9 @@ EXTRA_DIST += \
 	  || { rm $@ && exit 1; }
 
 $(apihtml_generated): html/index.html
+$(apiadminhtml_generated): html/index-admin.html
+$(apiqemuhtml_generated): html/index-qemu.html
+$(apilxchtml_generated): html/index-lxc.html
 
 html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
 	$(AM_V_GEN)$(XSLTPROC) --nonet -o ./ \
@@ -260,6 +294,14 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
 	  $(srcdir)/newapi.xsl libvirt-api.xml && \
 	  $(XMLLINT) --nonet --noout html/*.html
 
+html/index-%.html: libvirt-%-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
+	$(AM_V_GEN)$(XSLTPROC) --nonet -o ./ \
+	  --stringparam builddir '$(abs_top_builddir)' \
+	  --stringparam timestamp $(timestamp) \
+	  --stringparam indexfile $(@:html/%=%) \
+	  $(srcdir)/newapi.xsl $< && \
+	  $(XMLLINT) --nonet --noout html/*.html
+
 python_generated_files = \
 		html/libvirt-libvirt-lxc.html \
 		html/libvirt-libvirt-qemu.html \
diff --git a/docs/docs.html.in b/docs/docs.html.in
index 6cf09f51bc..268c16f3b3 100644
--- a/docs/docs.html.in
+++ b/docs/docs.html.in
@@ -106,6 +106,10 @@
           <a href="html/libvirt-libvirt-secret.html">secret</a>,
           <a href="html/libvirt-libvirt-storage.html">storage</a>,
           <a href="html/libvirt-libvirt-stream.html">stream</a>
+          and
+          <a href="html/index-admin.html">admin</a>,
+          <a href="html/index-qemu.html">QEMU</a>,
+          <a href="html/index-lxc.html">LXC</a> libs
         </dd>
 
         <dt><a href="drivers.html">Drivers</a></dt>
diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index ca8c703d5c..dd6169397b 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -23,6 +23,7 @@
   <xsl:key name="symbols" match="/api/symbols/*" use="@name"/>
 
   <xsl:param name="builddir" select="'..'"/>
+  <xsl:param name="indexfile" select="'index.html'"/>
 
   <!-- the target directory for the HTML output -->
   <xsl:variable name="htmldir">html</xsl:variable>
@@ -101,10 +102,10 @@
           <td><a accesskey="p" href="libvirt-{$previous/@name}.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></img></a></td>
 	  <th align="left"><a href="libvirt-{$previous/@name}.html"><xsl:value-of select="$previous/@name"/></a></th>
 	</xsl:if>
-        <td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td>
-	<th align="left"><a href="index.html">API documentation</a></th>
-        <td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td>
-        <th align="center"><a href="../index.html">The virtualization API</a></th>
+        <td><a accesskey="u" href="{$indexfile}"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td>
+	<th align="left"><a href="{$indexfile}">API documentation</a></th>
+        <td><a accesskey="h" href="../{$indexfile}"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td>
+        <th align="center"><a href="../{$indexfile}">The virtualization API</a></th>
         <xsl:if test="$next">
 	  <th align="right"><a href="libvirt-{$next/@name}.html"><xsl:value-of select="$next/@name"/></a></th>
           <td><a accesskey="n" href="libvirt-{$next/@name}.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></img></a></td>
@@ -830,12 +831,12 @@
       <xsl:call-template name="mainpage"/>
     </xsl:variable>
     <xsl:document
-      href="{concat($htmldir, '/index.html')}"
+      href="{concat($htmldir, '/', $indexfile)}"
       method="xml"
       indent="yes"
       encoding="UTF-8">
       <xsl:apply-templates select="exsl:node-set($mainpage)" mode="page">
-        <xsl:with-param name="pagename" select="concat($htmldir, '/index.html')"/>
+        <xsl:with-param name="pagename" select="concat($htmldir, '', $indexfile)"/>
         <xsl:with-param name="timestamp" select="$timestamp"/>
       </xsl:apply-templates>
     </xsl:document>
-- 
2.23.0




More information about the libvir-list mailing list