[pacman-contrib] [PATCH 1/3] Initial setup for docs

Johannes Löthberg johannes at kyriasis.com
Sat Oct 15 11:16:55 UTC 2016


Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
---
 Makefile.am               |  5 +++-
 configure.ac              | 27 ++++++++++++++++--
 doc/asciidoc-override.css |  7 +++++
 doc/asciidoc.conf         | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 doc/footer.txt            | 21 ++++++++++++++
 5 files changed, 129 insertions(+), 3 deletions(-)
 create mode 100644 doc/asciidoc-override.css
 create mode 100644 doc/asciidoc.conf
 create mode 100644 doc/footer.txt

diff --git a/Makefile.am b/Makefile.am
index 43b934a..ca86231 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,8 @@
 SUBDIRS = src lib
+if WANT_DOC
+SUBDIRS += doc
+endif
 
 DIST_SUBDIRS = $(SUBDIRS)
 
-DISTCHECK_CONFIGURE_FLAGS = --disable-git-version
+DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
diff --git a/configure.ac b/configure.ac
index 0c973f6..fb6f9c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,11 @@ AC_ARG_WITH(vim-dir,
 	[AS_HELP_STRING([--with-vim-dir=PATH], [set the location of the vim runtime file directory])],
 	[vim_dir=$withval], [vim_dir=$pkgdatadir/vim])
 
+# Help line for documentation
+AC_ARG_ENABLE(doc,
+	AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
+	[wantdoc=$enableval], [wantdoc=yes])
+
 # Help line for debug
 AC_ARG_ENABLE(debug,
 	AS_HELP_STRING([--enable-debug], [enable debugging support]),
@@ -87,6 +92,23 @@ AC_DEFINE_UNQUOTED([vim_dir], "$vim_dir", [The location of the vim runtime file
 SIZECMD="stat -c %s"
 AC_SUBST(SIZECMD)
 
+# Check for documentation support and status
+AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
+AC_MSG_CHECKING([for building documentation])
+if test "x$wantdoc" = "xyes" ; then
+	if test $ASCIIDOC ; then
+		AC_MSG_RESULT([yes, enabled by configure])
+	else
+		asciidoc="(warning : asciidoc not installed)"
+		AC_MSG_RESULT([yes $asciidoc])
+	fi
+	wantdoc=yes
+else
+	AC_MSG_RESULT([no, disabled by configure])
+	wantdoc=no
+fi
+AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")
+
 # Enable or disable debug code
 if test "x$debug" = "xyes" ; then
 	AC_MSG_RESULT(yes)
@@ -135,9 +157,10 @@ else
 fi
 
 AC_CONFIG_FILES([
-	Makefile
-	src/Makefile
 	lib/Makefile
+	src/Makefile
+	doc/Makefile
+	Makefile
 ])
 AC_OUTPUT
 
diff --git a/doc/asciidoc-override.css b/doc/asciidoc-override.css
new file mode 100644
index 0000000..328c8fc
--- /dev/null
+++ b/doc/asciidoc-override.css
@@ -0,0 +1,7 @@
+table th, table td {
+	padding: 0.2em 1em;
+}
+
+table td p.table {
+	margin: 0;
+}
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
new file mode 100644
index 0000000..68ab5b8
--- /dev/null
+++ b/doc/asciidoc.conf
@@ -0,0 +1,72 @@
+## linkman: macro
+# Inspired by/borrowed from the GIT source tree at Documentation/asciidoc.conf
+#
+# Usage: linkman:command[manpage-section]
+#
+# Note, {0} is the manpage section, while {target} is the command.
+#
+# Show man link as: <command>(<section>); if section is defined, else just show
+# the command.
+
+[macros]
+(?su)[\\]?(?P<name>linkman):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
+
+[attributes]
+asterisk=*
+plus=+
+caret=^
+startsb=[
+endsb=]
+backslash=\
+tilde=~
+apostrophe='
+backtick=`
+litdd=--
+
+ifdef::backend-docbook[]
+[linkman-inlinemacro]
+{0%{target}}
+{0#<citerefentry>}
+{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
+{0#</citerefentry>}
+endif::backend-docbook[]
+
+ifdef::backend-docbook[]
+ifndef::docbook-xsl-172[]
+# "unbreak" docbook-xsl v1.68 for manpages. v1.69 works with or without this.
+# v1.72 breaks with this because it replaces dots not in roff requests.
+[listingblock]
+<example><title>{title}</title>
+<literallayout>
+|
+</literallayout>
+{title#}</example>
+endif::docbook-xsl-172[]
+endif::backend-docbook[]
+
+ifdef::doctype-manpage[]
+ifdef::backend-docbook[]
+[header]
+template::[header-declarations]
+<refentry>
+<refentryinfo>
+<date>{pacman_contrib_version}</date>
+</refentryinfo>
+<refmeta>
+<refentrytitle>{mantitle}</refentrytitle>
+<manvolnum>{manvolnum}</manvolnum>
+<refmiscinfo class="source">Pacman-contrib</refmiscinfo>
+<refmiscinfo class="version">{pacman_contrib_version}</refmiscinfo>
+<refmiscinfo class="manual">Pacman-contrib Manual</refmiscinfo>
+</refmeta>
+<refnamediv>
+  <refname>{manname}</refname>
+  <refpurpose>{manpurpose}</refpurpose>
+</refnamediv>
+endif::backend-docbook[]
+endif::doctype-manpage[]
+
+ifdef::backend-xhtml11[]
+[linkman-inlinemacro]
+<a href="{target}.{0}.html">{target}{0?({0})}</a>
+endif::backend-xhtml11[]
diff --git a/doc/footer.txt b/doc/footer.txt
new file mode 100644
index 0000000..1388dfa
--- /dev/null
+++ b/doc/footer.txt
@@ -0,0 +1,21 @@
+/////
+vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
+/////
+
+Bugs
+----
+Bugs? You must be kidding; there are no bugs in this software. But if we
+happen to be wrong, send us an email with as much detail as possible to
+mailto:pacman-contrib at lists.archlinux.org[].
+
+
+Authors
+-------
+
+Current maintainers:
+
+* Johannes Löthberg <johannes at kyriasis.com>
+* Daniel M. Capella <polyzen at archlinux.info>
+
+For additional contributors, use `git shortlog -s` on the pacman-contrib.git
+repository.
-- 
2.10.0


More information about the pacman-contrib mailing list