Alex Fernandez wrote: > > They will appear if you define a viewer for them. But since they are both > > intermediate formats (contrary to XHTML), no viewer is defined by > > default. > > So removing the viewer for xhtml the menu entry will disappear?
It is supposed to, yes. > >> Why not let us know what you are thinking? Apart from getting the > >> thread on-topic again, I might even be able to help with the Python > >> part. And also working on someone else's project might get my karma > >> back to what it was before this stupid discussion XD > > > > What information is missing? I'll be happy to share my ideas and my code. > > I did that once, a while back, and your response was that you're not > > interested. > > Sorry for that. I am indeed interested, but I probably did not > understand it well (and the C++ is definitely over my head). Do you > need any help with the Python part? Yes, help with the Python part (or any other part of the code) is very much appreciated, since it turns out to be a rather complicated undertaking. I'm also grateful for any suggestion how to improve the GUI. Last time I touched it, I struggled with the converter chain. I do not understand very well that part of the code, and the converter needs to be rewritten to allow for multiple chains to a given format. I tried to implement a "via" flag for this purpose, but it does not work yet. The idea is that you can call instead of (now) "convert(from, to)" "convert(from, to, via)" (e.g., "convert(latex, html, htlatex)" or "convert(latex, html, latex2html)"). The via flag is basically a unique identifier of the converter. This allows to activate the htlatex and latex2html converters in parallel, without the need of a html2 file format. Attached is the current state of the work. It detects the converters and adds them as converter_alternatives, while suggesting a (usually, but not always sensible) "via" flag derived from the command. The alternatives are displayed in the GUI and can be (de)activated. However, they cannot be used yet. Currently. conversion is broken. If anybody feels like making his hands dirty, please do not hesitate to do so. Jürgen
Index: lib/configure.py =================================================================== --- lib/configure.py (Revision 31761) +++ lib/configure.py (Arbeitskopie) @@ -166,19 +166,19 @@ logger.info(msg + ' yes') # write rc entries for this command if len(rc_entry) == 1: - addToRC(rc_entry[0].replace('%%', ac_prog)) + addToRC(rc_entry[0].replace('%%', ac_prog).replace('$$v', ac_word)) elif len(rc_entry) > 1: - addToRC(rc_entry[idx].replace('%%', ac_prog)) + addToRC(rc_entry[idx].replace('%%', ac_prog).replace('$$v', ac_word)) return [ac_dir, ac_word] # if not successful logger.info(msg + ' no') # write rc entries for 'not found' if len(rc_entry) > 0: # the last one. - addToRC(rc_entry[-1].replace('%%', not_found)) + addToRC(rc_entry[-1].replace('%%', not_found).replace('$$v', "")) return ['', not_found] -def checkProgAlternatives(description, progs, rc_entry = [], alt_rc_entry = [], path = [], not_found = ''): +def checkProgAlternatives(description, progs, rc_entry = [], alt_rc_entry = [""], path = [], not_found = ''): ''' The same as checkProg, but additionally, all found programs will be added as alt_rc_entries @@ -211,9 +211,9 @@ # write rc entries for this command if found_prime == False: if len(rc_entry) == 1: - addToRC(rc_entry[0].replace('%%', ac_prog)) + addToRC(rc_entry[0].replace('%%', ac_prog).replace('$$v', ac_word)) elif len(rc_entry) > 1: - addToRC(rc_entry[idx].replace('%%', ac_prog)) + addToRC(rc_entry[idx].replace('%%', ac_prog).replace('$$v', ac_word)) real_ac_dir = ac_dir real_ac_word = ac_word found_prime = True @@ -224,7 +224,7 @@ m = pr.match(rc_entry[0]) if m: alt_rc = m.group(1) + "_alternatives" + m.group(2) - addToRC(alt_rc.replace('%%', ac_prog)) + addToRC(alt_rc.replace('%%', ac_prog).replace('$$v', ac_word)) elif len(alt_rc_entry) > 1: alt_rc = alt_rc_entry[idx] if alt_rc == "": @@ -232,7 +232,7 @@ m = pr.match(rc_entry[idx]) if m: alt_rc = m.group(1) + "_alternatives" + m.group(2) - addToRC(alt_rc.replace('%%', ac_prog)) + addToRC(alt_rc.replace('%%', ac_prog).replace('$$v', ac_word)) found_alt = True break if found_alt: @@ -244,7 +244,7 @@ return [real_ac_dir, real_ac_word] # write rc entries for 'not found' if len(rc_entry) > 0: # the last one. - addToRC(rc_entry[-1].replace('%%', not_found)) + addToRC(rc_entry[-1].replace('%%', not_found).replace('$$v', "")) return ['', not_found] @@ -391,7 +391,7 @@ # run platex on chklatex.ltx and check result if cmdOutput(PLATEX + ' chklatex.ltx').find('pLaTeX2e') != -1: # We have the Japanese pLaTeX2e - addToRC(r'\converter platex dvi "%s" "latex"' % PLATEX) + addToRC(r'\converter platex dvi "%s" "latex" "platex"' % PLATEX) LATEX = PLATEX else: PLATEX = '' @@ -402,10 +402,10 @@ PPLATEX = LATEX if dtl_tools: # Windows only: DraftDVI - addToRC(r'''\converter latex dvi2 "%s" "latex" -\converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""''' % PPLATEX) + addToRC(r'''\converter latex dvi2 "%s" "latex" "latex" +\converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" "" "clean_dvi"''' % PPLATEX) else: - addToRC(r'\converter latex dvi "%s" "latex"' % PPLATEX) + addToRC(r'\converter latex dvi "%s" "latex" "latex"' % PPLATEX) # no latex if LATEX != '': # Check if latex is usable @@ -569,10 +569,10 @@ def checkConverterEntries(): ''' Check all converters (\converter entries) ''' checkProg('the pdflatex program', ['pdflatex $$i'], - rc_entry = [ r'\converter pdflatex pdf2 "%%" "latex"' ]) + rc_entry = [ r'\converter pdflatex pdf2 "%%" "latex" "$$v"' ]) checkProg('XeTeX', ['xelatex $$i'], - rc_entry = [ r'\converter xetex pdf4 "%%" "latex"' ]) + rc_entry = [ r'\converter xetex pdf4 "%%" "latex" "$$v"' ]) ''' If we're running LyX in-place then tex2lyx will be found in ../src/tex2lyx. Add this directory to the PATH temporarily and @@ -583,134 +583,134 @@ os.environ["PATH"] = os.path.join('..', 'src', 'tex2lyx') + \ os.pathsep + path_orig - checkProg('a LaTeX/Noweb -> LyX converter', ['tex2lyx', 'tex2lyx' + version_suffix], - rc_entry = [r'''\converter latex lyx "%% -f $$i $$o" "" -\converter literate lyx "%% -n -f $$i $$o" ""''']) + checkProgAlternatives('a LaTeX/Noweb -> LyX converter', ['tex2lyx', 'tex2lyx' + version_suffix], + rc_entry = [r'''\converter latex lyx "%% -f $$i $$o" "" "$$v" +\converter literate lyx "%% -n -f $$i $$o" "" "$$v"''']) os.environ["PATH"] = path_orig # checkProg('a Noweb -> LaTeX converter', ['noweave -delay -index $$i > $$o'], - rc_entry = [r'''\converter literate latex "%%" "" -\converter literate pdflatex "%%" ""''']) + rc_entry = [r'''\converter literate latex "%%" "" "$$v" +\converter literate pdflatex "%%" "" "$$v"''']) # checkProg('a Sweave -> LaTeX converter', ['R CMD Sweave $$i'], - rc_entry = [r'''\converter sweave latex "%%" "" -\converter sweave pdflatex "%%" ""''']) + rc_entry = [r'''\converter sweave latex "%%" "" "$$v" +\converter sweave pdflatex "%%" "" "$$v"''']) # - checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex $$i', \ + checkProgAlternatives('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex $$i', \ 'htmltolatex -input $$i -output $$o', 'java -jar htmltolatex.jar -input $$i -output $$o'], - rc_entry = [ r'\converter html latex "%%" ""' ]) + rc_entry = [ r'\converter html latex "%%" "" "$$v"' ]) # checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'], - rc_entry = [ r'\converter word latex "%%" ""' ]) + rc_entry = [ r'\converter word latex "%%" "" "$$v"' ]) # - 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" ""' ]) + path, elyxer = checkProgAlternatives('a LyX -> HTML converter', ['elyxer.py', 'elyxer'], + rc_entry = [ r'\converter lyx html "python -tt $$s/scripts/elyxer.py --directory $$r $$i $$o" "" "$$v"' ]) if elyxer.find('elyxer') >= 0: 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/ - path, htmlconv = checkProg('a LaTeX -> HTML converter', ['htlatex $$i', 'htlatex.sh $$i', \ + path, htmlconv = checkProgAlternatives('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'], - rc_entry = [ r'\converter latex html "%%" "needaux"' ]) + rc_entry = [ r'\converter latex html "%%" "needaux" "$$v"' ]) 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"''') else: addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py $$i $$o"''') # 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'", \ + path, htmlconv = checkProgAlternatives('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"' ]) + rc_entry = [ r'\converter latex wordhtml "%%" "needaux" "$$v"' ]) 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 "%%" ""' ]) + rc_entry = [ r'\converter sxw latex "%%" "" "$$v"' ]) # checkProg('an OpenDocument -> LaTeX converter', ['w2l -clean $$i'], - rc_entry = [ r'\converter odt latex "%%" ""' ]) + rc_entry = [ r'\converter odt latex "%%" "" "$$v"' ]) # According to http://www.tug.org/applications/tex4ht/mn-commands.html # the command mk4ht oolatex $$i has to be used as default, # but as this would require to have Perl installed, in MiKTeX oolatex is # directly available as application. # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/ # Both SuSE and debian have oolatex - checkProg('a LaTeX -> Open Document converter', [ + checkProgAlternatives('a LaTeX -> Open Document converter', [ 'oolatex $$i', 'mk4ht oolatex $$i', 'oolatex.sh $$i', '/usr/share/tex4ht/oolatex $$i', 'htlatex $$i \'xhtml,ooffice\' \'ooffice/! -cmozhtf\' \'-coo\' \'-cvalidate\''], - rc_entry = [ r'\converter latex odt "%%" "needaux"' ]) + rc_entry = [ r'\converter latex odt "%%" "needaux" "$$v"' ]) # On windows it is called latex2rt.exe - checkProg('a LaTeX -> RTF converter', ['latex2rtf -p -S -o $$o $$i', 'latex2rt -p -S -o $$o $$i'], - rc_entry = [ r'\converter latex rtf "%%" "needaux"' ]) + checkProgAlternatives('a LaTeX -> RTF converter', ['latex2rtf -p -S -o $$o $$i', 'latex2rt -p -S -o $$o $$i'], + rc_entry = [ r'\converter latex rtf "%%" "needaux" "$$v"' ]) # checkProg('a RTF -> HTML converter', ['unrtf --html $$i > $$o'], - rc_entry = [ r'\converter rtf html "%%" ""' ]) + rc_entry = [ r'\converter rtf html "%%" "" "$$v"' ]) # checkProg('a PS to PDF converter', ['ps2pdf13 $$i $$o'], - rc_entry = [ r'\converter ps pdf "%%" ""' ]) + rc_entry = [ r'\converter ps pdf "%%" "" "$$v"' ]) # checkProg('a PS to TXT converter', ['pstotext $$i > $$o'], - rc_entry = [ r'\converter ps text2 "%%" ""' ]) + rc_entry = [ r'\converter ps text2 "%%" "" "$$v"' ]) # checkProg('a PS to TXT converter', ['ps2ascii $$i $$o'], - rc_entry = [ r'\converter ps text3 "%%" ""' ]) + rc_entry = [ r'\converter ps text3 "%%" "" "$$v"' ]) # checkProg('a PS to EPS converter', ['ps2eps $$i'], - rc_entry = [ r'\converter ps eps "%%" ""' ]) + rc_entry = [ r'\converter ps eps "%%" "" "$$v"' ]) # - checkProg('a PDF to PS converter', ['pdf2ps $$i $$o', 'pdftops $$i $$o'], - rc_entry = [ r'\converter pdf ps "%%" ""' ]) + checkProgAlternatives('a PDF to PS converter', ['pdf2ps $$i $$o', 'pdftops $$i $$o'], + rc_entry = [ r'\converter pdf ps "%%" "" "$$v"' ]) # checkProg('a PDF to EPS converter', ['pdftops -eps -f 1 -l 1 $$i $$o'], - rc_entry = [ r'\converter pdf eps "%%" ""' ]) + rc_entry = [ r'\converter pdf eps "%%" "" "$$v"' ]) # checkProg('a DVI to TXT converter', ['catdvi $$i > $$o'], - rc_entry = [ r'\converter dvi text4 "%%" ""' ]) + rc_entry = [ r'\converter dvi text4 "%%" "" "$$v"' ]) # checkProg('a DVI to PS converter', ['dvips -o $$o $$i'], - rc_entry = [ r'\converter dvi ps "%%" ""' ]) + rc_entry = [ r'\converter dvi ps "%%" "" "$$v"' ]) # - checkProg('a DVI to PDF converter', ['dvipdfmx -o $$o $$i', 'dvipdfm -o $$o $$i'], - rc_entry = [ r'\converter dvi pdf3 "%%" ""' ]) + checkProgAlternatives('a DVI to PDF converter', ['dvipdfmx -o $$o $$i', 'dvipdfm -o $$o $$i'], + rc_entry = [ r'\converter dvi pdf3 "%%" "" "$$v"' ]) # path, dvipng = checkProg('dvipng', ['dvipng']) if dvipng == "dvipng": - addToRC(r'\converter lyxpreview png "python -tt $$s/scripts/lyxpreview2bitmap.py" ""') + addToRC(r'\converter lyxpreview png "python -tt $$s/scripts/lyxpreview2bitmap.py" "" "$$v"') else: - addToRC(r'\converter lyxpreview png "" ""') + addToRC(r'\converter lyxpreview png "" "" "$$v"') # - checkProg('a fax program', ['kdeprintfax $$i', 'ksendfax $$i', 'hylapex $$i'], - rc_entry = [ r'\converter ps fax "%%" ""']) + checkProgAlternatives('a fax program', ['kdeprintfax $$i', 'ksendfax $$i', 'hylapex $$i'], + rc_entry = [ r'\converter ps fax "%%" "" "$$v"']) # checkProg('a FIG -> EPS/PPM converter', ['fig2dev'], rc_entry = [ - r'''\converter fig eps "fig2dev -L eps $$i $$o" "" -\converter fig ppm "fig2dev -L ppm $$i $$o" "" -\converter fig png "fig2dev -L png $$i $$o" ""''', + r'''\converter fig eps "fig2dev -L eps $$i $$o" "" "$$v" +\converter fig ppm "fig2dev -L ppm $$i $$o" "" "$$v" +\converter fig png "fig2dev -L png $$i $$o" "" "$$v"''', '']) # checkProg('a TIFF -> PS converter', ['tiff2ps $$i > $$o'], - rc_entry = [ r'\converter tiff eps "%%" ""', '']) + rc_entry = [ r'\converter tiff eps "%%" "" "$$v"', '']) # checkProg('a TGIF -> EPS/PPM converter', ['tgif'], rc_entry = [ r'''\converter tgif eps "tgif -print -color -eps -stdout $$i > $$o" "" -\converter tgif png "tgif -print -color -png -o $$d $$i" "" -\converter tgif pdf "tgif -print -color -pdf -stdout $$i > $$o" ""''', +\converter tgif png "tgif -print -color -png -o $$d $$i" "" "$$v" +\converter tgif pdf "tgif -print -color -pdf -stdout $$i > $$o" "" "$$v"''', '']) # - checkProg('a WMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i'], - rc_entry = [ r'\converter wmf eps "%%" ""']) + checkProgAlternatives('a WMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i'], + rc_entry = [ r'\converter wmf eps "%%" "" "$$v"']) # - checkProg('an EMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i'], - rc_entry = [ r'\converter emf eps "%%" ""']) + checkProgAlternatives('an EMF -> EPS converter', ['metafile2eps $$i $$o', 'wmf2eps -o $$o $$i'], + rc_entry = [ r'\converter emf eps "%%" "" "$$v"']) # checkProg('an EPS -> PDF converter', ['epstopdf'], - rc_entry = [ r'\converter eps pdf "epstopdf --outfile=$$o $$i" ""', '']) + rc_entry = [ r'\converter eps pdf "epstopdf --outfile=$$o $$i" "" "$$v"', '']) # # no agr -> pdf converter, since the pdf library used by gracebat is not # free software and therefore not compiled in in many installations. @@ -718,20 +718,20 @@ # convert from agr to pdf via eps without loss of quality. checkProg('a Grace -> Image converter', ['gracebat'], rc_entry = [ - r'''\converter agr eps "gracebat -hardcopy -printfile $$o -hdevice EPS $$i 2>/dev/null" "" -\converter agr png "gracebat -hardcopy -printfile $$o -hdevice PNG $$i 2>/dev/null" "" -\converter agr jpg "gracebat -hardcopy -printfile $$o -hdevice JPEG $$i 2>/dev/null" "" -\converter agr ppm "gracebat -hardcopy -printfile $$o -hdevice PNM $$i 2>/dev/null" ""''', + r'''\converter agr eps "gracebat -hardcopy -printfile $$o -hdevice EPS $$i 2>/dev/null" "" "$$v" +\converter agr png "gracebat -hardcopy -printfile $$o -hdevice PNG $$i 2>/dev/null" "" "$$v" +\converter agr jpg "gracebat -hardcopy -printfile $$o -hdevice JPEG $$i 2>/dev/null" "" "$$v" +\converter agr ppm "gracebat -hardcopy -printfile $$o -hdevice PNM $$i 2>/dev/null" "" "$$v"''', '']) # checkProg('a Dot -> PDF converter', ['dot -Tpdf $$i -o $$o'], - rc_entry = [ r'\converter dot pdf "%%" ""']) + rc_entry = [ r'\converter dot pdf "%%" "" "$$v"']) # checkProg('a Dia -> PNG converter', ['dia -e $$o -t png $$i'], - rc_entry = [ r'\converter dia png "%%" ""']) + rc_entry = [ r'\converter dia png "%%" "" "$$v"']) # checkProg('a Dia -> EPS converter', ['dia -e $$o -t eps $$i'], - rc_entry = [ r'\converter dia eps "%%" ""']) + rc_entry = [ r'\converter dia eps "%%" "" "$$v"']) # # path, lilypond = checkProg('a LilyPond -> EPS/PDF/PNG converter', ['lilypond']) @@ -742,15 +742,15 @@ version_number = match.groups()[0] version = version_number.split('.') if int(version[0]) > 2 or (len(version) > 1 and int(version[0]) == 2 and int(version[1]) >= 11): - addToRC(r'''\converter lilypond eps "lilypond -dbackend=eps --ps $$i" "" -\converter lilypond png "lilypond -dbackend=eps --png $$i" ""''') - addToRC(r'\converter lilypond pdf "lilypond -dbackend=eps --pdf $$i" ""') + addToRC(r'''\converter lilypond eps "lilypond -dbackend=eps --ps $$i" "" "lilypond" +\converter lilypond png "lilypond -dbackend=eps --png $$i" "" "$$v"''') + addToRC(r'\converter lilypond pdf "lilypond -dbackend=eps --pdf $$i" "" "lilypond"') print '+ found LilyPond version %s.' % version_number elif int(version[0]) > 2 or (len(version) > 1 and int(version[0]) == 2 and int(version[1]) >= 6): - addToRC(r'''\converter lilypond eps "lilypond -b eps --ps $$i" "" -\converter lilypond png "lilypond -b eps --png $$i" ""''') + addToRC(r'''\converter lilypond eps "lilypond -b eps --ps $$i" "" "lilypond" +\converter lilypond png "lilypond -b eps --png $$i" "" "$$v"''') if int(version[0]) > 2 or (len(version) > 1 and int(version[0]) == 2 and int(version[1]) >= 9): - addToRC(r'\converter lilypond pdf "lilypond -b eps --pdf $$i" ""') + addToRC(r'\converter lilypond pdf "lilypond -b eps --pdf $$i" "" "lilypond"') logger.info('+ found LilyPond version %s.' % version_number) else: logger.info('+ found LilyPond, but version %s is too old.' % version_number) @@ -758,45 +758,45 @@ logger.info('+ found LilyPond, but could not extract version number.') # checkProg('a Noteedit -> LilyPond converter', ['noteedit --export-lilypond $$i'], - rc_entry = [ r'\converter noteedit lilypond "%%" ""', '']) + rc_entry = [ r'\converter noteedit lilypond "%%" "" "$$v"', '']) # # FIXME: no rc_entry? comment it out # checkProg('Image converter', ['convert $$i $$o']) # # Entries that do not need checkProg - addToRC(r'''\converter lyxpreview ppm "python -tt $$s/scripts/lyxpreview2bitmap.py" "" -\converter lyxpreview-platex ppm "python -tt $$s/scripts/lyxpreview-platex2bitmap.py" "" -\converter csv lyx "python -tt $$s/scripts/csv2lyx.py $$i $$o" "" -\converter date dateout "python -tt $$s/scripts/date.py %d-%m-%Y > $$o" "" -\converter docbook docbook-xml "cp $$i $$o" "xml" -\converter fen asciichess "python -tt $$s/scripts/fen2ascii.py $$i $$o" "" -\converter fig pdftex "python -tt $$s/scripts/fig2pdftex.py $$i $$o" "" -\converter fig pstex "python -tt $$s/scripts/fig2pstex.py $$i $$o" "" -\converter lyx lyx13x "python -tt $$s/lyx2lyx/lyx2lyx -t 221 $$i > $$o" "" -\converter lyx lyx14x "python -tt $$s/lyx2lyx/lyx2lyx -t 245 $$i > $$o" "" -\converter lyx lyx15x "python -tt $$s/lyx2lyx/lyx2lyx -t 276 $$i > $$o" "" -\converter lyx lyx16x "python -tt $$s/lyx2lyx/lyx2lyx -t 345 $$i > $$o" "" -\converter lyx clyx "python -tt $$s/lyx2lyx/lyx2lyx -c big5 -t 245 $$i > $$o" "" -\converter lyx jlyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_jp -t 245 $$i > $$o" "" -\converter lyx klyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_kr -t 245 $$i > $$o" "" -\converter clyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c big5 $$i > $$o" "" -\converter jlyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_jp $$i > $$o" "" -\converter klyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_kr $$i > $$o" "" + addToRC(r'''\converter lyxpreview ppm "python -tt $$s/scripts/lyxpreview2bitmap.py" "" "lyxpreview2bitmap" +\converter lyxpreview-platex ppm "python -tt $$s/scripts/lyxpreview-platex2bitmap.py" "" "lyxpreview2bitmap" +\converter csv lyx "python -tt $$s/scripts/csv2lyx.py $$i $$o" "" "csv2lyx" +\converter date dateout "python -tt $$s/scripts/date.py %d-%m-%Y > $$o" "" "date" +\converter docbook docbook-xml "cp $$i $$o" "xml" "cp" +\converter fen asciichess "python -tt $$s/scripts/fen2ascii.py $$i $$o" "" "fen2ascii" +\converter fig pdftex "python -tt $$s/scripts/fig2pdftex.py $$i $$o" "" "fig2pdftex" +\converter fig pstex "python -tt $$s/scripts/fig2pstex.py $$i $$o" "" "fig2pstex" +\converter lyx lyx13x "python -tt $$s/lyx2lyx/lyx2lyx -t 221 $$i > $$o" "" "lyx2lyx" +\converter lyx lyx14x "python -tt $$s/lyx2lyx/lyx2lyx -t 245 $$i > $$o" "" "lyx2lyx" +\converter lyx lyx15x "python -tt $$s/lyx2lyx/lyx2lyx -t 276 $$i > $$o" "" "lyx2lyx" +\converter lyx lyx16x "python -tt $$s/lyx2lyx/lyx2lyx -t 345 $$i > $$o" "" "lyx2lyx" +\converter lyx clyx "python -tt $$s/lyx2lyx/lyx2lyx -c big5 -t 245 $$i > $$o" "" "lyx2lyx" +\converter lyx jlyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_jp -t 245 $$i > $$o" "" "lyx2lyx" +\converter lyx klyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_kr -t 245 $$i > $$o" "" "lyx2lyx" +\converter clyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c big5 $$i > $$o" "" "lyx2lyx" +\converter jlyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_jp $$i > $$o" "" "lyx2lyx" +\converter klyx lyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_kr $$i > $$o" "" "lyx2lyx" ''') def checkDocBook(): ''' Check docbook ''' - path, DOCBOOK = checkProg('SGML-tools 2.x (DocBook), db2x scripts or xsltproc', ['sgmltools', 'db2dvi', 'xsltproc'], + path, DOCBOOK = checkProgAlternatives('SGML-tools 2.x (DocBook), db2x scripts or xsltproc', ['sgmltools', 'db2dvi', 'xsltproc'], rc_entry = [ - r'''\converter docbook dvi "sgmltools -b dvi $$i" "" -\converter docbook html "sgmltools -b html $$i" ""''', - r'''\converter docbook dvi "db2dvi $$i" "" -\converter docbook html "db2html $$i" ""''', - r'''\converter docbook dvi "" "" -\converter docbook html "" ""''', - r'''\converter docbook dvi "" "" -\converter docbook html "" ""''']) + r'''\converter docbook dvi "sgmltools -b dvi $$i" "" "$$v" +\converter docbook html "sgmltools -b html $$i" "" "$$v"''', + r'''\converter docbook dvi "db2dvi $$i" "" "$$v" +\converter docbook html "db2html $$i" "" "$$v"''', + r'''\converter docbook dvi "" "" "$$v" +\converter docbook html "" "" "$$v"''', + r'''\converter docbook dvi "" "" "$$v" +\converter docbook html "" "" "$$v"''']) # if DOCBOOK != '': return ('yes', 'true', '\\def\\hasdocbook{yes}') Index: src/LyXRC.h =================================================================== --- src/LyXRC.h (Revision 31761) +++ src/LyXRC.h (Arbeitskopie) @@ -62,6 +62,7 @@ RC_COMPLETION_POPUP_TEXT, RC_COMPLETION_POPUP_AFTER_COMPLETE, RC_CONVERTER, + RC_CONVERTER_ALTERNATIVES, RC_CONVERTER_CACHE_MAXAGE, RC_COPIER, RC_CURSOR_FOLLOWS_SCROLLBAR, Index: src/Converter.h =================================================================== --- src/Converter.h (Revision 31761) +++ src/Converter.h (Arbeitskopie) @@ -34,8 +34,8 @@ class Converter { public: /// - Converter(std::string const & f, std::string const & t, std::string const & c, - std::string const & l); + Converter(std::string const & f, std::string const & t, std::string const & v, + std::string const & c, std::string const & l, bool active = true); /// void readFlags(); /// @@ -43,10 +43,14 @@ /// std::string to; /// + std::string via; + /// std::string command; /// std::string flags; /// + bool active; + /// Format const * From; /// Format const * To; @@ -81,14 +85,18 @@ Converter const & get(int i) const { return converterlist_[i]; } /// Converter const * getConverter(std::string const & from, - std::string const & to) const; + std::string const & to, + std::string const & via = std::string()) const; /// - int getNumber(std::string const & from, std::string const & to) const; + int getNumber(std::string const & from, std::string const & to, + std::string const & via = std::string()) const; /// void add(std::string const & from, std::string const & to, - std::string const & command, std::string const & flags); + std::string const & via, std::string const & command, + std::string const & flags, bool active = true); // - void erase(std::string const & from, std::string const & to); + void erase(std::string const & from, std::string const & to, + std::string const & via); /// void sort(); /// Index: src/Converter.cpp =================================================================== --- src/Converter.cpp (Revision 31761) +++ src/Converter.cpp (Arbeitskopie) @@ -79,22 +79,26 @@ class ConverterEqual { public: - ConverterEqual(string const & from, string const & to) - : from_(from), to_(to) {} + ConverterEqual(string const & from, string const & to, string const & via) + : from_(from), to_(to), via_(via) {} bool operator()(Converter const & c) const { - return c.from == from_ && c.to == to_; + return c.from == from_ && c.to == to_ + && (c.via == via_ || via_.empty()); } private: string const from_; string const to_; + string const via_; }; } // namespace anon Converter::Converter(string const & f, string const & t, - string const & c, string const & l) - : from(f), to(t), command(c), flags(l), + string const & v, string const & c, + string const & l, bool active) + : from(f), to(t), via(v), command(c), flags(l), + active(active), From(0), To(0), latex(false), xml(false), need_aux(false) {} @@ -144,11 +148,12 @@ Converter const * Converters::getConverter(string const & from, - string const & to) const + string const & to, + string const & via) const { ConverterList::const_iterator const cit = find_if(converterlist_.begin(), converterlist_.end(), - ConverterEqual(from, to)); + ConverterEqual(from, to, via)); if (cit != converterlist_.end()) return &(*cit); else @@ -156,11 +161,12 @@ } -int Converters::getNumber(string const & from, string const & to) const +int Converters::getNumber(string const & from, string const & to, + string const & via) const { ConverterList::const_iterator const cit = find_if(converterlist_.begin(), converterlist_.end(), - ConverterEqual(from, to)); + ConverterEqual(from, to, via)); if (cit != converterlist_.end()) return distance(converterlist_.begin(), cit); else @@ -168,16 +174,17 @@ } -void Converters::add(string const & from, string const & to, - string const & command, string const & flags) +void Converters::add(string const & from, string const & to, string const & via, + string const & command, string const & flags, + bool const active) { formats.add(from); formats.add(to); ConverterList::iterator it = find_if(converterlist_.begin(), converterlist_.end(), - ConverterEqual(from , to)); + ConverterEqual(from , to, via)); - Converter converter(from, to, command, flags); + Converter converter(from, to, via, command, flags, active); if (it != converterlist_.end() && !flags.empty() && flags[0] == '*') { converter = *it; converter.command = command; @@ -201,12 +208,12 @@ } -void Converters::erase(string const & from, string const & to) +void Converters::erase(string const & from, string const & to, string const & via) { ConverterList::iterator const it = find_if(converterlist_.begin(), converterlist_.end(), - ConverterEqual(from, to)); + ConverterEqual(from, to, via)); if (it != converterlist_.end()) converterlist_.erase(it); } @@ -639,9 +646,11 @@ ConverterList::iterator beg = converterlist_.begin(); ConverterList::iterator const end = converterlist_.end(); for (ConverterList::iterator it = beg; it != end ; ++it) { - int const s = formats.getNumber(it->from); - int const t = formats.getNumber(it->to); - G_.addEdge(s,t); + if (it->active) { + int const s = formats.getNumber(it->from); + int const t = formats.getNumber(it->to); + G_.addEdge(s,t); + } } } Index: src/frontends/qt4/GuiPrefs.cpp =================================================================== --- src/frontends/qt4/GuiPrefs.cpp (Revision 31761) +++ src/frontends/qt4/GuiPrefs.cpp (Arbeitskopie) @@ -1348,6 +1348,10 @@ this, SLOT(changeConverter())); connect(converterFlagED, SIGNAL(textEdited(QString)), this, SLOT(changeConverter())); + connect(viaED, SIGNAL(textEdited(QString)), + this, SLOT(changeConverter())); + connect(activeCB, SIGNAL(clicked()), + this, SLOT(changeConverter())); connect(converterNewPB, SIGNAL(clicked()), this, SIGNAL(changed())); connect(converterRemovePB, SIGNAL(clicked()), @@ -1385,6 +1389,9 @@ // save current selection QString current = converterFromCO->currentText() + " -> " + converterToCO->currentText(); + docstring via = qstring_to_ucs4(viaED->text()); + if (!via.empty()) + current += toqstr(bformat(_(" (via %1$s)"), via)); converterFromCO->clear(); converterToCO->clear(); @@ -1404,9 +1411,12 @@ Converters::const_iterator ccit = form_->converters().begin(); Converters::const_iterator cend = form_->converters().end(); for (; ccit != cend; ++ccit) { - QString const name = + QString name = qt_(ccit->From->prettyname()) + " -> " + qt_(ccit->To->prettyname()); - int type = form_->converters().getNumber(ccit->From->name(), ccit->To->name()); + if (!ccit->via.empty()) + name += toqstr(bformat(_(" (via %1$s)"), from_utf8(ccit->via))); + int type = form_->converters().getNumber( + ccit->From->name(), ccit->To->name(), ccit->via); new QListWidgetItem(name, convertersLW, type); } convertersLW->sortItems(Qt::AscendingOrder); @@ -1436,6 +1446,8 @@ converterToCO->setCurrentIndex(form_->formats().getNumber(c.to)); converterED->setText(toqstr(c.command)); converterFlagED->setText(toqstr(c.flags)); + viaED->setText(toqstr(c.via)); + activeCB->setChecked(c.active); updateButtons(); } @@ -1460,10 +1472,15 @@ Converter const & c = form_->converters().get(cnr); string const old_command = c.command; string const old_flag = c.flags; + string const old_via = c.via; + bool const old_active = c.active; string const new_command = fromqstr(converterED->text()); string const new_flag = fromqstr(converterFlagED->text()); + string const new_via = fromqstr(viaED->text()); + bool const new_active = activeCB->isChecked(); - bool modified = (old_command != new_command || old_flag != new_flag); + bool modified = (old_command != new_command || old_flag != new_flag + || old_via != new_via|| old_active != new_active); converterModifyPB->setEnabled(valid && known && modified); converterNewPB->setEnabled(valid && !known); @@ -1481,12 +1498,14 @@ { Format const & from = form_->formats().get(converterFromCO->currentIndex()); Format const & to = form_->formats().get(converterToCO->currentIndex()); + string const via = fromqstr(viaED->text()); string const flags = fromqstr(converterFlagED->text()); string const command = fromqstr(converterED->text()); + bool const active = activeCB->isChecked(); Converter const * old = - form_->converters().getConverter(from.name(), to.name()); - form_->converters().add(from.name(), to.name(), command, flags); + form_->converters().getConverter(from.name(), to.name(), via); + form_->converters().add(from.name(), to.name(), via, command, flags, active); if (!old) form_->converters().updateLast(form_->formats()); @@ -1503,7 +1522,8 @@ { Format const & from = form_->formats().get(converterFromCO->currentIndex()); Format const & to = form_->formats().get(converterToCO->currentIndex()); - form_->converters().erase(from.name(), to.name()); + string const via = fromqstr(viaED->text()); + form_->converters().erase(from.name(), to.name(), via); updateGui(); Index: src/frontends/qt4/ui/PrefConvertersUi.ui =================================================================== --- src/frontends/qt4/ui/PrefConvertersUi.ui (Revision 31761) +++ src/frontends/qt4/ui/PrefConvertersUi.ui (Arbeitskopie) @@ -5,8 +5,8 @@ <rect> <x>0</x> <y>0</y> - <width>438</width> - <height>466</height> + <width>380</width> + <height>483</height> </rect> </property> <property name="windowTitle" > @@ -19,6 +19,64 @@ <property name="spacing" > <number>6</number> </property> + <item row="1" column="0" > + <widget class="QGroupBox" name="cacheGB" > + <property name="title" > + <string>Converter File Cache</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QCheckBox" name="cacheCB" > + <property name="text" > + <string>&Enabled</string> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="maxAgeLA" > + <property name="text" > + <string>Maximum A&ge (in days):</string> + </property> + <property name="buddy" > + <cstring>maxAgeLE</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="maxAgeLE" /> + </item> + </layout> + </item> + </layout> + </widget> + </item> <item row="0" column="0" > <widget class="QGroupBox" name="converterDefGB" > <property name="title" > @@ -31,18 +89,6 @@ <property name="spacing" > <number>6</number> </property> - <item row="1" column="0" > - <widget class="QListWidget" name="convertersLW" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>7</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> <item row="3" column="0" colspan="2" > <layout class="QGridLayout" > <property name="margin" > @@ -51,22 +97,6 @@ <property name="spacing" > <number>6</number> </property> - <item row="0" column="1" > - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLineEdit" name="converterED" /> - </item> - <item> - <widget class="QLineEdit" name="converterFlagED" /> - </item> - </layout> - </item> <item row="0" column="0" > <layout class="QVBoxLayout" > <property name="margin" > @@ -95,51 +125,19 @@ </property> </widget> </item> - </layout> - </item> - </layout> - </item> - <item row="2" column="0" colspan="2" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> <item> - <widget class="QLabel" name="converterFromLA" > + <widget class="QLabel" name="viaLA" > <property name="text" > - <string>&From format:</string> + <string>Sh&ortcut:</string> </property> <property name="buddy" > - <cstring>converterFromCO</cstring> + <cstring>viaED</cstring> </property> </widget> </item> - <item> - <widget class="QComboBox" name="converterFromCO" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>3</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> </layout> </item> - <item> + <item row="0" column="1" > <layout class="QVBoxLayout" > <property name="margin" > <number>0</number> @@ -148,31 +146,60 @@ <number>6</number> </property> <item> - <widget class="QLabel" name="converterToLA" > - <property name="text" > - <string>&To format:</string> - </property> - <property name="buddy" > - <cstring>converterToCO</cstring> - </property> - </widget> + <widget class="QLineEdit" name="converterED" /> </item> <item> - <widget class="QComboBox" name="converterToCO" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>3</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QLineEdit" name="converterFlagED" /> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> </property> - </widget> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLineEdit" name="viaED" > + <property name="toolTip" > + <string>Shortcut to identify alternative converters</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="activeCB" > + <property name="toolTip" > + <string>Enable/disable this converter</string> + </property> + <property name="text" > + <string>Act&ive</string> + </property> + </widget> + </item> + </layout> </item> </layout> </item> </layout> </item> + <item row="0" column="0" colspan="2" > + <widget class="QLabel" name="label" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Converter Defi&nitions</string> + </property> + <property name="buddy" > + <cstring>convertersLW</cstring> + </property> + </widget> + </item> <item row="1" column="1" > <layout class="QVBoxLayout" > <property name="margin" > @@ -225,40 +252,7 @@ </item> </layout> </item> - <item row="0" column="0" colspan="2" > - <widget class="QLabel" name="label" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Converter Defi&nitions</string> - </property> - <property name="buddy" > - <cstring>convertersLW</cstring> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="0" > - <widget class="QGroupBox" name="cacheGB" > - <property name="title" > - <string>Converter File Cache</string> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > + <item row="2" column="0" colspan="2" > <layout class="QHBoxLayout" > <property name="margin" > <number>0</number> @@ -267,40 +261,83 @@ <number>6</number> </property> <item> - <widget class="QCheckBox" name="cacheCB" > - <property name="text" > - <string>&Enabled</string> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> + <property name="spacing" > + <number>6</number> </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> + <item> + <widget class="QLabel" name="converterFromLA" > + <property name="text" > + <string>&From format:</string> + </property> + <property name="buddy" > + <cstring>converterFromCO</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="converterFromCO" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> </item> <item> - <widget class="QLabel" name="maxAgeLA" > - <property name="text" > - <string>Maximum A&ge (in days):</string> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> </property> - <property name="buddy" > - <cstring>maxAgeLE</cstring> + <property name="spacing" > + <number>6</number> </property> - </widget> + <item> + <widget class="QLabel" name="converterToLA" > + <property name="text" > + <string>&To format:</string> + </property> + <property name="buddy" > + <cstring>converterToCO</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="converterToCO" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> </item> - <item> - <widget class="QLineEdit" name="maxAgeLE" /> - </item> </layout> </item> + <item row="1" column="0" > + <widget class="QListWidget" name="convertersLW" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> </layout> </widget> </item> Index: src/LyXRC.cpp =================================================================== --- src/LyXRC.cpp (Revision 31761) +++ src/LyXRC.cpp (Arbeitskopie) @@ -78,6 +78,7 @@ { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH }, { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT }, { "\\converter", LyXRC::RC_CONVERTER }, + { "\\converter_alternatives", LyXRC::RC_CONVERTER_ALTERNATIVES }, { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE }, { "\\copier", LyXRC::RC_COPIER }, { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR }, @@ -969,7 +970,8 @@ } case RC_CONVERTER: { - string from, to, command, flags; + string from, to, command, flags, via; + bool active = true; if (lexrc.next()) from = lexrc.getString(); if (lexrc.next()) @@ -978,12 +980,35 @@ command = lexrc.getString(); if (lexrc.next()) flags = lexrc.getString(); + if (lexrc.next(false, false)) + via = lexrc.getString(); + if (lexrc.next(false, false)) + active = lexrc.getBool(); if (command.empty()) - theConverters().erase(from, to); + theConverters().erase(from, to, via); else - theConverters().add(from, to, command, flags); + theConverters().add(from, to, via, command, flags, active); break; } + case RC_CONVERTER_ALTERNATIVES: { + string from, to, command, flags, via; + bool active = false; + if (lexrc.next()) + from = lexrc.getString(); + if (lexrc.next()) + to = lexrc.getString(); + if (lexrc.next(true)) + command = lexrc.getString(); + if (lexrc.next()) + flags = lexrc.getString(); + if (lexrc.next(false, false)) + via = lexrc.getString(); + if (lexrc.next(false, false)) + active = lexrc.getBool(); + if (!command.empty() && (theConverters().getNumber(from, to, via) == -1)) + theConverters().add(from, to, via, command, flags, active); + break; + } // compatibility with versions older than 1.4.0 only case RC_VIEWER: { string format, command; @@ -2563,25 +2588,58 @@ cit != theConverters().end(); ++cit) { Converter const * converter = theSystemConverters().getConverter(cit->from, - cit->to); + cit->to, cit->via); if (!converter || converter->command != cit->command || converter->flags != cit->flags) os << "\\converter \"" << cit->from << "\" \"" << cit->to << "\" \"" << escapeCommand(cit->command) << "\" \"" - << cit->flags << "\"\n"; + << cit->flags << "\" \"" + << cit->via << "\" \"" + << convert<string>(cit->active) << "\"\n"; } // New/modifed converters for (Converters::const_iterator cit = theSystemConverters().begin(); cit != theSystemConverters().end(); ++cit) - if (!theConverters().getConverter(cit->from, cit->to)) + if (!theConverters().getConverter(cit->from, cit->to, cit->via)) os << "\\converter \"" << cit->from - << "\" \"" << cit->to << "\" \"\" \"\"\n"; + << "\" \"" << cit->to << "\" \"\" \"\" \"" + << cit->via << "\" \"" + << convert<string>(cit->active) << "\"\n"; if (tag != RC_LAST) break; + case RC_CONVERTER_ALTERNATIVES: + // Look for new converters + for (Converters::const_iterator cit = theConverters().begin(); + cit != theConverters().end(); ++cit) { + Converter const * converter = + theSystemConverters().getConverter(cit->from, + cit->to); + if (!converter || + converter->command != cit->command || + converter->flags != cit->flags) + os << "\\converter_alternatives \"" << cit->from << "\" \"" + << cit->to << "\" \"" + << escapeCommand(cit->command) << "\" \"" + << cit->flags << "\" \"" + << cit->via << "\" \"" + << convert<string>(cit->active) << "\"\n"; + } + + // New/modifed converters + for (Converters::const_iterator cit = theSystemConverters().begin(); + cit != theSystemConverters().end(); ++cit) + if (!theConverters().getConverter(cit->from, cit->to)) + os << "\\converter_alternatives \"" << cit->from + << "\" \"" << cit->to << "\" \"\" \"\" \"" + << cit->via << "\" \"" + << convert<string>(cit->active) << "\"\n"; + if (tag != RC_LAST) + break; + case RC_COPIER: if (tag == RC_LAST) os << "\n#\n" @@ -2654,6 +2712,7 @@ case LyXRC::RC_LOADSESSION: case LyXRC::RC_CHKTEX_COMMAND: case LyXRC::RC_CONVERTER: + case LyXRC::RC_CONVERTER_ALTERNATIVES: case LyXRC::RC_CONVERTER_CACHE_MAXAGE: case LyXRC::RC_COPIER: case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR: Index: src/Lexer.h =================================================================== --- src/Lexer.h (Revision 31761) +++ src/Lexer.h (Arbeitskopie) @@ -112,8 +112,9 @@ /** Just read the next word. If esc is true remember that some chars might be escaped: "\ at least + If breaklines is false, stop at the end of a line. */ - bool next(bool esc = false); + bool next(bool esc = false, bool breaklines = true); /** Read next token. This one is almost the same as next, but it will consider " as a regular character and always Index: src/Lexer.cpp =================================================================== --- src/Lexer.cpp (Revision 31761) +++ src/Lexer.cpp (Arbeitskopie) @@ -66,7 +66,7 @@ /// void setCommentChar(char c); /// - bool next(bool esc = false); + bool next(bool esc = false, bool breaklines = true); /// int searchKeyword(char const * const tag) const; /// @@ -303,7 +303,7 @@ } -bool Lexer::Pimpl::next(bool esc /* = false */) +bool Lexer::Pimpl::next(bool esc /* = false */, bool breaklines /* = true */) { if (!pushTok.empty()) { // There can have been a whole line pushed so @@ -425,8 +425,11 @@ c = cc; } - if (c == '\n') + if (c == '\n') { + if (!breaklines) + break; ++lineno; + } } if (status) @@ -788,9 +791,9 @@ } -bool Lexer::next(bool esc) +bool Lexer::next(bool esc, bool breaklines) { - return pimpl_->next(esc); + return pimpl_->next(esc, breaklines); }