X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=build.py;h=b53b439f13bcd0039ec09e9cb0f8a9390a4ffcb5;hb=9b9f871806fd9066acd0e7cf415a8423abe43c8f;hp=8ac84d4efb4e93859685ad7fb7f0962ebad7de26;hpb=d64781b7c2d42a735d427ead67d04b3d77b2467a;p=ardour-manual diff --git a/build.py b/build.py index 8ac84d4..b53b439 100755 --- a/build.py +++ b/build.py @@ -112,12 +112,18 @@ def GetFileStructure(): level = PartToLevel(hdr['part']) hdr['level'] = level fnames[level] = MakeFilename(hdr['title']) - fullName = '' - for i in range(level + 1): - fullName = fullName + fnames[i] + '/' + # Ickyness--user specified URIs + if 'uri' in hdr: + hdr['filename'] = hdr['uri'] + else: + fullName = '' + + for i in range(level + 1): + fullName = fullName + fnames[i] + '/' + + hdr['filename'] = fullName.rstrip('/') - hdr['filename'] = fullName.rstrip('/') fs.append(hdr) if ('include' not in hdr) and (level > 0): @@ -253,7 +259,8 @@ def BuildList(lst, fs, pagePos, cList): nextPos = lst[i + 1] if i + 1 < len(lst) else len(fs) active = ' class=active' if curPos == pagePos else '' - content = content + '' + fs[curPos]['title'] + '' + menuTitle = fs[curPos]['menu_title'] if 'menu_title' in fs[curPos] else fs[curPos]['title'] + content = content + '' + menuTitle + '' # If the current page is our page, and it has children, enumerate them if curPos == pagePos: @@ -316,11 +323,6 @@ if os.access(siteDir, os.F_OK): shutil.copytree('./source', siteDir) -# Yeah, need to make a symlink in include/ too :-P -# [this will go away when the rewrite happens] -if (os.access('include/_manual', os.F_OK) == False): - os.symlink('../_manual/', 'include/_manual') - # Read the template, and fix the stuff that's fixed for all pages temp = open('page-template.txt') @@ -465,8 +467,9 @@ for header in fileStruct: page = page.replace('{% prevnext %}', prevnext) page = page.replace('{{ content }}', content + more) - # Create the directory for the index.html file to go into - os.mkdir(siteDir + header['filename'], 0o775) + # Create the directory for the index.html file to go into (we use makedirs, + # because we have to in order to accomodate the 'uri' keyword) + os.makedirs(siteDir + header['filename'], 0o775, exist_ok=True) # Finally, write the file! destFile = open(siteDir + header['filename'] + '/index.html', 'w')