-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostprocess.py
More file actions
22 lines (16 loc) · 747 Bytes
/
postprocess.py
File metadata and controls
22 lines (16 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import sys
from Filist import Filist
def main(name, filename, *argv):
# print the contents of the given file
ft = Filist(filename)
ft.sub_lines(r'<programlisting>plasTeXjava', r'<programlisting language="java">')
ft.sub_lines(r'plasTeXangle', r'<>')
# label the last chapters as appendices
i, match = ft.search_lines('<chapter id="tools">')
ft.sub_lines(r'<chapter', r'<appendix', start=i)
ft.sub_lines(r'</chapter', r'</appendix', start=i+1)
ft.sub_lines(r'<emphasis role="bold">feedback@greenteapress.com</emphasis>',
r'<phrase role="keep-together"><emphasis role="bold">feedback@greenteapress.com</emphasis></phrase>')
print ft
if __name__ == '__main__':
main(*sys.argv)