1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 463CE431FC3
\r
6 for <notmuch@notmuchmail.org>; Tue, 28 Jan 2014 08:13:11 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id sb75CNUeLKah for <notmuch@notmuchmail.org>;
\r
16 Tue, 28 Jan 2014 08:13:09 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id B0B9E431FC0
\r
21 for <notmuch@notmuchmail.org>; Tue, 28 Jan 2014 08:13:07 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tethera.net>)
\r
24 id 1W8BHf-00036J-8U; Tue, 28 Jan 2014 12:13:07 -0400
\r
25 Received: (nullmailer pid 15969 invoked by uid 1000); Tue, 28 Jan 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [RFC Patch v2 2/2] doc: add target rst2man to build man pages using
\r
31 Date: Tue, 28 Jan 2014 12:12:38 -0400
\r
32 Message-Id: <1390925558-15873-3-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 1.8.5.2
\r
34 In-Reply-To: <1390925558-15873-1-git-send-email-david@tethera.net>
\r
35 References: <87vbxfkdex.fsf@zancas.localnet>
\r
36 <1390925558-15873-1-git-send-email-david@tethera.net>
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Tue, 28 Jan 2014 16:13:11 -0000
\r
51 Many people have docutils installed, but not sphinx. Allow these
\r
52 people to build the man pages.
\r
55 doc/rst2man/Makefile | 5 +++++
\r
56 doc/rst2man/Makefile.local | 28 ++++++++++++++++++++++++++++
\r
57 doc/rst2man/prerst2man.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++
\r
58 4 files changed, 80 insertions(+), 1 deletion(-)
\r
59 create mode 100644 doc/rst2man/Makefile
\r
60 create mode 100644 doc/rst2man/Makefile.local
\r
61 create mode 100644 doc/rst2man/prerst2man.py
\r
63 diff --git a/Makefile b/Makefile
\r
64 index 39f0e62..3c7f0be 100644
\r
67 @@ -5,7 +5,7 @@ all:
\r
68 # List all subdirectories here. Each contains its own Makefile.local.
\r
69 # Use of '=', without '+=', seems to be required for out-of-tree
\r
71 -subdirs = compat completion doc emacs lib man parse-time-string performance-test util test
\r
72 +subdirs = compat completion doc doc/rst2man emacs lib man parse-time-string performance-test util test
\r
74 # We make all targets depend on the Makefiles themselves.
\r
75 global_deps = Makefile Makefile.config Makefile.local \
\r
76 diff --git a/doc/rst2man/Makefile b/doc/rst2man/Makefile
\r
77 new file mode 100644
\r
78 index 0000000..0a0815d
\r
80 +++ b/doc/rst2man/Makefile
\r
83 + $(MAKE) -C ../.. all
\r
86 + $(MAKE) -C ../.. $@
\r
87 diff --git a/doc/rst2man/Makefile.local b/doc/rst2man/Makefile.local
\r
88 new file mode 100644
\r
89 index 0000000..5bb3e43
\r
91 +++ b/doc/rst2man/Makefile.local
\r
96 +prerst2man := python $(dir)/prerst2man.py $(dir)/.. $(dir)
\r
98 +MANSRC := $(dir)/notmuch.1 $(dir)/notmuch-search.1 $(dir)/notmuch-search-terms.7
\r
106 +# preprocessed source files suitable for rst2man
\r
107 +RST2MANSRC := $(dir)/notmuch.rst $(dir)/notmuch-search.rst $(dir)/notmuch-search-terms.rst
\r
109 +# actual source files
\r
111 +RSTSRC := $(patsubst ${dir}/%,$(dir)/../%,${RST2MANSRC})
\r
113 +RSTMANSRC := $(patsubst %.rst,%.1,${RST2MANSRC})
\r
115 +rst2man: ${MANSRC}
\r
117 +${RST2MANSRC}: ${RSTSRC}
\r
120 +CLEAN := ${CLEAN} ${RST2MANSRC} ${MANSRC}
\r
121 diff --git a/doc/rst2man/prerst2man.py b/doc/rst2man/prerst2man.py
\r
122 new file mode 100644
\r
123 index 0000000..4222f11
\r
125 +++ b/doc/rst2man/prerst2man.py
\r
127 +from sys import argv
\r
128 +from datetime import date
\r
134 +execfile(sourcedir+"/conf.py");
\r
136 +def header(file,startdocname, command, description, authors, section):
\r
138 +---------------------------------------------
\r
140 +---------------------------------------------
\r
144 +:Manual section: {:d}
\r
145 +:Manual group: {:s}
\r
147 +""".format(description,date.today().isoformat(),release,section,project))
\r
149 +blankre = re.compile("^\s*$")
\r
150 +for page in man_pages:
\r
151 + outfile = open(outdir+"/"+page[0]+'.rst','w')
\r
152 + infile = open(sourcedir+"/"+page[0]+".rst",'r')
\r
155 + # this is a crude hack. We look for the first blank line, and
\r
156 + # insert the rst2man header there.
\r
158 + # XXX consider really parsing input
\r
161 + lines = infile.readlines()
\r
162 + for line in lines:
\r
163 + outfile.write(line);
\r
164 + if (blankre.match(line)):
\r
166 + count = count + 1
\r
168 + del lines[0:count+1]
\r
170 + header(outfile,*page)
\r
172 + outfile.write("".join(lines))
\r