unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 4222f11b60f9a2384349ee416bf3276c1ad02616 1030 bytes (raw)
name: doc/rst2man/prerst2man.py 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
from sys import argv
from datetime import date
import re

sourcedir=argv[1]
outdir=argv[2]

execfile(sourcedir+"/conf.py");

def header(file,startdocname, command, description, authors, section):
    file.write("""
---------------------------------------------
{:s}
---------------------------------------------

:Date:   {:s}
:Version: {:s}
:Manual section: {:d}
:Manual group: {:s}

""".format(description,date.today().isoformat(),release,section,project))

blankre = re.compile("^\s*$")
for page in man_pages:
    outfile = open(outdir+"/"+page[0]+'.rst','w')
    infile = open(sourcedir+"/"+page[0]+".rst",'r')


    # 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]

    header(outfile,*page)

    outfile.write("".join(lines))

debug log:

solving 4222f11 ...
found 4222f11 in https://yhetil.org/notmuch/1390925558-15873-3-git-send-email-david@tethera.net/

applying [1/1] https://yhetil.org/notmuch/1390925558-15873-3-git-send-email-david@tethera.net/
diff --git a/doc/rst2man/prerst2man.py b/doc/rst2man/prerst2man.py
new file mode 100644
index 0000000..4222f11

Checking patch doc/rst2man/prerst2man.py...
Applied patch doc/rst2man/prerst2man.py cleanly.

index at:
100644 4222f11b60f9a2384349ee416bf3276c1ad02616	doc/rst2man/prerst2man.py

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).