Hi all,

I provide in attachment a small patch for what I think is essentially needed for LaTeXML export in LyX

1) merging the checkViewer call for HTML previewer + adding the HTML5 format to it. 2) adding checkViewer for EPUB. At the moment, the viewer is Firefox and it is assumed that one EPUB reader add-on is installed.
3) adding "latexmlc --format=html4" as another HTML converter.
4) adding latexml as an EPUB3 and HTML5 converters. More could be added later, in particular I'm aware of https://github.com/michal-h21/tex4ebook for an extension of tex4ht with EPUB export.

I tested the HTML5 and EPUB3 export. The files are generated and I can preview them in Firefox (even if the document contains babel errors). Things that remains to consider:

a) Fix LaTeXML bug with babel https://github.com/brucemiller/LaTeXML/issues/487 and do more testing to see how LaTeXML deals with LaTeX files generated by LyX. b) Improve detection of EPUB reader, perhaps add more EPUB readers in the list. c) Check if we need to handle directories instead of a single file for HTML5/HTML export (LaTeXML generates png & css files, so I wonder if the ext_copy.py script should be used).

--
Frédéric Wang
maths-informatique-jeux.com/blog/frederic

diff --git a/lib/configure.py b/lib/configure.py
index ddaeb0c..247ab6a 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -634,7 +634,14 @@ def checkFormatEntries(dtl_tools):
 \Format oocalc     ods    "OpenOffice spreadsheet" "" "" "%%"    "document"	"application/vnd.oasis.opendocument.spreadsheet"'''])
  #
     checkViewer('an HTML previewer', ['firefox', 'mozilla file://$$p$$i', 'netscape'],
-        rc_entry = [r'\Format xhtml      xhtml   "LyXHTML"              y "%%" ""    "document,menu=export"	"application/xhtml+xml"'])
+        rc_entry = [r'''\Format xhtml      xhtml   "LyXHTML"              y "%%" ""    "document,menu=export"    "application/xhtml+xml"
+\Format html	"html, htm"	HTML	H	"%%"	""	"document,menu=export"	"text/html"
+\Format html5	html      	HTML5	""	"%%"	""	"document,menu=export"	"text/html"'''])
+ #
+ #  FIXME: check that the EPUBReader/Lucifox add-ons are installed?
+    checkViewer('an EPUB reader', ['firefox', 'mozilla file://$$p$$i', 'netscape'],
+        rc_entry = [r'''\Format epub	"epub"	"EPUB3"	""	"%%"	""	"document,menu=export"	"application/epub+zip"'''])
+
  #
     checkEditor('a BibTeX editor', ['jabref', 'JabRef', \
         'pybliographic', 'bibdesk', 'gbib', 'kbib', \
@@ -670,9 +677,6 @@ def checkFormatEntries(dtl_tools):
         # Windows only: DraftDVI
         addToRC(r'\Format dvi2       dvi     DraftDVI               ""	""	""	"vector"	""')
     #
-    checkViewer('an HTML previewer', ['firefox', 'mozilla file://$$p$$i', 'netscape'],
-        rc_entry = [r'\Format html      "html, htm" HTML                H  "%%"	""	"document,menu=export"	"text/html"'])
-    #
     checkViewerEditor('Noteedit', ['noteedit'],
         rc_entry = [r'\Format noteedit   not     Noteedit               "" "%%"	"%%"	"vector"	""'])
     #
@@ -789,7 +793,8 @@ def checkConverterEntries():
       # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/
       path, htmlconv = checkProg('a LaTeX -> HTML converter', ['htlatex $$i', 'htlatex.sh $$i', \
           '/usr/share/tex4ht/htlatex $$i', 'tth  -t -e2 -L$$b < $$i > $$o', \
-          'latex2html -no_subdir -split 0 -show_section_numbers $$i', 'hevea -s $$i'],
+          'latex2html -no_subdir -split 0 -show_section_numbers $$i',
+          'hevea -s $$i', 'latexmlc --dest $$o --format=html4 $$i'],
           rc_entry = [ r'\converter latex      html       "%%"	"needaux"' ])
       if htmlconv.find('htlatex') >= 0 or htmlconv == 'latex2html':
         addToRC(r'''\copier    html       "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
@@ -804,6 +809,15 @@ def checkConverterEntries():
       else:
         addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py $$i $$o"''')
 
+    # Search for HTML5 converters
+    path, html5conv = checkProg('a LaTeX -> HTML5 converter',
+        ['latexmlc --dest $$o $$i'],
+        rc_entry = [ r'\converter	latex	html5	"%%"	""' ])
+
+    # Search for EPUB3 converters
+    path, epub3conv = checkProg('a LaTeX -> EPUB3 converter',
+        ['latexmlc --dest $$o $$i'],
+        rc_entry = [ r'\converter	latex	epub	"%%"	""' ])
 
     # Check if LyXBlogger is installed
     lyxblogger_found = checkModule('lyxblogger')

Reply via email to