-
Notifications
You must be signed in to change notification settings - Fork 3
/
fixindex.py
36 lines (31 loc) · 1.04 KB
/
fixindex.py
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
import sys
try:
from indextools import processfile
except ImportError:
from langsci.indextools import processfile
if __name__ == "__main__":
"""
Transform a file main._dx into mainmod._dx, where the underscore represents an index type given in the argument.
Index types are:
a: author index
s: subject index
l: language index
Examples:
> python3 fixindex.py
fixes the author index only. Read: main.adx. Write: mainmod.adx
> python3 fixindex.py a
fixes the author index only. Read: main.adx. Write: mainmod.adx
> python3 fixindex.py l
fixes the language index only. Read: main.ldx. Write: mainmod.ldx
> python3 fixindex.py lsa
fixes all three index types. Read: main.adx, main.ldx, main.sdx. Write: mainmod.adx, mainmod.ldx, mainmod.sdx
"""
indextypes = "a"
basename = "main"
try:
indextypes = sys.argv[1]
basename = sys.argv[2]
except IndexError:
pass
for indextype in indextypes:
processfile("%s.%sdx" % (basename, indextype) )