Update the build system to easily fix broken links
This commit is contained in:
parent
2cde77ff48
commit
eed73392fa
|
@ -117,4 +117,11 @@ The `build.py` script that builds the manual accepts the following options:
|
|||
- '-q', or '--quiet', to suppress all output (overrides -v)
|
||||
- '-d', or '--devmode', to add content to pages to help developers debug them
|
||||
(link, file name, URL)
|
||||
- '-n', or '--nopdf', to prevent the build script from generate a PDF from the content
|
||||
- '-p', or '--pdf', to automatically generate a PDF from the content
|
||||
|
||||
### Redirects
|
||||
|
||||
the uri_to_fix.txt file is a structured file that is read at build time
|
||||
to generate redirects HTML pages, and avoid dead links when a page is moved
|
||||
or removed. The syntax is old/and/obsolete/uri | @@link, reusing the 'link'
|
||||
keyword of the master document.
|
||||
|
|
25
build.py
25
build.py
|
@ -30,6 +30,7 @@ global_master_doc = 'master-doc.txt'
|
|||
global_pdflink = '<button class="btn btn-default" type="button" onclick="window.location.href=\'/manual.pdf\'"><span class="glyphicon glyphicon-book" aria-hidden="true"></span></button>'
|
||||
from datetime import datetime
|
||||
global_today = datetime.today().strftime('%Y-%m-%d')
|
||||
global_redirects_file = 'uri_to_fix.txt'
|
||||
|
||||
# This matches all *non* letter/number, ' ', '.', '-', and '_' chars
|
||||
cleanString = re.compile(r'[^a-zA-Z0-9 \._-]+')
|
||||
|
@ -728,6 +729,30 @@ if pdf:
|
|||
doc = HTML(string = pdfpage, base_url = global_site_dir)
|
||||
doc.write_pdf(global_site_dir + 'manual.pdf', font_config = html_font_config)
|
||||
|
||||
# URI redirects
|
||||
if os.path.exists(global_redirects_file):
|
||||
with open(global_redirects_file) as f:
|
||||
cpt = 0;
|
||||
for line in f:
|
||||
line = line.strip();
|
||||
if line == '':
|
||||
continue #empty line
|
||||
if line.startswith('//'):
|
||||
continue #comment
|
||||
params = line.split('|');
|
||||
params[0] = params[0].strip(' \t/')
|
||||
params[1] = params[1].strip(' \t')
|
||||
# write an HTML the file with a refresh redirect
|
||||
os.makedirs(global_site_dir + params[0], 0o775, exist_ok=True)
|
||||
destFile = open(global_site_dir + params[0] + '/index.html', 'w')
|
||||
newlink = FixInternalLinks(links, '"'+params[1]+'"', global_redirects_file)
|
||||
newlink = newlink.strip('"')
|
||||
page = '<html><head><meta http-equiv="refresh" content="0; url=' + newlink + '"></head><body><p>The page has moved to:<a href="' + newlink + '">this page</a></p></body></html>'
|
||||
destFile.write(page)
|
||||
destFile.close()
|
||||
if noisy:
|
||||
print('Generated ' + str(cpt) + ' redirection files.')
|
||||
|
||||
if noisy:
|
||||
print('Processed ' + str(fileCount) + ' files.')
|
||||
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
URLs that are currently 404 (Feb/14) -- add 301 redirects or re-instantiate the old URI
|
||||
|
||||
MUST fix:
|
||||
|
||||
...
|
||||
|
||||
|
||||
Should fix:
|
||||
|
||||
[FIXED?] http://www.manual.ardour.org/ardours-interface/using-ardour-clock-displays/ -> ardours-interface/transport-clocks
|
||||
|
||||
|
||||
Maybe fix:
|
||||
|
||||
http://www.manual.ardour.org/editing-and-arranging/creating-regionfades-and-crossfades/
|
||||
http://www.manual.ardour.org/editing-and-arranging/editing-midi/midi_region_cloning/
|
||||
http://www.manual.ardour.org/editing-and-arranging/editing-midi/changing-note-properties/
|
||||
http://www.manual.ardour.org/editing-and-arranging/editing-midi/quantizing-midi/
|
||||
http://www.manual.ardour.org/working-with-plugins/the-processor-box/
|
||||
http://www.manual.ardour.org/ardours-interface/basic-gui-operations/selection-techniques/
|
||||
http://www.manual.ardour.org/ardours-interface/basic-gui-operations/using-the-mouse/
|
||||
http://www.manual.ardour.org/ardours-interface/introducing-the-editor-window/the-editing-toolbar/
|
||||
http://www.manual.ardour.org/ardours-interface/introducing-the-editor-window/the-transport-bar/
|
||||
http://www.manual.ardour.org/working-with-markers/getting-to-know-the-rangesmarks-list/
|
||||
http://www.manual.ardour.org/working-with-markers/the-punch-range/
|
||||
http://www.manual.ardour.org/signal-routing/role-of-jack/
|
||||
http://www.manual.ardour.org/editing-and-arranging/move-regions/move-regions-with-the-mouse
|
||||
// URLs that are currently 404 (Feb/14) -- add 301 redirects or re-instantiate the old URI
|
||||
//
|
||||
// These URIs are no longer relevant, and are redirected by a meta refresh
|
||||
//
|
||||
// format : old/URI/to/replace |@@link (cf master-donc.txt)
|
||||
//
|
||||
default-keyboard-bindings/mnemonic-bindings-for-os-x/ |@@default-shortcuts
|
||||
default-keyboard-bindings/mnemonic-bindings-for-linux/ |@@default-shortcuts
|
||||
introduction-to-ardour/keyboard-and-mouse-shortcuts/ |@@keyboard-shortcuts
|
||||
editing-and-arranging/creating-regionfades-and-crossfades/ |@@create-region-fades-and-crossfades
|
||||
editing-and-arranging/editing-midi/midi_region_cloning/ |@@independent-and-dependent-midi-region-copies
|
||||
editing-and-arranging/editing-midi/quantizing-midi/ |@@quantize-midi
|
||||
working-with-plugins/the-processor-box/ |@@audiomidi-mixer-strips#audio-midi-processor-box
|
||||
ardours-interface/basic-gui-operations/selection-techniques/ |@@using-the-mouse
|
||||
ardours-interface/basic-gui-operations/using-the-mouse/ |@@using-the-mouse
|
||||
ardours-interface/introducing-the-editor-window/the-editing-toolbar/ |@@toolbox
|
||||
ardours-interface/introducing-the-editor-window/the-transport-bar/ |@@transport-bar
|
||||
working-with-markers/getting-to-know-the-rangesmarks-list/ |@@the-ranges-and-marks-lists
|
||||
working-with-markers/the-punch-range/ |@@selection-and-punch-clocks
|
||||
signal-routing/role-of-jack/ |@@starting-ardour
|
||||
editing-and-arranging/move-regions/move-regions-with-the-mouse |@@move-regions-with-the-mouse
|
||||
|
|
Loading…
Reference in New Issue