[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sectioning script
From: |
Graham Percival |
Subject: |
sectioning script |
Date: |
Sat, 15 Sep 2007 17:39:55 -0700 |
User-agent: |
Icedove 1.5.0.12 (X11/20070607) |
Hi John,
Given the debacle with my attempt to help the sectioning, I'll leave
everything else to you. I still feel bad about leaving so much, so I
wrote this python script for doing the
@node
@subsection
->
@anchor{}
@unnumberedsubsec
replacement
It works fine on basic-notation and advanced-notation.
instrument-notation needs a bit of manual work, because Ancient and
Vocal have subsubsections. In regards to GDP, do whatever it takes to
make those files compile; when we get to them, they'll be rewritten to
avoid anything deeper than @subsections.
AFAIK, this script should work similarly well on the translations, but
I'm not going to tempt fate by trying it myself. :)
#!/usr/bin/python
import os
import sys
import re
try:
infile = sys.argv[1]
except:
print "Specify file"
sys.exit()
filelines = open(infile, 'r').readlines()
for i in range( len(filelines) ):
one = filelines[i]
if (one[0:5] == '@node'):
two = filelines[i+1]
if (two[0:11] == '@subsection'):
filelines[i] = filelines[i].replace('@node ',
'@anchor{')
filelines[i] = filelines[i].replace('\n', '}\n')
filelines[i+1] =
filelines[i+1].replace('@subsection', '@unnumberedsubsubsec')
file = open(infile,'w')
for line in filelines:
# print line,
file.write( line )
file.close()
- sectioning script,
Graham Percival <=