X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=build.py;h=d7753fe60a31441341bce9136b075d33032dff40;hb=01263a844bbe2fb45c5df31d1c6053d323c69446;hp=4424f76bea483d2cfa710ec23ce64d99bca40ad8;hpb=f04db3fe5d2b7eba806d154e215466a2884bdb0c;p=ardour-manual diff --git a/build.py b/build.py index 4424f76..d7753fe 100755 --- a/build.py +++ b/build.py @@ -27,8 +27,8 @@ global_screen_template = 'page-template.html' global_onepage_template = 'onepage-template.html' 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 @@ -208,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'; @@ -691,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) @@ -707,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)