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