On Sun, Jan 23, 2011 at 5:43 PM, Alex Fernandez <[email protected]> wrote:
> I have attached a new patch for trunk with a few modifications:
> * Your suggestion above, both for eLyXer and for htlatex: "a LyX ->
> HTML (MS Word) converter".
> * I have changed the logic somehow to make it clearer.
> * There was a bug when eLyXer was not found, which was silently fixed
> by baum in SVN (thanks BTW). Now elyxerfound is initialized at the
> beginning; even a novice like me will find it hard to break it again.
>
> I will attach a similar patch for branch in a separate mail (there are
> a few small changes).

Patch for branch. Changes:
* Do not load eLyXer as a module, but run it always as a script. More
robust this way if "elyxer" is a package instead of a module.
* Pavel's suggestion to change the converter to "a LyX -> HTML (MS
Word) converter".
* Changed the logic somehow to make it clearer.
* Solved the bug that runs eLyXer as a module for MS Word, even if it
is found as a script.

Changes from trunk:
* LyXBlogger depends on eLyXer to be loaded.

Please let me know if there is any problem with the patch as submitted.

Alex.
Index: lib/configure.py
===================================================================
--- lib/configure.py	(revisión: 37303)
+++ lib/configure.py	(copia de trabajo)
@@ -404,19 +404,20 @@
     #
     checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'],
         rc_entry = [ r'\converter word       latex      "%%"	""' ])
-    # eLyXer: search as a Python module and then as an executable (elyxer.py, elyxer)
-    elyxerfound = checkModule('elyxer')
-    if elyxerfound:
-      addToRC(r'''\converter lyx      html       "python -m elyxer --directory $$r $$i $$o"	""''')
-    else:
-      path, elyxer = checkProg('a LyX -> HTML converter', ['elyxer.py --directory $$r $$i $$o', 'elyxer --directory $$r $$i $$o'],
+    # eLyXer: search as an executable (elyxer.py, elyxer)
+    elyxerfound = False
+    path, elyxer = checkProg('a LyX -> HTML converter',
+        ['elyxer.py --directory $$r $$i $$o', 'elyxer --directory $$r $$i $$o'],
         rc_entry = [ r'\converter lyx      html       "%%"	""' ])
-      if elyxer.find('elyxer') >= 0:
-        elyxerfound = True
-
-    if elyxerfound:
+    path, elyxer = checkProg('a LyX -> HTML (MS Word) converter',
+        ['elyxer.py --html --directory $$r $$i $$o', 'elyxer --html --directory $$r $$i $$o'],
+        rc_entry = [ r'\converter lyx      wordhtml       "%%"	""' ])
+    if elyxer.find('elyxer') >= 0:
+      elyxerfound = True
       addToRC(r'''\copier    html       "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
+      addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
     else:
+      # search for HTML converters other than eLyXer
       # 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', \
@@ -426,21 +427,21 @@
         addToRC(r'''\copier    html       "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
       else:
         addToRC(r'''\copier    html       "python -tt $$s/scripts/ext_copy.py $$i $$o"''')
+      path, htmlconv = checkProg('a LaTeX -> HTML (MS Word) converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'", \
+          "htlatex.sh $$i 'html,word' 'symbol/!' '-cvalidate'", \
+          "/usr/share/tex4ht/htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"],
+          rc_entry = [ r'\converter latex      wordhtml   "%%"	"needaux"' ])
+      if htmlconv.find('htlatex') >= 0:
+        addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
+      else:
+        addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py $$i $$o"''')
 
+
     # Check if LyxBlogger is installed (Depends on eLyXer)
-    if elyxerfound:
-      lyxblogger_found = checkModule('lyxblogger')
-      if lyxblogger_found:
-        addToRC(r'\Format    blog       blog       "LyXBlogger"           "" "" ""  "document"')
-        addToRC(r'\converter html       blog       "python -m lyxblogger $$i"       ""')
+    if elyxerfound and checkModule('lyxblogger'):
+      addToRC(r'\Format    blog       blog       "LyXBlogger"           "" "" ""  "document"')
+      addToRC(r'\converter html       blog       "python -m lyxblogger $$i"       ""')
 
-    # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/
-    path, htmlconv = checkProg('a LaTeX -> MS Word converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'", \
-        "htlatex.sh $$i 'html,word' 'symbol/!' '-cvalidate'", \
-        "/usr/share/tex4ht/htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"],
-        rc_entry = [ r'\converter latex      wordhtml   "%%"	"needaux"' ])
-    if htmlconv.find('htlatex') >= 0:
-      addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
     #
     checkProg('an OpenOffice.org -> LaTeX converter', ['w2l -clean $$i'],
         rc_entry = [ r'\converter sxw        latex      "%%"	""' ])

Reply via email to