2017-01-27 02:58:45 +01:00
|
|
|
#!/bin/python
|
2019-12-18 14:08:01 +01:00
|
|
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
2017-01-27 02:58:45 +01:00
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# no processing of the first file
|
|
|
|
sys.stdout.write(open(sys.argv[1], 'r').read())
|
|
|
|
sys.stderr.write('joining %s\n' % sys.argv[1])
|
|
|
|
|
|
|
|
for name in sys.argv[2:]:
|
2018-06-12 11:43:13 +02:00
|
|
|
sys.stdout.write('\n')
|
|
|
|
sys.stderr.write('joining %s\n' % name)
|
|
|
|
f = open(name, 'r')
|
|
|
|
for l in f:
|
|
|
|
# strip out the table of contents from subsequent files
|
|
|
|
if '.. contents::' in l:
|
|
|
|
in_directive = True
|
|
|
|
continue
|
|
|
|
if ':Author:' in l:
|
|
|
|
continue
|
|
|
|
if ':Version:' in l:
|
|
|
|
continue
|
2017-01-27 02:58:45 +01:00
|
|
|
|
2018-06-12 11:43:13 +02:00
|
|
|
if l[0] in ' \t' and in_directive:
|
|
|
|
continue
|
|
|
|
in_directive = False
|
|
|
|
sys.stdout.write(l)
|