Re: [RFC Patch v3 2/3] doc: add target rst2man to build man pages using rst2man
authorTomi Ollila <tomi.ollila@iki.fi>
Sun, 23 Feb 2014 17:42:21 +0000 (19:42 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:00:13 +0000 (10:00 -0800)
a9/47d810901e573343ef7cc3895331ef9e6a542b [new file with mode: 0644]

diff --git a/a9/47d810901e573343ef7cc3895331ef9e6a542b b/a9/47d810901e573343ef7cc3895331ef9e6a542b
new file mode 100644 (file)
index 0000000..bf03f8f
--- /dev/null
@@ -0,0 +1,165 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A023A431FD6\r
+       for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 09:42:35 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id gGLd9q-yLrb6 for <notmuch@notmuchmail.org>;\r
+       Sun, 23 Feb 2014 09:42:28 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 11EC0431FCF\r
+       for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 09:42:28 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id 04119100064;\r
+       Sun, 23 Feb 2014 19:42:21 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [RFC Patch v3 2/3] doc: add target rst2man to build man pages\r
+       using rst2man\r
+In-Reply-To: <1393114575-8756-3-git-send-email-david@tethera.net>\r
+References: <87fvo7btu8.fsf@qmul.ac.uk>\r
+       <1393114575-8756-1-git-send-email-david@tethera.net>\r
+       <1393114575-8756-3-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.17+94~g1b90823 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 23 Feb 2014 19:42:21 +0200\r
+Message-ID: <m24n3pu3nm.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 23 Feb 2014 17:42:35 -0000\r
+\r
+On Sun, Feb 23 2014, David Bremner <david@tethera.net> wrote:\r
+\r
+> Many people have docutils installed, but not sphinx. Allow these\r
+> people to build the man pages.\r
+\r
++1 from me to start having manuals in reStructuredText format and\r
+then converting these to the target formats. Some comments on\r
+the patch series below:\r
+\r
+Building any docs using this is not yet activated ?\r
+\r
+Anyway, I tried to build manual pages using 'make man' and got this:\r
+\r
+  $ make man\r
+  sphinx-build -b man -d doc/_build/doctrees -q -c doc doc doc/_build/man\r
+  Making output directory...\r
+\r
+  Sphinx error:\r
+  Builder name man not registered\r
+\r
+No fallback to use rst2man...\r
+\r
+\r
+Comments regarding prerst2man.py inline below:\r
+\r
+Tomi\r
+\r
+> ---\r
+\r
+// stuff deleted //\r
+\r
+> diff --git a/doc/rst2man/prerst2man.py b/doc/rst2man/prerst2man.py\r
+> new file mode 100644\r
+> index 0000000..797dd20\r
+> --- /dev/null\r
+> +++ b/doc/rst2man/prerst2man.py\r
+> @@ -0,0 +1,53 @@\r
+> +from sys import argv\r
+> +from datetime import date\r
+> +import re\r
+> +\r
+> +sourcedir=argv[1]\r
+> +outdir=argv[2]\r
+\r
+Style! run pep8 prerst2html.py and fix the issues it prints\r
+to the screen, like ' = ' above and remove trailing semicolon\r
+below... (and also pep8(1) doc/conf.py.\r
\r
+> +\r
+> +execfile(sourcedir+"/conf.py");\r
+> +\r
+> +\r
+> +\r
+> +\r
+> +def header(file,startdocname, command, description, authors, section):\r
+> +    file.write("""\r
+> +{:s}\r
+> +{:s}\r
+> +{:s}\r
+> +\r
+> +:Date:   {:s}\r
+> +:Version: {:s}\r
+> +:Manual section: {:d}\r
+> +:Manual group: {:s}\r
+\r
+For python < 2.7 these needs to be {0:s}, {1:s}, {2:s}.. {5:d}...\r
+\r
+> +\r
+> +""".format(\r
+> +'-' * len(description),\r
+> +description,\r
+> +'-' * len(description),\r
+> +date.today().isoformat(),release,section,project))\r
+\r
+Replace date.today.isoformat() with date determined from other\r
+sources (NEWS file?)\r
+\r
+> +\r
+> +blankre = re.compile("^\s*$")\r
+> +for page in man_pages:\r
+> +    outfile = open(outdir+"/"+page[0]+'.rst','w')\r
+> +    infile = open(sourcedir+"/"+page[0]+".rst",'r')\r
+\r
+In addition to formatting above, use either ".rst" or '.rst'\r
+(and perhaps other quotations in these 2 lines) for consistency.\r
+\r
+> +\r
+> +\r
+> +    # this is a crude hack. We look for the first blank line, and\r
+> +    # insert the rst2man header there.\r
+> +    #\r
+> +    # XXX consider really parsing input\r
+> +\r
+> +    count=0\r
+> +    lines = infile.readlines()\r
+> +    for line in lines:\r
+> +        outfile.write(line);\r
+> +        if (blankre.match(line)):\r
+> +            break\r
+> +        count = count + 1\r
+> +\r
+> +    del lines[0:count+1]\r
+\r
+pep8 will in the lime above (as it is not lines[0:count + 1])\r
+I might not have complained but... :D\r
+\r
+> +\r
+> +    header(outfile,*page)\r
+> +\r
+> +    outfile.write("".join(lines))\r
+> -- \r
+> 1.8.5.3\r