hgbook

diff it/web/genindex.py @ 860:600e7ab15c67

Make references appear in the web TOC.
author gpiancastelli
date Sun Aug 23 01:14:14 2009 +0200 (2009-08-23)
parents cd492721c0e5
children 84eb02cbf057
line diff
     1.1 --- a/it/web/genindex.py	Sat Aug 22 23:02:23 2009 +0200
     1.2 +++ b/it/web/genindex.py	Sun Aug 23 01:14:14 2009 +0200
     1.3 @@ -2,12 +2,13 @@
     1.4  
     1.5  import glob, os, re
     1.6  
     1.7 -chapter_re = re.compile(r'<(chapter|appendix|preface)\s+id="([^"]+)">')
     1.8 +chapter_re = re.compile(r'<(chapter|appendix|preface|bibliography)\s+id="([^"]+)">')
     1.9  filename_re = re.compile(r'<\?dbhtml filename="([^"]+)"\?>')
    1.10  title_re = re.compile(r'<title>(.*)</title>')
    1.11  
    1.12  chapters = (sorted(glob.glob('../ch*.xml')) +
    1.13 -            sorted(glob.glob('../app*.xml')))
    1.14 +            sorted(glob.glob('../app*.xml')) +
    1.15 +            sorted(glob.glob('../biblio*.xml')))
    1.16  
    1.17  fp = open('index-read.html.in', 'w', encoding='utf-8')
    1.18  
    1.19 @@ -34,11 +35,13 @@
    1.20          if m:
    1.21              title = m.group(1)
    1.22          if filename and title and chapid:
    1.23 -            if chaptype == 'appendix':
    1.24 -                num = chr(ord('A') + app)
    1.25 +            if chaptype == 'bibliography':
    1.26 +                num = ''
    1.27 +            elif chaptype == 'appendix':
    1.28 +                num = str(chr(ord('A') + app)) + '. '
    1.29                  app += 1
    1.30              else:
    1.31 -                num = ch
    1.32 +                num = str(ch) + '. '
    1.33                  ch += 1
    1.34              if title.find('&') >= 0:
    1.35                  title = title.replace('&', '\&')
    1.36 @@ -52,7 +55,7 @@
    1.37                  'filename': filename,
    1.38                  'title': title,
    1.39                  }
    1.40 -            print('<li class="zebra_%(ab)s"><span class="chapinfo">%(date)s</span>%(num)s. <a href="%(filename)s">%(title)s</a></li>' % args, file=fp)
    1.41 +            print('<li class="zebra_%(ab)s"><span class="chapinfo">%(date)s</span>%(num)s<a href="%(filename)s">%(title)s</a></li>' % args, file=fp)
    1.42              break
    1.43  
    1.44  print('</ul></div>', file=fp)