]> git.lyx.org Git - features.git/commitdiff
ePub: allow a user-specified Saxon.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Sun, 7 Feb 2021 22:18:06 +0000 (23:18 +0100)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Sun, 7 Feb 2021 22:19:07 +0000 (23:19 +0100)
lib/configure.py
lib/scripts/docbook2epub.py

index 346213ca4f5f8b793b34d917a9e0f75ea1e2af69..24a51cb3a2366f14328dd1a511dea7d231065afd 100644 (file)
@@ -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      "%%"   ""' ])
index 35eda894316e5c6429a240e1e9e7f1181331f8df..b35296a5581cd99221f6490c6205dece57cde8ef 100644 (file)
@@ -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):