X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=build.py;h=2345dbceb9c6e299aea61fdbea3d775e292659e1;hb=74d200e341210baad9cc82dd974253c355fbc56e;hp=376204959f810b72d7c5bfe126233c36b2346e01;hpb=ccd3a8420bbf4ad9673e0c9551dd9665e7e4fa49;p=ardour-manual diff --git a/build.py b/build.py index 3762049..2345dbc 100755 --- a/build.py +++ b/build.py @@ -9,9 +9,6 @@ # Remnants (could go into the master document as the first header) -#bootstrap_path: /bootstrap-3.3.7 -#page_title: The Ardour Manual - import os import re import shutil @@ -19,11 +16,19 @@ import argparse # Global vars +global_bootstrap_path = '/bootstrap-3.3.7' +global_page_title = 'The Ardour Manual' +global_site_dir = './website/' +global_githuburl = 'https://github.com/Ardour/manual/edit/master/include/' +global_screen_template = 'page-template.html' +global_onepage_template = 'onepage-template.html' +global_pdf_template = 'pdf-template.html' +global_master_doc = 'master-doc.txt' + # This matches all *non* letter/number, ' ', '.', '-', and '_' chars cleanString = re.compile(r'[^a-zA-Z0-9 \._-]+') # This matches new 'unbreakable' links, up to the closing quote or anchor findLinks = re.compile(r'"@@[^#"]*[#"]') -githuburl = 'https://github.com/Ardour/manual/edit/master/include/' # # Create an all lowercase filename without special characters and with spaces @@ -70,19 +75,12 @@ def ParseHeader(fileObj): # def PartToLevel(s): level = -1 + lvl = {'part': 0, 'chapter': 1, 'subchapter': 2} + if s in lvl: + return lvl[s] + else: + return -1 - if s == 'part': - level = 0 - elif s == 'chapter': - level = 1 - elif s == 'subchapter': - level = 2 - elif s == 'section': - level = 3 - elif s == 'subsection': - level = 4 - - return level # # Converts a integer to a roman number @@ -107,7 +105,7 @@ def GetFileStructure(): fnames = [None]*6 content = '' grab = False - mf = open('master-doc.txt') + mf = open(global_master_doc) for ln in mf: if ln.startswith('---'): @@ -202,12 +200,19 @@ def GetParent(fs, pos): return pos +# +# Change the hierarchy of titles : h1->hn, h2->hn+1, etc... n being delta-1 +# +def reheader(txt, delta): + for i in range(6, 0, -1): + txt = txt.replace('> is for Bootstrap pre-3.0 breadcrumbs = '
  • '+ fs[pos]['title'] + '
  • ' while pos >= 0: @@ -342,26 +347,15 @@ def BuildList(lst, fs, pagePos, cList): # def BuildOnePageSidebar(fs): - content = '\n\n