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