Mercurial > dottes
annotate abcfield.py @ 287:c67d4b451714
Add timing and chords to Springvals.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Fri, 05 Jul 2013 20:10:14 +0100 |
parents | 295ba8275ab4 |
children | eedf65564226 |
rev | line source |
---|---|
110
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
2 # |
122
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
110
diff
changeset
|
3 # Extact a text field (title, by default) from a .abc file, and print it out |
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
110
diff
changeset
|
4 # formatted for use in LaTeX or HTML. |
110
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
5 # |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
6 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
7 import optparse |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
8 import sys |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
9 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
10 accentedletters = { |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
11 # Acute accents |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
12 "'A" : ("Á", "\\'{A}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
13 "'E" : ("É", "\\'{E}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
14 "'I" : ("Í", "\\'{I}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
15 "'O" : ("Ó", "\\'{O}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
16 "'U" : ("Ú", "\\'{U}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
17 "'Y" : ("Ý", "\\'{Y}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
18 "'a" : ("á", "\\'{a}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
19 "'e" : ("é", "\\'{e}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
20 "'i" : ("í", "\\'{i}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
21 "'o" : ("ó", "\\'{o}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
22 "'u" : ("ú", "\\'{u}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
23 "'y" : ("ý", "\\'{y}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
24 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
25 # Grave accents |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
26 "`A" : ("À", "\\`{A}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
27 "`E" : ("È", "\\`{E}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
28 "`I" : ("Ì", "\\`{I}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
29 "`O" : ("Ò", "\\`{O}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
30 "`U" : ("Ù", "\\`{U}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
31 "`a" : ("à", "\\`{a}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
32 "`e" : ("è", "\\`{e}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
33 "`i" : ("ì", "\\`{i}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
34 "`o" : ("ò", "\\`{o}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
35 "`u" : ("ù", "\\`{u}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
36 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
37 # Umlauts |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
38 "\"A" : ("Ä", "\\\"{A}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
39 "\"E" : ("Ë", "\\\"{E}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
40 "\"I" : ("Ï", "\\\"{I}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
41 "\"O" : ("Ö", "\\\"{O}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
42 "\"U" : ("Ü", "\\\"{U}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
43 "\"Y" : ("Ÿ", "\\\"{Y}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
44 "\"a" : ("ä", "\\\"{a}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
45 "\"e" : ("ë", "\\\"{e}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
46 "\"i" : ("ï", "\\\"{\i}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
47 "\"o" : ("ö", "\\\"{o}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
48 "\"u" : ("ü", "\\\"{u}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
49 "\"y" : ("ÿ", "\\\"{y}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
50 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
51 # Circumflexes |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
52 "^A" : ("Â", "\\^{A}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
53 "^E" : ("Ê", "\\^{E}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
54 "^I" : ("Î", "\\^{I}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
55 "^O" : ("Ô", "\\^{O}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
56 "^U" : ("Û", "\\^{U}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
57 "^a" : ("â", "\\^{a}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
58 "^e" : ("ê", "\\^{e}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
59 "^i" : ("î", "\\^{\i}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
60 "^o" : ("ô", "\\^{o}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
61 "^u" : ("û", "\\^{u}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
62 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
63 # Tilde |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
64 "~A" : ("Ã", "\\~{A}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
65 "~N" : ("Ñ", "\\~{N}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
66 "~O" : ("Õ", "\\~{O}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
67 "~a" : ("ã", "\\~{a}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
68 "~n" : ("ñ", "\\~{n}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
69 "~o" : ("õ", "\\~{o}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
70 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
71 # Cedilla |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
72 ",C" : ("Ç", "\\c{C}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
73 ",c" : ("ç", "\\c{c}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
74 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
75 # Slash |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
76 "/O" : ("Ø", "\\O"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
77 "/o" : ("ø", "\\o"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
78 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
79 # Ring |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
80 "AA" : ("Å", "\\r{A}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
81 "aa" : ("å", "\\r{a}"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
82 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
83 # Ligatures |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
84 "AE" : ("Æ", "\\AE"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
85 "ae" : ("æ", "\\ae"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
86 "ss" : ("ß", "\\ss"), |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
87 } |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
88 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
89 def convertTitle(t, options): |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
90 res = "" |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
91 while True: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
92 p = t.partition('\\') |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
93 res += p[0] |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
94 if p[1] == "": |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
95 break |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
96 abc = p[2][0:2] |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
97 t = p[2][2:] |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
98 if (options.html or options.latex) and abc in accentedletters: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
99 if options.html: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
100 res += accentedletters[abc][0] |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
101 else: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
102 res += accentedletters[abc][1] |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
103 else: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
104 res += "\\" + abc |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
105 return res |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
106 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
107 def process(inf, options): |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
108 for line in inf: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
109 line = line.strip() |
122
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
110
diff
changeset
|
110 if len(line) > 2 and line[0] == options.field and line[1] == ':': |
110
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
111 print(convertTitle(line[2:].strip(), options)) |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
112 break |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
113 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
114 parser = optparse.OptionParser(usage="usage: %prog [options] [filename]\n\n" |
122
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
110
diff
changeset
|
115 " Extract field data from ABC file.") |
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
110
diff
changeset
|
116 parser.add_option("-f", "--field", dest="field", default="T", |
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
110
diff
changeset
|
117 help="extract the field FIELD", metavar="FIELD") |
110
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
118 parser.add_option("-m", "--html", dest="html", |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
119 action="store_true", default=False, |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
120 help="format output for HTML") |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
121 parser.add_option("-l", "--latex", dest="latex", |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
122 action="store_true", default=False, |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
123 help="format ouput for LaTeX") |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
124 (options, args) = parser.parse_args() |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
125 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
126 if options.html and options.latex: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
127 sys.exit("You must choose one of HTML or LaTeX output") |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
128 |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
129 if len(args) > 0: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
130 for arg in args: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
131 try: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
132 inf = open(arg, "r") |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
133 process(inf, options) |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
134 finally: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
135 inf.close() |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
136 else: |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
137 process(sys.stdin, options) |
a63e39fc3410
Add basic diacritic handling for LaTeX and web.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
138 sys.exit(0) |