mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Added a new setting OUTPUT_SOURCES_EXTENSION
Using this configurable setting users can control what extension will be appended to filenames by the SourcesGenerator. The default is to use the ``.text`` extension.
This commit is contained in:
parent
0a1a868b37
commit
a7dd21ffaf
3 changed files with 20 additions and 1 deletions
|
|
@ -492,9 +492,12 @@ class PdfGenerator(Generator):
|
|||
self._create_pdf(page, pdf_path)
|
||||
|
||||
class SourceFileGenerator(Generator):
|
||||
def generate_context(self):
|
||||
self.output_extension = self.settings['OUTPUT_SOURCES_EXTENSION']
|
||||
|
||||
def _create_source(self, obj, output_path):
|
||||
filename = os.path.splitext(obj.save_as)[0]
|
||||
dest = os.path.join(output_path, filename + '.text')
|
||||
dest = os.path.join(output_path, filename + self.output_extension)
|
||||
copy('', obj.filename, dest)
|
||||
|
||||
def generate_output(self, writer=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue