changeset 37:7e44a0a8dc2c

Convert the manpage to DocBook V5.0
author Guido Berhoerster <gber@opensuse.org>
date Fri, 07 Feb 2014 18:10:41 +0100
parents 82a31628a26d
children db09b66c3853
files Makefile docbook-update-source-data.xsl pk-update-icon.1 pk-update-icon.1.xml
diffstat 4 files changed, 225 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Feb 07 18:10:41 2014 +0100
+++ b/Makefile	Fri Feb 07 18:10:41 2014 +0100
@@ -38,6 +38,23 @@
 MSGFMT :=	msgfmt
 INTLTOOL_UPDATE :=	intltool-update
 INTLTOOL_MERGE :=	intltool-merge
+XSLTPROC :=	xsltproc
+DOCBOOK5_MANPAGES_STYLESHEET =	http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
+
+define generate-manpage-rule =
+%.$(1): %.$(1).xml
+	$$(XSLTPROC) \
+	    --xinclude \
+	    --stringparam package $$(PACKAGE) \
+	    --stringparam version $$(VERSION)\
+	    docbook-update-source-data.xsl $$< | \
+	    $$(XSLTPROC) \
+	    --xinclude \
+	    $$(DOCBOOK5_MANPAGES_FLAGS) \
+	    --output $$@ \
+	    $$(DOCBOOK5_MANPAGES_STYLESHEET) \
+	    -
+endef
 
 DESTDIR ?=
 prefix ?=	/usr/local
@@ -49,6 +66,7 @@
 xdgautostartdir ?=	$(sysconfdir)/xdg/autostart
 
 OBJS =		main.o pkui-icon.o pkui-backend.o
+MANPAGES =	$(PACKAGE).1
 AUTOSTART_FILE =	$(PACKAGE).desktop
 MOFILES :=	$(patsubst %.po,%.mo,$(wildcard po/*.po))
 POTFILE =	po/$(PACKAGE).pot
@@ -59,12 +77,14 @@
 		-DVERSION=\"$(VERSION)\" \
 		-DLOCALEDIR="\"$(localedir)\""
 LDLIBS :=	$(shell pkg-config --libs gtk+-2.0 unique-1.0 libnotify packagekit-glib2)
+DOCBOOK5_MANPAGES_FLAGS =	--stringparam man.authors.section.enabled 0 \
+				--stringparam man.copyright.section.enabled 0
 
 .DEFAULT_TARGET = all
 
 .PHONY: all clean clobber dist install
 
-all: $(PACKAGE) $(MOFILES) $(AUTOSTART_FILE)
+all: $(PACKAGE) $(MANPAGES) $(MOFILES) $(AUTOSTART_FILE)
 
 $(PACKAGE): $(OBJS)
 	$(LINK.o) $^ $(LDLIBS) -o $@
@@ -84,6 +104,8 @@
 	$(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
 	$(COMPILE.c) -o $@ $<
 
+$(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
+
 %.desktop: %.desktop.in $(MOFILES)
 	$(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
 
@@ -102,7 +124,7 @@
 			$(DESTDIR)$(mandir)/man1/$(PACKAGE).1
 
 clean:
-	rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE)
+	rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE)
 
 clobber: clean
 	rm -f $(patsubst %.o,%.d,$(OBJS))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docbook-update-source-data.xsl	Fri Feb 07 18:10:41 2014 +0100
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:db="http://docbook.org/ns/docbook"
+  xmlns="http://docbook.org/ns/docbook"
+  exclude-result-prefixes="xsl db">
+
+  <xsl:param name="package" select="''" />
+  <xsl:param name="version" select="''" />
+
+  <xsl:template match="db:refmeta/db:refmiscinfo[@class = 'source' or
+    @class = 'version']"/>
+
+  <xsl:template match="db:refmeta">
+    <xsl:copy>
+      <xsl:apply-templates/>
+      <refmiscinfo class="source"><xsl:value-of select="$package"/></refmiscinfo>
+      <refmiscinfo class="version"><xsl:value-of select="$version"/></refmiscinfo>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>
--- a/pk-update-icon.1	Fri Feb 07 18:10:41 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-.\" Copyright (C) 2011 Guido Berhoerster <gber@opensuse.org>
-.\"
-.\" Licensed under the GNU General Public License Version 2
-.\"
-.\" This program is free software; you can redistribute it and/or modify
-.\" it under the terms of the GNU General Public License as published by
-.\" the Free Software Foundation; either version 2 of the License, or
-.\" (at your option) any later version.
-.\"
-.\" This program is distributed in the hope that it will be useful,
-.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
-.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-.\" GNU General Public License for more details.
-.\"
-.\" You should have received a copy of the GNU General Public License
-.\" along with this program; if not, write to the Free Software
-.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.TH PK\-UPDATE\-ICON 1 "20 Oct 2011"
-.SH NAME
-pk\-update\-icon \- display notifications about software updates
-.SH SYNOPSIS
-\fBpk\-update\-icon\fR
-[\fB\-hv?\fR]
-[\fB\-d\fR \fIdelay\fR | \fB\-\-delay\fR=\fIdelay\fR]
-[\fB\-i\fR \fIinterval\fR | \fB\-\-interval\fR=\fIinterval\fR]
-.SH DESCRIPTION
-\fBpk\-update\-icon\fR displays notifications and an icon in the tray area of
-the panel when package updates are available.
-.SH OPTIONS
-The following options are supported:
-.TP
-.BR \-d ", " \-\-delay =\fIdelay\fR
-Set the delay in seconds before the first check for updates.
-.TP
-.BR \-h ", " \-? ", " \-\-help
-Print a summary of all command line options and exit.
-.TP
-.BR \-i ", " \-\-interval =\fIinterval\fR
-Set the interval in seconds between checks for updates.
-.TP
-.BR \-v ", " \-\-version
-Print the version number and exit.
-.SH EXIT STATUS
-.TP
-.B 0
-The program has exited normally.
-.TP
-.B >0
-An Error has occurred.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pk-update-icon.1.xml	Fri Feb 07 18:10:41 2014 +0100
@@ -0,0 +1,172 @@
+<?xml version="1.0"?>
+<!--
+
+Copyright (C) 2014 Guido Berhoerster <gber@opensuse.org>
+
+Licensed under the GNU General Public License Version 2
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+-->
+<refentry xmlns="http://docbook.org/ns/docbook" xml:lang="en">
+  <info>
+    <author>
+      <personname>
+        <firstname>Guido</firstname>
+        <surname>Berhoerster</surname>
+      </personname>
+      <email>gber@opensuse.org</email>
+      <personblurb/>
+    </author>
+    <date>7 February, 2014</date>
+  </info>
+  <refmeta>
+    <refentrytitle>pk-update-icon</refentrytitle>
+    <manvolnum>1</manvolnum>
+    <refmiscinfo class="source"/>
+    <refmiscinfo class="version"/>
+    <refmiscinfo class="manual">User Commands</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>pk-update-icon</refname>
+    <refpurpose>display notifications about software updates</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>pk-update-icon</command>
+      <group>
+        <arg choice="plain">
+          <option>-h</option>
+        </arg>
+        <arg choice="plain">
+          <option>-?</option>
+        </arg>
+        <arg choice="plain">
+          <option>--help</option>
+        </arg>
+      </group>
+      <group>
+        <arg choice="plain">
+          <option>-v</option>
+        </arg>
+        <arg choice="plain">
+          <option>--version</option>
+        </arg>
+      </group>
+      <group>
+        <arg choice="plain">
+          <option>-d</option>
+          <replaceable>delay</replaceable>
+        </arg>
+        <arg choice="plain">
+          <option>--delay</option>
+          <replaceable>delay</replaceable>
+        </arg>
+      </group>
+      <group >
+        <arg choice="plain">
+          <option>-i</option>
+          <replaceable>interval</replaceable>
+        </arg>
+        <arg choice="plain">
+          <option>--interval</option>
+          <replaceable>interval</replaceable>
+        </arg>
+      </group>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>Description</title>
+    <para><command>pk-update-icon</command> displays  notifications  and an
+    icon in the tray area of the panel when package updates are
+    available.</para>
+  </refsect1>
+  <refsect1>
+    <title>Options</title>
+    <para>The following options are supported:</para>
+    <variablelist>
+      <varlistentry>
+        <term>
+          <option>-d</option>
+          <replaceable>delay</replaceable>
+        </term>
+        <term>
+          <option>--delay</option>
+          <replaceable>delay</replaceable>
+        </term>
+        <listitem>
+          <para>Set the delay in seconds before the first check for
+          updates.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          <option>-h</option>
+        </term>
+        <term>
+          <option>-?</option>
+        </term>
+        <term>
+          <option>--help</option>
+        </term>
+        <listitem>
+          <para>Print a summary of all command line options and exit.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          <option>-i</option>
+          <replaceable>interval</replaceable>
+        </term>
+        <term>
+          <option>--interval</option>
+          <replaceable>interval</replaceable>
+        </term>
+        <listitem>
+          <para>Set the interval in seconds between checks for updates.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          <option>-v</option>
+        </term>
+        <term>
+          <option>--version</option>
+        </term>
+        <listitem>
+          <para>Print the version number and exit.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1>
+    <title>Exit Status</title>
+    <para>The following exit values are returned:</para>
+    <variablelist>
+      <varlistentry>
+        <term>0</term>
+        <listitem>
+          <para>Command successfully executed.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>&gt; 0</term>
+        <listitem>
+          <para>An error has occured.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+</refentry>