X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=build.py;h=376204959f810b72d7c5bfe126233c36b2346e01;hb=1f90d2dac9c47951e3740899649fe4aa47a7a5a6;hp=baf1f63e150f3428105174bce6aa1e00b0ee0bbf;hpb=bc1078a91e5e7abbe1a804d9af7cb9ca6a5cb478;p=ardour-manual diff --git a/build.py b/build.py index baf1f63..3762049 100755 --- a/build.py +++ b/build.py @@ -22,7 +22,7 @@ import argparse # 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'@@[^#"]*') +findLinks = re.compile(r'"@@[^#"]*[#"]') githuburl = 'https://github.com/Ardour/manual/edit/master/include/' # @@ -257,14 +257,30 @@ def FindInternalLinks(fs): for hdr in fs: if 'link' in hdr: - linkDict['@@' + hdr['link']] = '/' + hdr['filename'] + '/' + linkDict['"@@' + hdr['link'] + '"'] = '"/' + hdr['filename'] + '/"' + linkDict['"@@' + hdr['link'] + '#'] = '"/' + hdr['filename'] + '/index.html#' + + + return linkDict + +# +# Same as above, but create anchors (for the one-page version) +# +def FindInternalAnchors(fs): + linkDict = {} + + for hdr in fs: + if 'link' in hdr: + linkDict['"@@' + hdr['link'] + '"'] = '"#' + hdr['link'] + '"' + linkDict['"@@' + hdr['link'] + '#'] = '"#' + hdr['link'] + '"' + return linkDict # # Internal links are of the form '@@link-name', which are references to the -# 'link:' field in the part header. We have to find all occurances and replace +# 'link:' field in the part header. We have to find all occurrences and replace # them with the appropriate link. # def FixInternalLinks(links, content, title): @@ -296,15 +312,15 @@ def FixInternalLinks(links, content, title): # looking at currently # def BuildList(lst, fs, pagePos, cList): - content = '\n\n
\n' + content = '\n\n\n' + + return content + - content = content + '
\n' +# +# Builds the sidebar for the one-page version +# +def BuildOnePageSidebar(fs): + + content = '\n\n\n' return content + # # Create link sidebar given a position in the list. # @@ -329,12 +397,12 @@ def CreateLinkSidebar(fs, pos, childList): # Build the list recursively from the top level nodes content = BuildList(FindTopLevelNodes(fs), fs, pos, childList) - # Shove the TOC link in the top... - content = content[:7] + '
Table of Contents
\n' + content[7:] + # Shove the TOC link and one file link at the top... + active = ' class=active' if pos<0 else '' + content = content.replace('