Changeset 59:5d9170b19285 in lemon-tutorial for scripts
- Timestamp:
- 04/08/10 09:20:19 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/titlegen.py
r42 r59 1 1 #! /usr/bin/env python 2 # 3 # This file is a part of LEMON, a generic C++ optimization library. 4 # 5 # Copyright (C) 2003-2010 6 # Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 # (Egervary Research Group on Combinatorial Optimization, EGRES). 8 # 9 # Permission to use, modify and distribute this software is granted 10 # provided that this copyright notice appears in all copies. For 11 # precise terms see the accompanying LICENSE file. 12 # 13 # This software is provided "AS IS" with no warranty of any kind, 14 # express or implied, and with no claim as to its suitability for any 15 # purpose. 16 # 2 17 3 18 import sys … … 41 56 toc={} 42 57 ind={} 58 page_files={} 59 ordered_pages = [] 60 61 for doxfile in os.listdir('.'): 62 if doxfile[-4:]=='.dox': 63 for l in open(doxfile).readlines(): 64 gr = re.match(r"(^[[]PAGE[]].*[[]PAGE[]])?(.*)$", l).groups() 65 if gr[0]: 66 page=gr[0][6:-6] 67 page_files[page]=doxfile 43 68 44 69 prev_page='' … … 57 82 ind[prev_page][2]=t_link 58 83 prev_page=t_link 84 ordered_pages.append(t_link) 59 85 toc[format_sec(t_sec)]=t_link 60 86 … … 96 122 fo.write(gr[4]+'\n') 97 123 fo.close() 124 125 fpdf=open(os.path.join("gen-pdf-dox","full.dox"),"w") 126 for doxfile in [page_files[p] for p in ordered_pages]: 127 page='' 128 for l in open(doxfile).readlines(): 129 gr = re.match(r"(^[[]PAGE[]].*[[]PAGE[]])?(^[[]SEC[]].*[[]SEC[]])?(^[[]TRAILER[]])?(^[[]TOC[]])?(.*)$", l).groups() 130 if gr[0]: 131 page=gr[0][6:-6] 132 fpdf.write("\page %s %s\n"%(page,gr[4])) 133 elif gr[1]: 134 sec=gr[1][5:-5] 135 fpdf.write("\section %s %s\n"%(sec,gr[4])) 136 elif gr[2]: 137 pass 138 elif gr[3]: 139 pass 140 else: 141 fpdf.write(gr[4]+'\n') 142 fpdf.close()
Note: See TracChangeset
for help on using the changeset viewer.