[LyX/master] ePub: allow a user-specified Saxon.
Thibaut Cuvelier
tcuvelier at lyx.org
Sun Feb 7 22:16:13 UTC 2021
commit f7beed1ee2668b58b8008e5b475668709edacc76
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Feb 7 23:18:06 2021 +0100
ePub: allow a user-specified Saxon.
---
lib/configure.py | 4 ++--
lib/scripts/docbook2epub.py | 21 +++++++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/lib/configure.py b/lib/configure.py
index 346213c..24a51cb 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1008,9 +1008,9 @@ def checkConverterEntries():
#
global java
if xsltproc != '':
- addToRC('\\converter docbook5 epub "python $$s/scripts/docbook2epub.py none \\"' + xsltproc + '\\" none $$i $$o" ""')
+ addToRC('\\converter docbook5 epub "python $$s/scripts/docbook2epub.py none none \\"' + xsltproc + '\\" none $$i $$o" ""')
elif java != '':
- addToRC('\\converter docbook5 epub "python $$s/scripts/docbook2epub.py \\"' + java + '\\" none none $$i $$o" ""')
+ addToRC('\\converter docbook5 epub "python $$s/scripts/docbook2epub.py \\"' + java + '\\" none none none $$i $$o" ""')
#
checkProg('a MS Word Office Open XML converter -> LaTeX', ['pandoc -s -f docx -o $$o -t latex $$i'],
rc_entry = [ r'\converter word2 latex "%%" ""' ])
diff --git a/lib/scripts/docbook2epub.py b/lib/scripts/docbook2epub.py
index 35eda89..b35296a 100644
--- a/lib/scripts/docbook2epub.py
+++ b/lib/scripts/docbook2epub.py
@@ -26,22 +26,25 @@ class DocBookToEpub:
if args is None:
args = sys.argv
- if len(args) != 6:
- print('Six arguments are expected, only %s found: %s.' % (len(args), args))
+ if len(args) != 7:
+ print('Seven arguments are expected, only %s found: %s.' % (len(args), args))
sys.exit(1)
self.own_path = sys.argv[0]
self.java_path = sys.argv[1] if sys.argv[1] != '' and sys.argv[1] != 'none' else None
- self.xsltproc_path = sys.argv[2] if sys.argv[2] != '' and sys.argv[2] != 'none' else None
- self.xslt_path = sys.argv[3] if sys.argv[3] != '' and sys.argv[3] != 'none' else None
- self.input = sys.argv[4]
- self.output = sys.argv[5]
+ self.saxon_path = sys.argv[2] if sys.argv[2] != '' and sys.argv[2] != 'none' else None
+ self.xsltproc_path = sys.argv[3] if sys.argv[3] != '' and sys.argv[3] != 'none' else None
+ self.xslt_path = sys.argv[4] if sys.argv[4] != '' and sys.argv[4] != 'none' else None
+ self.input = sys.argv[5]
+ self.output = sys.argv[6]
self.script_folder = os.path.dirname(self.own_path) + '/../'
print('Generating ePub with the following parameters:')
print(self.own_path)
print(self.java_path)
+ print(self.saxon_path)
print(self.xsltproc_path)
+ print(self.xslt_path)
print(self.input)
print(self.output)
@@ -57,6 +60,9 @@ class DocBookToEpub:
print('XSLT style sheet to use:')
print(self.xslt)
+ if self.saxon_path is None:
+ self.saxon_path = self.script_folder + 'scripts/saxon6.5.5.jar'
+
# These will be filled during the execution of the script.
self.renamed = None
@@ -95,9 +101,8 @@ class DocBookToEpub:
return '"' + self.xsltproc_path + '" ' + params + ' "' + self.xslt + '" "' + self.input + '"'
def start_xslt_transformation_saxon6(self):
- saxon_jar = self.script_folder + 'scripts/saxon6.5.5.jar'
params = 'base.dir=%s' % self.output_dir
- executable = '"' + self.java_path + '" -jar "' + saxon_jar + '"'
+ executable = '"' + self.java_path + '" -jar "' + self.saxon_path + '"'
return executable + ' "' + self.input + '" "' + self.xslt + '" "' + params + '"'
def get_images_from_package_opf(self):
More information about the lyx-cvs
mailing list