Added support for Pandoc 2.2.1
- Used on Debian 10.x - Doesn't support "--to pdf", but can generate PDFs ...
This commit is contained in:
parent
d4945e0189
commit
afc499e055
|
|
@ -1874,7 +1874,8 @@ Next time you need this list just use an alias, like this:
|
||||||
* Valid keys:
|
* Valid keys:
|
||||||
- `convert_from`: [string='markdown'] Original format for the report conversion. Current templates are `markdown`. See `do_convert`.
|
- `convert_from`: [string='markdown'] Original format for the report conversion. Current templates are `markdown`. See `do_convert`.
|
||||||
- `convert_to`: [string='pdf'] Target format for the report conversion. See `do_convert`.
|
- `convert_to`: [string='pdf'] Target format for the report conversion. See `do_convert`.
|
||||||
- `converted_output`: [string='%f-%i%I%v.%x'] Converted output file name (%i='report', %x=`convert_to`). Affected by global options.
|
- `converted_output`: [string='%f-%i%I%v.%x'] Converted output file name (%i='report', %x=`convert_to`).
|
||||||
|
Note that the extension should match the `convert_to` value. Affected by global options.
|
||||||
- `do_convert`: [boolean=false] Run `Pandoc` to convert the report. Note that Pandoc must be installed.
|
- `do_convert`: [boolean=false] Run `Pandoc` to convert the report. Note that Pandoc must be installed.
|
||||||
The conversion is done assuming the report is in `convert_from` format.
|
The conversion is done assuming the report is in `convert_from` format.
|
||||||
The output file will be in `convert_to` format.
|
The output file will be in `convert_to` format.
|
||||||
|
|
|
||||||
|
|
@ -1310,7 +1310,8 @@ outputs:
|
||||||
convert_from: 'markdown'
|
convert_from: 'markdown'
|
||||||
# [string='pdf'] Target format for the report conversion. See `do_convert`
|
# [string='pdf'] Target format for the report conversion. See `do_convert`
|
||||||
convert_to: 'pdf'
|
convert_to: 'pdf'
|
||||||
# [string='%f-%i%I%v.%x'] Converted output file name (%i='report', %x=`convert_to`). Affected by global options
|
# [string='%f-%i%I%v.%x'] Converted output file name (%i='report', %x=`convert_to`).
|
||||||
|
# Note that the extension should match the `convert_to` value. Affected by global options
|
||||||
converted_output: '%f-%i%I%v.%x'
|
converted_output: '%f-%i%I%v.%x'
|
||||||
# [boolean=false] Run `Pandoc` to convert the report. Note that Pandoc must be installed.
|
# [boolean=false] Run `Pandoc` to convert the report. Note that Pandoc must be installed.
|
||||||
# The conversion is done assuming the report is in `convert_from` format.
|
# The conversion is done assuming the report is in `convert_from` format.
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,7 @@ W_MIXVARIANT = '(W079) '
|
||||||
W_NOTPDF = '(W080) '
|
W_NOTPDF = '(W080) '
|
||||||
W_NOREF = '(W081) '
|
W_NOREF = '(W081) '
|
||||||
W_UNKVAR = '(W082) '
|
W_UNKVAR = '(W082) '
|
||||||
|
W_WRONGEXT = '(W083) '
|
||||||
# Somehow arbitrary, the colors are real, but can be different
|
# Somehow arbitrary, the colors are real, but can be different
|
||||||
PCB_MAT_COLORS = {'fr1': "937042", 'fr2': "949d70", 'fr3': "adacb4", 'fr4': "332B16", 'fr5': "6cc290"}
|
PCB_MAT_COLORS = {'fr1': "937042", 'fr2': "949d70", 'fr3': "adacb4", 'fr4': "332B16", 'fr5': "6cc290"}
|
||||||
PCB_FINISH_COLORS = {'hal': "8b898c", 'hasl': "8b898c", 'imag': "8b898c", 'enig': "cfb96e", 'enepig': "cfb96e",
|
PCB_FINISH_COLORS = {'hal': "8b898c", 'hasl': "8b898c", 'imag': "8b898c", 'enig': "cfb96e", 'enepig': "cfb96e",
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from subprocess import check_output, STDOUT, CalledProcessError
|
||||||
|
|
||||||
from .gs import GS
|
from .gs import GS
|
||||||
from .misc import (UI_SMD, UI_VIRTUAL, MOD_THROUGH_HOLE, MOD_SMD, MOD_EXCLUDE_FROM_POS_FILES, PANDOC, MISSING_TOOL,
|
from .misc import (UI_SMD, UI_VIRTUAL, MOD_THROUGH_HOLE, MOD_SMD, MOD_EXCLUDE_FROM_POS_FILES, PANDOC, MISSING_TOOL,
|
||||||
FAILED_EXECUTE)
|
FAILED_EXECUTE, W_WRONGEXT)
|
||||||
from .registrable import RegOutput
|
from .registrable import RegOutput
|
||||||
from .out_base import BaseOptions
|
from .out_base import BaseOptions
|
||||||
from .error import KiPlotConfigurationError
|
from .error import KiPlotConfigurationError
|
||||||
|
|
@ -129,7 +129,8 @@ class ReportOptions(BaseOptions):
|
||||||
The output file will be in `convert_to` format.
|
The output file will be in `convert_to` format.
|
||||||
The available formats depends on the `Pandoc` installation """
|
The available formats depends on the `Pandoc` installation """
|
||||||
self.converted_output = GS.def_global_output
|
self.converted_output = GS.def_global_output
|
||||||
""" Converted output file name (%i='report', %x=`convert_to`) """
|
""" Converted output file name (%i='report', %x=`convert_to`).
|
||||||
|
Note that the extension should match the `convert_to` value """
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._expand_id = 'report'
|
self._expand_id = 'report'
|
||||||
self._expand_ext = 'txt'
|
self._expand_ext = 'txt'
|
||||||
|
|
@ -609,7 +610,10 @@ class ReportOptions(BaseOptions):
|
||||||
out = self.expand_converted_output(GS.out_dir)
|
out = self.expand_converted_output(GS.out_dir)
|
||||||
logger.debug('Converting the report to: {}'.format(out))
|
logger.debug('Converting the report to: {}'.format(out))
|
||||||
resources = '--resource-path='+GS.out_dir
|
resources = '--resource-path='+GS.out_dir
|
||||||
cmd = [PANDOC, '--from', self.convert_from, '--to', self.convert_to, resources, fname, '-o', out]
|
# Pandoc 2.2.1 doesn't support "--to pdf"
|
||||||
|
if not out.endswith('.'+self.convert_to):
|
||||||
|
logger.warning(W_WRONGEXT+'The conversion tool detects the output format using the extension')
|
||||||
|
cmd = [PANDOC, '--from', self.convert_from, resources, fname, '-o', out]
|
||||||
logger.debug('Executing {}'.format(cmd))
|
logger.debug('Executing {}'.format(cmd))
|
||||||
try:
|
try:
|
||||||
check_output(cmd, stderr=STDOUT)
|
check_output(cmd, stderr=STDOUT)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue