COIN-OR::LEMON - Graph Library

Changeset 59:5d9170b19285 in lemon-tutorial for scripts


Ignore:
Timestamp:
04/08/10 09:20:19 (15 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Support of the PDF version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/titlegen.py

    r42 r59  
    11#! /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#
    217
    318import sys
     
    4156toc={}
    4257ind={}
     58page_files={}
     59ordered_pages = []
     60
     61for 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
    4368
    4469prev_page=''
     
    5782                ind[prev_page][2]=t_link
    5883            prev_page=t_link
     84            ordered_pages.append(t_link)
    5985        toc[format_sec(t_sec)]=t_link
    6086
     
    96122                fo.write(gr[4]+'\n')
    97123        fo.close()
     124
     125fpdf=open(os.path.join("gen-pdf-dox","full.dox"),"w")
     126for 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')
     142fpdf.close()
Note: See TracChangeset for help on using the changeset viewer.