TOC and section numbering are generated from toc.txt
authorAlpar Juttner <alpar@cs.elte.hu>
Thu, 30 Oct 2008 17:13:33 +0000
changeset 1055e2f7712e87
parent 9 a48bf0d3a790
child 12 d64ffbd7d8c6
TOC and section numbering are generated from toc.txt
.hgignore
Doxyfile
Makefile
getting_started.dox
install.dox
intro.dox
license.dox
mainpage.dox
titlegen.py
toc.txt
     1.1 --- a/.hgignore	Tue Oct 28 18:54:30 2008 +0100
     1.2 +++ b/.hgignore	Thu Oct 30 17:13:33 2008 +0000
     1.3 @@ -15,3 +15,4 @@
     1.4  (.*/)?\#[^/]*\#$
     1.5  ^html/.*
     1.6  ^gen-images/.*
     1.7 +^gen-dox/.*
     2.1 --- a/Doxyfile	Tue Oct 28 18:54:30 2008 +0100
     2.2 +++ b/Doxyfile	Thu Oct 30 17:13:33 2008 +0000
     2.3 @@ -70,7 +70,7 @@
     2.4  SHOW_FILES             = NO
     2.5  SHOW_NAMESPACES        = NO
     2.6  FILE_VERSION_FILTER    = 
     2.7 -LAYOUT_FILE            = DoxygenLayout.xml
     2.8 +LAYOUT_FILE            = ./DoxygenLayout.xml
     2.9  #---------------------------------------------------------------------------
    2.10  # configuration options related to warning and progress messages
    2.11  #---------------------------------------------------------------------------
    2.12 @@ -84,7 +84,7 @@
    2.13  #---------------------------------------------------------------------------
    2.14  # configuration options related to the input files
    2.15  #---------------------------------------------------------------------------
    2.16 -INPUT                  = . \
    2.17 +INPUT                  = ./gen-dox \
    2.18                           ./demo
    2.19  INPUT_ENCODING         = UTF-8
    2.20  FILE_PATTERNS          = *.h \
     3.1 --- a/Makefile	Tue Oct 28 18:54:30 2008 +0100
     3.2 +++ b/Makefile	Thu Oct 30 17:13:33 2008 +0000
     3.3 @@ -15,6 +15,8 @@
     3.4  	$(GS_COMMAND) -sDEVICE=pngalpha -r18 -sOutputFile=$@ $<
     3.5  
     3.6  html: $(PNG_IMAGES)
     3.7 +	-mkdir gen-dox
     3.8 +	./titlegen.py
     3.9  	doxygen Doxyfile
    3.10  
    3.11  clean:
     4.1 --- a/getting_started.dox	Tue Oct 28 18:54:30 2008 +0100
     4.2 +++ b/getting_started.dox	Thu Oct 30 17:13:33 2008 +0000
     4.3 @@ -17,7 +17,7 @@
     4.4   */
     4.5  
     4.6  /**
     4.7 -\page hello_lemon Compile Your First Code
     4.8 +[PAGE]hello_lemon[PAGE] Compile Your First Code
     4.9  
    4.10  If you have installed LEMON on your system you can paste the following
    4.11  code segment into a file called <tt>hello_lemon.cc</tt> to have a first
    4.12 @@ -52,7 +52,7 @@
    4.13  
    4.14  Now let us compile this simple example program.
    4.15  
    4.16 -\section hello_lemon_system If LEMON is Installed System-Wide
    4.17 +[SEC]hello_lemon_system[SEC] If LEMON is Installed System-Wide
    4.18  
    4.19  If LEMON is installed system-wide (into directory \c /usr/local),
    4.20  then it is very easy to compile this program with the
    4.21 @@ -70,7 +70,7 @@
    4.22  ./hello_lemon
    4.23  \endverbatim
    4.24  
    4.25 -\section hello_lemon_user If LEMON is Installed User-Local
    4.26 +[SEC]hello_lemon_user[SEC] If LEMON is Installed User-Local
    4.27  
    4.28  Compiling the code is a bit more difficult if you installed LEMON
    4.29  user-local into a directory (e.g. <tt>~/lemon</tt>) or if you just
    4.30 @@ -114,4 +114,5 @@
    4.31  do not hesitate to
    4.32  <a href="mailto:lemon-user@lemon.cs.elte.hu"><b>contact us</b></a>.
    4.33  
    4.34 +[TRAILER]
    4.35  */
     5.1 --- a/install.dox	Tue Oct 28 18:54:30 2008 +0100
     5.2 +++ b/install.dox	Thu Oct 30 17:13:33 2008 +0000
     5.3 @@ -17,7 +17,7 @@
     5.4   */
     5.5  
     5.6  /**
     5.7 -\page install Installation Guide
     5.8 +[PAGE]install[PAGE] Installation Guide
     5.9  
    5.10  In this section we detail how to start using LEMON, from downloading it
    5.11  to your computer, through the steps of installation, to showing how to
    5.12 @@ -27,7 +27,7 @@
    5.13  difficulties do not hesitate to
    5.14  <a href="mailto:lemon-user@lemon.cs.elte.hu"><b>ask</b></a>.
    5.15  
    5.16 -\section requirements_lemon Hardware and Software Requirements
    5.17 +[SEC]requirements_lemon[SEC] Hardware and Software Requirements
    5.18  
    5.19  In LEMON we use C++ templates heavily, thus compilation takes a
    5.20  considerable amount of time and memory. So some decent box would be
    5.21 @@ -46,14 +46,14 @@
    5.22  However keep in mind that you have to make appropriate steps instead of
    5.23  the instructions detailed here to be able to use LEMON with your compiler.
    5.24  
    5.25 -\subsection requirements_lp LP Solver Requirements
    5.26 +[SEC]requirements_lp[SEC] LP Solver Requirements
    5.27  
    5.28  The LEMON LP solver interface can use the GLPK (GNU Linear Programming
    5.29  Kit), CPLEX and SoPlex solver. If you want to use it, you will need at
    5.30  least one of these.
    5.31  See the <b><tt>INSTALL</tt></b> file how to enable these at compile time.
    5.32  
    5.33 -\section install_from_source Install from Source
    5.34 +[SEC]install_from_source[SEC] Install from Source
    5.35  
    5.36  You can download LEMON from the web site:
    5.37  <a href="http://lemon.cs.elte.hu/">http://lemon.cs.elte.hu/</a>.
    5.38 @@ -141,7 +141,7 @@
    5.39  Several other configure flags can be passed to <tt>./configure</tt>.
    5.40  For more information see the <b><tt>INSTALL</tt></b> file.
    5.41  
    5.42 -\subsection install_hg Install the Latest Development Version
    5.43 +[SEC]install_hg[SEC] Install the Latest Development Version
    5.44  
    5.45  You can also use the latest (developer) version of LEMON from our Mercurial
    5.46  repository. You need a couple additional tool for that.
    5.47 @@ -186,21 +186,20 @@
    5.48  <tt><b>make install</b></tt>?
    5.49  
    5.50  
    5.51 -\section install_rpm Install from rpm
    5.52 +[SEC]install_rpm[SEC] Install from rpm
    5.53  
    5.54  \todo Write this section (\ref install_rpm).
    5.55  
    5.56 -
    5.57 -\section install_user Install Locally to the User
    5.58 +[SEC]install_user[SEC] Install Locally to the User
    5.59  
    5.60  \todo Write this section (\ref install_user).
    5.61  
    5.62  
    5.63 -\section compile_codes Compile Codes that Use LEMON
    5.64 +[SEC]compile_codes[SEC] Compile Codes that Use LEMON
    5.65  
    5.66  Now let us see how to use the library after installing it.
    5.67  
    5.68 -\subsection compile_system_wide If LEMON is Installed System-Wide
    5.69 +[SEC]compile_system_wide[SEC] If LEMON is Installed System-Wide
    5.70  
    5.71  If your installation of LEMON into directory \c /usr/local was
    5.72  successful, then you have to issue a command like this to compile a
    5.73 @@ -213,7 +212,7 @@
    5.74  The argument <tt>-lemon</tt> tells the compiler that we are using the
    5.75  installed library LEMON.
    5.76  
    5.77 -\subsection compile_user_local If LEMON is Installed User-Local
    5.78 +[SEC]compile_user_local[SEC] If LEMON is Installed User-Local
    5.79  
    5.80  You have to give more options to the compiler if LEMON is installed
    5.81  user-local into a directory (denoted by <tt><dir></tt>)
    5.82 @@ -225,8 +224,9 @@
    5.83  g++ -lemon -I <dir> -L <dir>/lemon/.libs [other options] <source file>
    5.84  \endverbatim
    5.85  
    5.86 -\subsubsection compile_use_pkg_config Use pkg-config
    5.87 +[SEC]compile_use_pkg_config[SEC] Use pkg-config
    5.88  
    5.89  \todo Write this sub-subsection (\ref compile_use_pkg_config).
    5.90  
    5.91 +[TRAILER]
    5.92  */
     6.1 --- a/intro.dox	Tue Oct 28 18:54:30 2008 +0100
     6.2 +++ b/intro.dox	Thu Oct 30 17:13:33 2008 +0000
     6.3 @@ -17,9 +17,9 @@
     6.4   */
     6.5  
     6.6  /**
     6.7 -\page intro Introduction
     6.8 +[PAGE]intro[PAGE] Introduction
     6.9  
    6.10 -\section intro_lemon What is LEMON
    6.11 +[SEC]intro_lemon[SEC] What is LEMON
    6.12  
    6.13  <b>LEMON</b> stands for <b>L</b>ibrary of <b>E</b>fficient <b>M</b>odels and
    6.14  <b>O</b>ptimization in <b>N</b>etworks. It is a C++ template
    6.15 @@ -42,7 +42,7 @@
    6.16  For more information visit the LEMON web site:
    6.17  <a href="http://lemon.cs.elte.hu/"><b>http://lemon.cs.elte.hu/</b></a>.
    6.18  
    6.19 -\section intro_tutorial LEMON Tutorial
    6.20 +[SEC]intro_tutorial[SEC] LEMON Tutorial
    6.21  
    6.22  This tutorial introduces the reader to the basic concepts and features of
    6.23  LEMON, and there are also some sections about advanced topics showing the
    6.24 @@ -52,4 +52,7 @@
    6.25  LEMON with the help of the detailed documentation (that can also be used
    6.26  as a reference manual).
    6.27  
    6.28 +
    6.29 +[TRAILER]
    6.30 +
    6.31  */
     7.1 --- a/license.dox	Tue Oct 28 18:54:30 2008 +0100
     7.2 +++ b/license.dox	Thu Oct 30 17:13:33 2008 +0000
     7.3 @@ -18,8 +18,9 @@
     7.4  
     7.5  /**
     7.6  
     7.7 -\page license License Terms
     7.8 +[PAGE]license[PAGE] License Terms
     7.9  
    7.10  \verbinclude ./LICENSE
    7.11  
    7.12 +[TRAILER]
    7.13  */
     8.1 --- a/mainpage.dox	Tue Oct 28 18:54:30 2008 +0100
     8.2 +++ b/mainpage.dox	Thu Oct 30 17:13:33 2008 +0000
     8.3 @@ -22,48 +22,7 @@
     8.4  
     8.5  \section toc Table of Contents
     8.6  
     8.7 - - \ref intro
     8.8 - - \ref basic_concepts "Basic Concepts"
     8.9 -   - \ref hello_lemon
    8.10 -   - \ref digraph_build "Build and Modify a Digraph"
    8.11 -   - \ref digraph_iterate "Iterate Over the Elements"
    8.12 -   - \ref standard_maps "Maps - Assign Data to Graphs"
    8.13 -   - \ref algorithms "Algorithms"
    8.14 -     - \ref alg_bfs_dfs "BFS, DFS - Graph Search"
    8.15 -     - \ref alg_dijkstra "Dijkstra - Shorthest Path"
    8.16 -     - \ref alg_kruskal "Kruskal - Minimum Spanning Tree"
    8.17 -   - \ref undir_graphs "Undirected Graphs"
    8.18 - - \ref tools "Some Important Auxiliary Tools"
    8.19 -   - \ref lgf "LEMON Graph Format"
    8.20 -     - \ref glemon "gLemon - A Graph Editor for LEMON"
    8.21 -   - \ref graph_to_eps "GraphToEps - Postscript Exporting"
    8.22 -   - \ref time_count "Time Measuring and Counting"
    8.23 -   - \ref random "Random Numbers"
    8.24 - - \ref advanced "Advanced Topics"
    8.25 -   - \ref maps "Maps"
    8.26 -     - \ref map_concepts "Read/Write/Reference Maps"
    8.27 -     - \ref custom_maps "Custom Maps"
    8.28 -     - \ref map_adaptors "Map Adaptors"
    8.29 -     - \ref special_maps "Other Special Purpose Maps"
    8.30 -   - \ref graphs "Graphs"
    8.31 -     - \ref graph_adaptors "Graph Adaptors"
    8.32 -     - \ref special_graphs "Special Graph Structures"
    8.33 -   - \ref named_params "Named Parameters"
    8.34 -     - \ref alg_named_params "Customizing Algorithms"
    8.35 - - \ref lp "LP and MIP Solvers"
    8.36 -   - \ref lp_examples "Simple Examples"
    8.37 -   - \ref lp_maxflow "Maximum Flow as LP Problem"
    8.38 - - \ref appendix "Appendix"
    8.39 -   - \ref install
    8.40 -     - \ref requirements_lemon
    8.41 -       - \ref requirements_lp
    8.42 -     - \ref install_from_source
    8.43 -       - \ref install_hg
    8.44 -     - \ref install_rpm
    8.45 -     - \ref install_user
    8.46 -     - \ref compile_codes
    8.47 -       - \ref compile_system_wide
    8.48 -       - \ref compile_user_local
    8.49 +[TOC]
    8.50  
    8.51  */
    8.52  }
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/titlegen.py	Thu Oct 30 17:13:33 2008 +0000
     9.3 @@ -0,0 +1,71 @@
     9.4 +#! /usr/bin/env python
     9.5 +
     9.6 +import sys
     9.7 +import os
     9.8 +import copy
     9.9 +import re
    9.10 +
    9.11 +def sec_inc(section, lev):
    9.12 +    while len(section)<lev:
    9.13 +        section.append(0)
    9.14 +    section[lev-1]+=1
    9.15 +    section=section[:lev]
    9.16 +    return section
    9.17 +
    9.18 +def format_sec(sec):
    9.19 +    s=""
    9.20 +    for i in sec:
    9.21 +        s+=str(i)+'.'
    9.22 +    return s
    9.23 +
    9.24 +section = [];
    9.25 +toc={}
    9.26 +ind={}
    9.27 +
    9.28 +prev_page=''
    9.29 +for l in open("toc.txt").readlines():
    9.30 +    sl = l.split()
    9.31 +    if len(sl)==2 and len(sl[0])>0: 
    9.32 +        lev=len(sl[0])
    9.33 +        section=sec_inc(section,lev)
    9.34 +        t_sec=copy.copy(section)
    9.35 +        t_link=sl[1];
    9.36 +        print format_sec(t_sec),t_link
    9.37 +        ind[t_link]=[t_sec,'','']
    9.38 +        if lev==1:
    9.39 +            ind[t_link][1]=prev_page
    9.40 +            if prev_page:
    9.41 +                ind[prev_page][2]=t_link
    9.42 +            prev_page=t_link
    9.43 +        toc[format_sec(t_sec)]=t_link
    9.44 +
    9.45 +for doxfile in os.listdir('.'):
    9.46 +    if doxfile[-4:]=='.dox':
    9.47 +        print 'Generate ',doxfile
    9.48 +        page=''
    9.49 +        fo=open(os.path.join("gen-dox",doxfile),"w")
    9.50 +        for l in open(doxfile).readlines():
    9.51 +            gr = re.match(r"(^[[]PAGE[]].*[[]PAGE[]])?(^[[]SEC[]].*[[]SEC[]])?(^[[]TRAILER[]])?(^[[]TOC[]])?(.*)$", l).groups()
    9.52 +            if gr[0]:
    9.53 +                page=gr[0][6:-6]
    9.54 +                fo.write("\page %s %s%s\n"%(page,
    9.55 +                                            format_sec(ind[page][0]),gr[4]))
    9.56 +            elif gr[1]:
    9.57 +                sec=gr[1][5:-5]
    9.58 +                fo.write("\section %s %s%s\n"%(sec,
    9.59 +                                               format_sec(ind[sec][0]),gr[4]))
    9.60 +            elif gr[2]:
    9.61 +                prev_page=ind[page][1]
    9.62 +                prev_str= ( '\\ref '+prev_page ) if prev_page else ''
    9.63 +                next_page=ind[page][2]
    9.64 +                next_str= ( '\\ref '+next_page ) if next_page else ''
    9.65 +                fo.write('<< %s | \\ref toc "Home" | %s >>\n'%\
    9.66 +                             (prev_str,next_str))
    9.67 +            elif gr[3]:
    9.68 +                secs = [ x for x in toc]
    9.69 +                secs.sort()
    9.70 +                for num in secs:
    9.71 +                    fo.write("%s - \\ref %s\n"%(' '*(len(num)-2),toc[num]))
    9.72 +            else:
    9.73 +                fo.write(gr[4]+'\n')
    9.74 +        fo.close()
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/toc.txt	Thu Oct 30 17:13:33 2008 +0000
    10.3 @@ -0,0 +1,32 @@
    10.4 +* intro
    10.5 +** intro_lemon
    10.6 +** intro_tutorial
    10.7 +* hello_lemon
    10.8 +** hello_lemon_system
    10.9 +** hello_lemon_user
   10.10 +**_digraph_build
   10.11 +**_digraph_iterate
   10.12 +**_standard_maps
   10.13 +**_algorithms
   10.14 +***_alg_bfs_dfs
   10.15 +***_alg_dijkstra
   10.16 +***_alg_kruskal
   10.17 +**_undir_graphs
   10.18 +*_tools
   10.19 +**_lgf
   10.20 +**_glemon
   10.21 +**_graph_to_eps
   10.22 +**_time_count
   10.23 +**_random
   10.24 +* install
   10.25 +** requirements_lemon
   10.26 +*** requirements_lp
   10.27 +** install_from_source
   10.28 +** install_hg
   10.29 +** install_rpm
   10.30 +** install_user
   10.31 +** compile_codes
   10.32 +*** compile_system_wide
   10.33 +*** compile_user_local
   10.34 +**** compile_use_pkg_config
   10.35 +* license