mirror of
https://github.com/getpelican/pelican.git
synced 2026-05-28 15:58:22 +02:00
Fix for replacing |filename| with static url
This commit is contained in:
parent
51dc02f298
commit
77c6c6fd3f
1 changed files with 5 additions and 3 deletions
|
|
@ -593,9 +593,11 @@ class PdfGenerator(Generator):
|
|||
if obj.source_path.endswith('.rst'):
|
||||
filename = obj.slug + ".pdf"
|
||||
output_pdf = os.path.join(output_path, filename)
|
||||
# print('Generating pdf for', obj.source_path, 'in', output_pdf)
|
||||
with open(obj.source_path) as f:
|
||||
self.pdfcreator.createPdf(text=f.read(), output=output_pdf)
|
||||
with open(obj.source_path, encoding='utf-8') as f:
|
||||
pdf_content = f.read()
|
||||
siteurl = "/".join((self.settings['SITEURL'], 'static', ''))[:-1]
|
||||
pdf_content = pdf_content.replace("|filename|", siteurl)
|
||||
self.pdfcreator.createPdf(text=pdf_content, output=output_pdf)
|
||||
logger.info(' [ok] writing %s' % output_pdf)
|
||||
|
||||
def generate_context(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue