Не генерировать PDF, если источник не обновлён
This commit is contained in:
parent
9e0019a728
commit
288c5aeba0
@ -17,6 +17,7 @@ from pelican.readers import BaseReader
|
||||
from pelican.generators import Generator
|
||||
from pelican import signals
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
@ -139,12 +140,13 @@ class AsciiDoctorPdfGenerator(Generator):
|
||||
filename = "{id_file}.pdf".format(id_file=content.slug)
|
||||
filepath = os.path.join(output_dir, filename)
|
||||
|
||||
check_call([cmd] + self.settings.get('ASCIIDOCTOR_EXTRA_OPTIONS', []) +
|
||||
['--require', 'asciidoctor-pdf', '--backend', 'pdf'] +
|
||||
['--doctype=article'] +
|
||||
['--out-file', filepath, content.source_path])
|
||||
|
||||
logger.info("[ok] writing {filepath}".format(filepath=filepath))
|
||||
if ((not os.path.isfile(filepath)) or
|
||||
(os.path.getmtime(filepath) < os.path.getmtime(content.source_path))):
|
||||
check_call([cmd] + self.settings.get('ASCIIDOCTOR_EXTRA_OPTIONS', []) +
|
||||
['--require', 'asciidoctor-pdf', '--backend', 'pdf'] +
|
||||
['--doctype=article'] +
|
||||
['--out-file', filepath, content.source_path])
|
||||
logger.info("[ok] writing {filepath}".format(filepath=filepath))
|
||||
|
||||
def generate_output(self, writer=None):
|
||||
"""Generate files for each articles and pages.
|
||||
|
Loading…
Reference in New Issue
Block a user