Hi guys,

Since our last discussion I've had some time to work on LyX - eLyXer
integration. In particular I've tried the excellent suggestions from
Guenther Milde, and surprise, it works. This time around it looks for
eLyXer installed as a Python module (called "elyxer", not
"elyxerconv"); if not found it searches for the usual elyxer.py,
elyxer executables. Hopefully this solves all reasonable issues and
concerns of LyX developers and integrators. It does not interfere with
Jürgen's new mechanism for preview and conversion (which frankly I
don't like much), it does not change how LyX recognizes HTML
converters (which I don't like much either), and it should apply
cleanly against trunk (on the lib directory). It does not work with
the current version of eLyXer (0.30), but it will against the next
(0.31), so it can wait until 0.31 is published; but I wanted to get
early feedback.

Now that business is out of the way, let's have fun with some Q&A!

Q: Bridges? We don't need no stinkin' bridges!
A: The bridge code (now all confined to configure.py) is necessary to
try to load eLyXer as a Python module; it is the only reasonable way
to use the standard Python mechanism for software distribution for
eLyXer.
Q: Why single out eLyXer? Why not figure out a generic mechanism for
all Python modules?
A: Because there are no other Python modules that I know of. Unless
there is a good reason, if nobody has cared about it before, I'm not
going to be the first sucker.
Q: Why work on this at all? Isn't it better to dedicate your efforts
towards my whimsical pet project which I will leave unfinished while
needlessly burdening everyone that wants to implement new features in
LyX?
A: I don't have time for endless drivel, so I will only answer
reasoned criticisms. In other words, go away you troll.

Thanks,

Alex.
Index: configure.py
===================================================================
--- configure.py	(revisión: 31391)
+++ configure.py	(copia de trabajo)
@@ -605,9 +605,22 @@
     checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'],
         rc_entry = [ r'\converter word       latex      "%%"	""' ])
     #
-    path, elyxer = checkProg('a LyX -> HTML converter', ['elyxer.py', 'elyxer'],
-      rc_entry = [ r'\converter lyx      html       "python -tt $$s/scripts/elyxer.py --directory $$r $$i $$o"	""' ])
-    if elyxer.find('elyxer') >= 0:
+    # eLyXer: search as a Python module and then as an executable (elyxer.py, elyxer)
+    elyxerfound = False
+    msg = 'checking for "eLyXer module"... '
+    try:
+      import elyxer
+      addToRC(r'''\converter lyx      html       "python -m elyxer --directory $$r $$i $$o"  ""''')
+      elyxerfound = True
+      logger.info(msg + ' yes')
+    except ImportError:
+      logger.info(msg + ' no')
+      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:
       addToRC(r'''\copier    html       "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
     else:
       # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/

Reply via email to