Include images in the automated PDF

This commit is contained in:
Ed Ward 2019-07-31 14:18:07 +02:00
parent cfb496c7d3
commit 498117584a
3 changed files with 12 additions and 7 deletions

View File

@ -126,3 +126,4 @@ 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

View File

@ -454,6 +454,7 @@ temp.close()
onepage = onepage.replace('{{page.bootstrap_path}}', global_bootstrap_path)
onepage = onepage.replace('{{page.page_title}}', global_page_title)
if not nopdf:
# Same as above, but for the PDF version
temp = open(global_pdf_template)
pdfpage = temp.read()
@ -614,6 +615,7 @@ for header in fileStruct:
# Set up the actual page from the template
onepage = onepage.replace('{{ content }}', oph + '\n' + opcontent + '\n{{ content }}')
if not nopdf:
pdfpage = pdfpage.replace('{{ content }}', oph + '\n' + opcontent + '\n{{ content }}')
# ----- Normal version -----
@ -681,6 +683,8 @@ if not nopdf:
pdfpageFile = open(global_site_dir + 'pdf.html', 'w')
pdfpage = pdfpage.replace('{% tree %}', opsidebar) # create the TOC
pdfpage = pdfpage.replace('{{ content }}', '') # cleans up the last spaceholder
pdfpage = pdfpage.replace('src="/images/', 'src="images/') # makes images links relative
pdfpage = pdfpage.replace('url(\'/images/', 'url(\'images/') # CSS images links relative
pdfpageFile.write(pdfpage)
pdfpageFile.close()

View File

@ -27,7 +27,7 @@
<input type="text" class="form-control" placeholder="Search &hellip;" name="q">
<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="button" onclick="window.location.href='/ardourmanual.html'"><span class="glyphicon glyphicon-book" 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>
</span>
</div>
<input type="hidden" name="sites" value="manual.ardour.org"><!-- domain -->