Changeset 42:6df2bf124af4 in lemontutorial
 Timestamp:
 02/22/10 00:40:36 (8 years ago)
 Branch:
 default
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

scripts/titlegen.py
r26 r42 5 5 import copy 6 6 import re 7 8 max_sec_number=100 9 max_sec_depth=4 7 10 8 11 def sec_inc(section, lev): … … 19 22 s=s[:1] 20 23 return s 24 25 def compare_sec(id1, id2): 26 id1=id1.split('.') 27 c1=0 28 for s in id1: 29 c1=c1*max_sec_number+int(s) 30 for i in range(len(id1), max_sec_depth+1): 31 c1*=max_sec_number 32 id2=id2.split('.') 33 c2=0 34 for s in id2: 35 c2=c2*max_sec_number+int(s) 36 for i in range(len(id2), max_sec_depth+1): 37 c2*=max_sec_number 38 return c1c2 21 39 22 40 section = []; … … 70 88 (prev_str,next_str)) 71 89 elif gr[3]: 72 secs = [ x for x in toc ]73 secs.sort( )90 secs = [ x for x in toc ] 91 secs.sort(compare_sec) 74 92 for num in secs: 75 93 fo.write("%s  \\ref %s\n"%(' '*((len(ind[toc[num]][0]))),
Note: See TracChangeset
for help on using the changeset viewer.