unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [RFC PATCH 2/4] doc: use hawkmoth for generating libnotmuch api documentation
Date: Sun, 20 Aug 2017 22:30:37 +0300	[thread overview]
Message-ID: <fd9df93658098faf08a1a418f85db36b7e84d43e.1503256651.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1503256651.git.jani@nikula.org>
In-Reply-To: <cover.1503256651.git.jani@nikula.org>

Hawkmoth [1] is a minimalistic Sphinx C Domain autodoc directive
extension to incorporate formatted C source code comments into Sphinx
based documentation, by yours truly.

This adds libnotmuch(3) man page to incorporate API documentation
using the extension. The naming is intentional to not conflict with
the Doxygen based man page, for now.

Hawkmoth has a few advantages over Doxygen. It directly integrates
with Sphinx, and allows reStructuredText syntax in the documentation
comments. It's simple and minimal, without the overlap of Doxygen and
Sphinx.

Of course, there are some disadvantages as well. Hawkmoth is a project
very much in the larval stage. It's not even packaged yet. It
undoubtedly has plenty of unexpected issues and bugs. It only has one
contributor to fix them. It only targets C documentation.

Hawkmoth C parsing is based on Clang Python Bindings, but then Doxygen
also depends on Clang.

On Debian, the minimum dependencies are:

 * python-clang-3.8
 * libclang-3.8-dev
 * libclang1-3.8

Unfortunately python-clang seems to be for Python 2 only, so you'll
need to use Python 2 based Sphinx as well. (To be investigated.)

As can be seen from the size of this patch, the simplicity of Hawkmoth
makes it a compelling alternative for Sphinx based C API
documentation.

[1] https://github.com/jnikula/hawkmoth
---
 doc/conf.py             | 14 ++++++++++++++
 doc/index.rst           |  1 +
 doc/man3/libnotmuch.rst | 20 ++++++++++++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 doc/man3/libnotmuch.rst

diff --git a/doc/conf.py b/doc/conf.py
index 0e65413d917a..4b25cfd4dbf2 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -4,6 +4,9 @@
 import sys
 import os
 
+# FIXME: Use PYTHONPATH=$PYTHONPATH:/path/to/hawkmoth or this:
+#sys.path.insert(0, os.path.abspath('/path/to/hawkmoth'))
+
 # The suffix of source filenames.
 source_suffix = '.rst'
 
@@ -32,6 +35,9 @@ exclude_patterns = ['_build']
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
 
+# Extensions
+extensions = ['cautodoc']
+
 # -- Options for HTML output ----------------------------------------------
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
@@ -126,6 +132,10 @@ man_pages = [
     ('man1/notmuch-tag', 'notmuch-tag',
      u'add/remove tags for all messages matching the search terms',
      [notmuch_authors], 1),
+
+    ('man3/libnotmuch', 'libnotmuch',
+     u'notmuch library API',
+     [notmuch_authors], 3),
 ]
 
 # If true, show URL addresses after external links.
@@ -156,3 +166,7 @@ texinfo_documents += [
         x[2],				# description
         'Miscellaneous'			# category
     ) for x in man_pages]
+
+# cautodoc options
+cautodoc_root = os.path.abspath('..')
+cautodoc_compat = 'javadoc-liberal'
diff --git a/doc/index.rst b/doc/index.rst
index aa6c9f40462c..bbf0c6873b76 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -25,6 +25,7 @@ Contents:
    man7/notmuch-search-terms
    man1/notmuch-show
    man1/notmuch-tag
+   man3/libnotmuch
 
 Indices and tables
 ==================
diff --git a/doc/man3/libnotmuch.rst b/doc/man3/libnotmuch.rst
new file mode 100644
index 000000000000..0c583ccd00b9
--- /dev/null
+++ b/doc/man3/libnotmuch.rst
@@ -0,0 +1,20 @@
+==========
+libnotmuch
+==========
+
+SYNOPSIS
+========
+
+::
+
+   #include <notmuch.h>
+
+NOTMUCH API
+===========
+
+.. c:autodoc:: lib/notmuch.h
+
+SEE ALSO
+========
+
+**notmuch(1)**
-- 
2.11.0

  parent reply	other threads:[~2017-08-20 19:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-20 19:30 [RFC PATCH 0/4] doc: use Hawkmoth for API documentation Jani Nikula
2017-08-20 19:30 ` [RFC PATCH 1/4] doc: add man section 3 handling Jani Nikula
2017-08-20 19:30 ` Jani Nikula [this message]
2017-08-20 19:30 ` [RFC PATCH 3/4] lib: fix the biggest hawkmoth offenders in notmuch.h Jani Nikula
2017-08-20 19:30 ` [RFC PATCH 4/4] lib: add reStructuredText bling for API documentation " Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd9df93658098faf08a1a418f85db36b7e84d43e.1503256651.git.jani@nikula.org \
    --to=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).