[gnome-dictionary] Generate the gnome-dictionary man page



commit d21174cd63acc52be36a093186ff65f8c0deae3b
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Aug 23 11:05:51 2017 +0100

    Generate the gnome-dictionary man page
    
    Instead of shipping an outdated, unmaintained, man page, written using
    troff, let's ship something resembling accurate information, written in
    a format that doesn't make me want to stab my eyes *that* much.

 configure                 |    5 ++
 data/gnome-dictionary.1   |   65 ---------------------------
 data/gnome-dictionary.xml |  106 +++++++++++++++++++++++++++++++++++++++++++++
 data/meson.build          |   26 +++++++++++-
 meson_options.txt         |    1 +
 5 files changed, 137 insertions(+), 66 deletions(-)
---
diff --git a/configure b/configure
index 9aa41a1..6bccc87 100755
--- a/configure
+++ b/configure
@@ -56,6 +56,8 @@ sanitycheck() {
 sanitycheck MESON 'meson'
 sanitycheck NINJA 'ninja' 'ninja-build'
 
+build_man='-Dbuild_man=false'
+
 while (($# > 0)); do
     case "${1%%=*}" in
        --prefix) read_arg prefix "$@" || shift;;
@@ -68,6 +70,8 @@ while (($# > 0)); do
        --libdir) read_arg libdir "$@" || shift;;
        --mandir) read_arg mandir "$@" || shift;;
        --includedir) read_arg includedir "$@" || shift;;
+       --enable-man) build_man='-Dbuild_man=true';;
+       --disable-man) build_man='-Dbuild_man=false';;
        *) echo -e "\e[1;33mINFO\e[0m: Ignoring unknown option '$1'";;
     esac
     shift
@@ -124,6 +128,7 @@ exec ${MESON} \
        --includedir=${includedir} \
        --mandir=${mandir} \
        --default-library shared \
+       ${build_man} \
        ${srcdir}
 
 # vim: ai ts=8 noet sts=2 ft=sh
diff --git a/data/gnome-dictionary.xml b/data/gnome-dictionary.xml
new file mode 100644
index 0000000..cbc784a
--- /dev/null
+++ b/data/gnome-dictionary.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"; [
+]>
+<refentry id="gnome-dictionary">
+
+<refentryinfo>
+  <title>gnome-dictionary</title>
+  <productname>GNOME</productname>
+  <authorgroup>
+    <author>
+      <contrib>Author</contrib>
+      <firstname>Emmanuele</firstname>
+      <surname>Bassi</surname>
+      <affiliation>
+        <orgname class="nonprofit">GNOME Project</orgname>
+      </affiliation>
+    </author>
+  </authorgroup>
+  <copyright>
+    <year>2012</year>
+    <holder>Emmanuele Bassi</holder>
+  </copyright>
+</refentryinfo>
+
+<refmeta>
+  <refentrytitle>gnome-dictionary</refentrytitle>
+  <manvolnum>1</manvolnum>
+  <refmiscinfo class="manual">User Commands</refmiscinfo>
+</refmeta>
+
+<refnamediv>
+  <refname>gnome-dictionary</refname>
+  <refpurpose>Look up words in online dictionaries</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<cmdsynopsis>
+<command>gnome-dictionary</command>
+<group>
+  <arg choice="opt">--look-up <arg choice="plain"><replaceable>WORD</replaceable></arg></arg>
+  <arg choice="opt">--match <arg choice="plain"><replaceable>WORD</replaceable></arg></arg>
+</group>
+<arg choice="opt">--source <arg choice="plain"><replaceable>NAME</replaceable></arg></arg>
+<arg choice="opt">--database <arg choice="plain"><replaceable>NAME</replaceable></arg></arg>
+<arg choice="opt">--strategy <arg choice="plain"><replaceable>NAME</replaceable></arg></arg>
+<arg choice="opt">--help</arg>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>
+  <command>gnome-dictionary</command> looks up words in online dictionaries
+  using the DICT protocol.
+</para>
+</refsect1>
+
+<refsect1><title>Options</title>
+<variablelist>
+  <varlistentry>
+    <term>--look-up <replaceable>WORD</replaceable></term>
+    <listitem><para>
+      Looks up the specified <replaceable>WORD</replaceable> using the default
+      dictionary source, or the one specified with the <option>--source</option>
+      command line option.
+    </para></listitem>
+  </varlistentry>
+
+  <varlistentry>
+    <term>--match <replaceable>WORD</replaceable></term>
+    <listitem><para>
+      List all the entries in the dictionary source that match the specified
+      <replaceable>WORD</replaceable>.
+    </para></listitem>
+  </varlistentry>
+
+  <varlistentry>
+    <term>--source=<replaceable>NAME</replaceable></term>
+    <term>-s <replaceable>NAME</replaceable></term>
+    <listitem><para>
+      Specifies the dictionary source to be used for looking up or matching
+      words.
+    </para></listitem>
+  </varlistentry>
+
+  <varlistentry>
+    <term>--database=<replaceable>NAME</replaceable></term>
+    <term>-D <replaceable>NAME</replaceable></term>
+    <listitem><para>
+      Specifies the database in the dictionary source to be used for looking
+      up or matching words.
+    </para></listitem>
+  </varlistentry>
+
+  <varlistentry>
+    <term>--strategy=<replaceable>NAME</replaceable></term>
+    <term>-S <replaceable>NAME</replaceable></term>
+    <listitem><para>
+      Specifies the matching strategy in the dictionary source to be used for
+      looking up or matching words.
+    </para></listitem>
+  </varlistentry>
+</variablelist>
+</refsect1>
+
+</refentry>
diff --git a/data/meson.build b/data/meson.build
index 5bb10b4..0c6ff7a 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -57,4 +57,28 @@ foreach s: sources
                   type: 'desktop')
 endforeach
 
-install_man([ 'gnome-dictionary.1' ], install_dir: join_paths(gdict_mandir, 'man1'))
+xsltproc = find_program('xsltproc', required: false)
+
+if get_option('build_man') and xsltproc.found()
+  xlstproc_flags = [
+    '--nonet',
+    '--stringparam', 'man.output.quietly', '1',
+    '--stringparam', 'funcsynopsis.style', 'ansi',
+    '--stringparam', 'man.th.extra1.suppress', '1',
+    '--stringparam', 'man.authors.section.enabled', '1',
+    '--stringparam', 'man.copyright.section.enabled', '1',
+  ]
+
+  custom_target('man pages',
+                input: 'gnome-dictionary.xml',
+                output: 'gnome-dictionary.1',
+                command: [
+                  xsltproc,
+                  xlstproc_flags,
+                  '-o', '@OUTPUT@',
+                  'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+                  '@INPUT@',
+                ],
+                install: true,
+                install_dir: join_paths(gdict_mandir, 'man1'))
+endif
diff --git a/meson_options.txt b/meson_options.txt
index da0615b..4c1b206 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1 +1,2 @@
 option('use_ipv6', type: 'boolean', value: true, description: 'Enable IPv6 support')
+option('build_man', type: 'boolean', value: true, description: 'Generate man page (requires xsltproc)')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]