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:
|
if extensions is None:
|
||||||
extensions = self.markup
|
extensions = self.markup
|
||||||
basename = os.path.basename(path)
|
basename = os.path.basename(path)
|
||||||
if extensions is False or \
|
if extensions is False or basename.endswith(extensions):
|
||||||
(True in [basename.endswith(ext) for ext in extensions]):
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -150,8 +149,8 @@ class _FileLoader(BaseLoader):
|
||||||
mtime = os.path.getmtime(self.fullpath)
|
mtime = os.path.getmtime(self.fullpath)
|
||||||
with open(self.fullpath, 'r', encoding='utf-8') as f:
|
with open(self.fullpath, 'r', encoding='utf-8') as f:
|
||||||
source = f.read()
|
source = f.read()
|
||||||
return source, self.fullpath, \
|
return (source, self.fullpath,
|
||||||
lambda: mtime == os.path.getmtime(self.fullpath)
|
lambda: mtime == os.path.getmtime(self.fullpath))
|
||||||
|
|
||||||
|
|
||||||
class TemplatePagesGenerator(Generator):
|
class TemplatePagesGenerator(Generator):
|
||||||
|
|
@ -551,12 +550,14 @@ class PdfGenerator(Generator):
|
||||||
super(PdfGenerator, self).__init__(*args, **kwargs)
|
super(PdfGenerator, self).__init__(*args, **kwargs)
|
||||||
try:
|
try:
|
||||||
from rst2pdf.createpdf import RstToPdf
|
from rst2pdf.createpdf import RstToPdf
|
||||||
pdf_style_path = os.path.join(self.settings['PDF_STYLE_PATH']) \
|
if 'PDF_STYLE_PATH' in self.settings.keys():
|
||||||
if 'PDF_STYLE_PATH' in self.settings.keys() \
|
pdf_style_path = os.path.join(self.settings['PDF_STYLE_PATH'])
|
||||||
else ''
|
else:
|
||||||
pdf_style = self.settings['PDF_STYLE'] if 'PDF_STYLE' \
|
pdf_style_path = ''
|
||||||
in self.settings.keys() \
|
|
||||||
else 'twelvepoint'
|
if 'PDF_STYLE' in self.settings.keys():
|
||||||
|
pdf_style = self.settings.get('PDF_STYLE', 'twelvepoint')
|
||||||
|
|
||||||
self.pdfcreator = RstToPdf(breakside=0,
|
self.pdfcreator = RstToPdf(breakside=0,
|
||||||
stylesheets=[pdf_style],
|
stylesheets=[pdf_style],
|
||||||
style_path=[pdf_style_path])
|
style_path=[pdf_style_path])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue