X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=build.py;h=d7753fe60a31441341bce9136b075d33032dff40;hb=01263a844bbe2fb45c5df31d1c6053d323c69446;hp=3056faf919f61311d654281042ae28b93b65e497;hpb=21713e4e61581a5383ef45842a7493e786a28c96;p=ardour-manual
diff --git a/build.py b/build.py
index 3056faf..d7753fe 100755
--- a/build.py
+++ b/build.py
@@ -29,7 +29,6 @@ global_pdf_template = 'pdf-template.html'
global_master_doc = 'master-doc.txt'
global_pdflink = ''
from datetime import datetime
-global_today_iso = datetime.today().strftime('%Y-%m-%dT%H%M%S')
global_today = datetime.today().strftime('%Y-%m-%d')
# This matches all *non* letter/number, ' ', '.', '-', and '_' chars
@@ -209,16 +208,22 @@ def GetParent(fs, pos):
#
-#Â Change the hierarchy of titles : h1->hn, h2->hn+1, etc... n being delta-1
+#Â Change the hierarchy of titles :
->,
->, so that the
+# highest hyerarchy level is maxlevel
#
-def reheader(txt, delta):
- for i in range(6, 0, -1):
- txt = txt.replace('' + header['title'] + '\n';
@@ -697,12 +702,14 @@ onepageFile.close()
if pdf:
if noisy:
print('Generating the PDF...')
+ import logging
+ logger = logging.getLogger('weasyprint')
+ logger.addHandler(logging.StreamHandler())
# Create the PDF version of the documentation
pdfpage = pdfpage.replace('{% tree %}', opsidebar) # create the TOC
pdfpage = pdfpage.replace('{{ content }}', '') # cleans up the last spaceholder
pdfpage = pdfpage.replace('{{ today }}', global_today)
- pdfpage = pdfpage.replace('{{ today_iso }}', global_today_iso)
pdfpage = pdfpage.replace('src="/images/', 'src="images/') # makes images links relative
pdfpage = pdfpage.replace('url(\'/images/', 'url(\'images/') # CSS images links relative
# Write it to disk (optional, can be removed)
@@ -713,6 +720,7 @@ if pdf:
# Generating the actual PDF with weasyprint (https://weasyprint.org/)
from weasyprint import HTML
from weasyprint.fonts import FontConfiguration
+
html_font_config = FontConfiguration()
doc = HTML(string = pdfpage, base_url = global_site_dir)
doc.write_pdf(global_site_dir + 'manual.pdf', font_config = html_font_config)