mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
endswith can take a list as an argument ;)
This commit is contained in:
parent
3f26f9af5b
commit
964f7d96d6
1 changed files with 11 additions and 10 deletions
|
|
@ -94,8 +94,7 @@ class Generator(object):
|
|||
if extensions is None:
|
||||
extensions = self.markup
|
||||
basename = os.path.basename(path)
|
||||
if extensions is False or \
|
||||
(True in [basename.endswith(ext) for ext in extensions]):
|
||||
if extensions is False or basename.endswith(extensions):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
@ -150,8 +149,8 @@ class _FileLoader(BaseLoader):
|
|||
mtime = os.path.getmtime(self.fullpath)
|
||||
with open(self.fullpath, 'r', encoding='utf-8') as f:
|
||||
source = f.read()
|
||||
return source, self.fullpath, \
|
||||
lambda: mtime == os.path.getmtime(self.fullpath)
|
||||
return (source, self.fullpath,
|
||||
lambda: mtime == os.path.getmtime(self.fullpath))
|
||||
|
||||
|
||||
class TemplatePagesGenerator(Generator):
|
||||
|
|
@ -551,12 +550,14 @@ class PdfGenerator(Generator):
|
|||
super(PdfGenerator, self).__init__(*args, **kwargs)
|
||||
try:
|
||||
from rst2pdf.createpdf import RstToPdf
|
||||
pdf_style_path = os.path.join(self.settings['PDF_STYLE_PATH']) \
|
||||
if 'PDF_STYLE_PATH' in self.settings.keys() \
|
||||
else ''
|
||||
pdf_style = self.settings['PDF_STYLE'] if 'PDF_STYLE' \
|
||||
in self.settings.keys() \
|
||||
else 'twelvepoint'
|
||||
if 'PDF_STYLE_PATH' in self.settings.keys():
|
||||
pdf_style_path = os.path.join(self.settings['PDF_STYLE_PATH'])
|
||||
else:
|
||||
pdf_style_path = ''
|
||||
|
||||
if 'PDF_STYLE' in self.settings.keys():
|
||||
pdf_style = self.settings.get('PDF_STYLE', 'twelvepoint')
|
||||
|
||||
self.pdfcreator = RstToPdf(breakside=0,
|
||||
stylesheets=[pdf_style],
|
||||
style_path=[pdf_style_path])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue