Skip to content

Commit 7c45625

Browse files
committed
xref wip
1 parent fb4292b commit 7c45625

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

print/xrefs/list_targets.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import os
5+
6+
7+
def vol_of_chapter(ch: int) -> int:
8+
return (ch-1) // 8 + 1
9+
10+
11+
def main(adoc_names):
12+
for adoc_name in sorted(adoc_names):
13+
ch = int(os.path.basename(adoc_name)[3:5])
14+
with open(adoc_name) as adoc:
15+
lines = adoc.readlines()
16+
for line in lines:
17+
if line.startswith('[['):
18+
ch_id = line.strip()[2:-2]
19+
print(vol_of_chapter(ch), ch, ch_id, sep='\t')
20+
break
21+
22+
if __name__ == '__main__':
23+
main(sys.argv[1:])

0 commit comments

Comments
 (0)