Remove the PDF button if it is not created with the -p / --pdf option

This commit is contained in:
Ed Ward 2021-04-05 21:02:53 +02:00 committed by Len Ovens
parent 82c4909049
commit 21713e4e61
2 changed files with 7 additions and 1 deletions

View File

@ -27,6 +27,7 @@ global_screen_template = 'page-template.html'
global_onepage_template = 'onepage-template.html' global_onepage_template = 'onepage-template.html'
global_pdf_template = 'pdf-template.html' global_pdf_template = 'pdf-template.html'
global_master_doc = 'master-doc.txt' 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 from datetime import datetime
global_today_iso = datetime.today().strftime('%Y-%m-%dT%H%M%S') global_today_iso = datetime.today().strftime('%Y-%m-%dT%H%M%S')
global_today = datetime.today().strftime('%Y-%m-%d') global_today = datetime.today().strftime('%Y-%m-%d')
@ -456,6 +457,11 @@ template = temp.read()
temp.close() temp.close()
template = template.replace('{{page.bootstrap_path}}', global_bootstrap_path) template = template.replace('{{page.bootstrap_path}}', global_bootstrap_path)
template = template.replace('{{page.page_title}}', global_page_title) template = template.replace('{{page.page_title}}', global_page_title)
if pdf:
template = template.replace('{{page.page_pdflink}}', global_pdflink)
else:
template = template.replace('{{page.page_pdflink}}', '')
# Same as above, but for the "One-Page" version # Same as above, but for the "One-Page" version
temp = open(global_onepage_template) temp = open(global_onepage_template)

View File

@ -27,7 +27,7 @@
<input type="text" class="form-control" placeholder="Search &hellip;" name="q"> <input type="text" class="form-control" placeholder="Search &hellip;" name="q">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
<button class="btn btn-default" type="button" onclick="window.location.href='/manual.pdf'"><span class="glyphicon glyphicon-book" aria-hidden="true"></span></button> {{page.page_pdflink}}
</span> </span>
</div> </div>
<input type="hidden" name="sites" value="manual.ardour.org"><!-- domain --> <input type="hidden" name="sites" value="manual.ardour.org"><!-- domain -->