+ checkProg('a Dot -> Image converter', ['dot'],
+ rc_entry = [
+ r'''\converter dot eps "dot -Teps $$i -o $$o" ""
+\converter dot png "dot -Tpng $$i -o $$o" ""''',
+ ''])
+ #
+ checkProg('a Dia -> PNG converter', ['dia -e $$o -t png $$i'],
+ rc_entry = [ r'\converter dia png "%%" ""'])
+ #
+ checkProg('a Dia -> EPS converter', ['dia -e $$o -t eps $$i'],
+ rc_entry = [ r'\converter dia eps "%%" ""'])
+ #
+ checkProg('a SVG -> PDF converter', ['rsvg-convert -f pdf -o $$o $$i', 'inkscape --file=$$p/$$i --export-area-drawing --without-gui --export-pdf=$$p/$$o'],
+ rc_entry = [ r'\converter svg pdf "%%" ""'])
+ #
+ checkProg('a SVG -> EPS converter', ['rsvg-convert -f ps -o $$o $$i', 'inkscape --file=$$p/$$i --export-area-drawing --without-gui --export-eps=$$p/$$o'],
+ rc_entry = [ r'\converter svg eps "%%" ""'])
+ # the PNG export via Inkscape must not have the full path ($$p) for the file
+ checkProg('a SVG -> PNG converter', ['rsvg-convert -f png -o $$o $$i', 'inkscape --without-gui --file=$$i --export-png=$$o'],
+ rc_entry = [ r'\converter svg png "%%" ""'])
+
+ #
+ path, lilypond = checkProg('a LilyPond -> EPS/PDF/PNG converter', ['lilypond'])
+ if (lilypond != ''):
+ version_string = cmdOutput("lilypond --version")
+ match = re.match('GNU LilyPond (\S+)', version_string)
+ if match:
+ 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 -dsafe --ps $$i" ""
+\converter lilypond png "lilypond -dbackend=eps -dsafe --png $$i" ""''')
+ addToRC(r'\converter lilypond pdf "lilypond -dbackend=eps -dsafe --pdf $$i" ""')
+ logger.info('+ 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 --safe $$i" ""
+\converter lilypond png "lilypond -b eps --png $$i" ""''')
+ 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 --safe $$i" ""')
+ logger.info('+ found LilyPond version %s.' % version_number)
+ else:
+ logger.info('+ found LilyPond, but version %s is too old.' % version_number)
+ else:
+ logger.info('+ found LilyPond, but could not extract version number.')
+ #
+ path, lilypond_book = checkProg('a LilyPond book (LaTeX) -> LaTeX converter', ['lilypond-book'])
+ if (lilypond_book != ''):
+ version_string = cmdOutput("lilypond-book --version")
+ match = re.match('^(\S+)$', version_string)
+ if match:
+ 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]) >= 13):
+ addToRC(r'\converter lyxpreview-lytex ppm "python -tt $$s/scripts/lyxpreview-lytex2bitmap.py" ""')
+ if dvipng == "dvipng":
+ addToRC(r'\converter lyxpreview-lytex png "python -tt $$s/scripts/lyxpreview-lytex2bitmap.py" ""')
+ else:
+ addToRC(r'\converter lyxpreview-lytex png "" ""')
+ # Note: The --lily-output-dir flag is required because lilypond-book
+ # does not process input again unless the input has changed,
+ # even if the output format being requested is different. So
+ # once a .eps file exists, lilypond-book won't create a .pdf
+ # even when requested with --pdf. This is a problem if a user
+ # clicks View PDF after having done a View DVI. To circumvent
+ # this, use different output folders for eps and pdf outputs.
+ addToRC(r'\converter lilypond-book latex "lilypond-book --safe --lily-output-dir=ly-eps $$i" ""')
+ addToRC(r'\converter lilypond-book pdflatex "lilypond-book --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$i" ""')
+ logger.info('+ found LilyPond-book version %s.' % version_number)
+ else:
+ logger.info('+ found LilyPond-book, but version %s is too old.' % version_number)
+ else:
+ logger.info('+ found LilyPond-book, but could not extract version number.')
+ #
+ checkProg('a Noteedit -> LilyPond converter', ['noteedit --export-lilypond $$i'],
+ rc_entry = [ r'\converter noteedit lilypond "%%" ""', ''])