mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 09:15:50 +00:00
Add lilypond external inset
* src/graphics/GraphicsConverter.C (build_script): Change the current directory to the directory of the output file * src/converter.C (Converters::convert): Add comment * lib/external_templates: Add lilypond template * lib/configure.py (checkFormatEntries): Add lilypond format (checkConverterEntries): Add lilypond converter git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@15260 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0b77857427
commit
294109c66a
@ -249,6 +249,7 @@ def checkFormatEntries():
|
|||||||
\Format dateout tmp "date (output)" "" "" "%%"
|
\Format dateout tmp "date (output)" "" "" "%%"
|
||||||
\Format docbook sgml DocBook B "" "%%"
|
\Format docbook sgml DocBook B "" "%%"
|
||||||
\Format docbook-xml xml "Docbook (XML)" "" "" "%%"
|
\Format docbook-xml xml "Docbook (XML)" "" "" "%%"
|
||||||
|
\Format lilypond ly "LilyPond music" "" "" "%%"
|
||||||
\Format literate nw NoWeb N "" "%%"
|
\Format literate nw NoWeb N "" "%%"
|
||||||
\Format latex tex "LaTeX (plain)" L "" "%%"
|
\Format latex tex "LaTeX (plain)" L "" "%%"
|
||||||
\Format linuxdoc sgml LinuxDoc x "" "%%"
|
\Format linuxdoc sgml LinuxDoc x "" "%%"
|
||||||
@ -392,6 +393,24 @@ def checkConverterEntries():
|
|||||||
'latex2html -no_subdir -split 0 -show_section_numbers $$i', 'hevea -s $$i'],
|
'latex2html -no_subdir -split 0 -show_section_numbers $$i', 'hevea -s $$i'],
|
||||||
rc_entry = [ r'\converter latex html "%%" "originaldir,needaux"' ])
|
rc_entry = [ r'\converter latex html "%%" "originaldir,needaux"' ])
|
||||||
#
|
#
|
||||||
|
path, lilypond = checkProg('a LilyPond -> ESP/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]) >= 6):
|
||||||
|
addToRC(r'''\converter lilypond eps "lilypond -b eps --ps $$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 $$i" ""')
|
||||||
|
print '+ found LilyPond version %s.' % version_number
|
||||||
|
else:
|
||||||
|
print '+ found LilyPond, but version %s is too old.' % version_number
|
||||||
|
else:
|
||||||
|
print '+ found LilyPond, but could not extract version number.'
|
||||||
|
#
|
||||||
# FIXME: no rc_entry? comment it out
|
# FIXME: no rc_entry? comment it out
|
||||||
# checkProg('Image converter', ['convert $$i $$o'])
|
# checkProg('Image converter', ['convert $$i $$o'])
|
||||||
#
|
#
|
||||||
|
@ -205,6 +205,55 @@ Template ChessDiagram
|
|||||||
TemplateEnd
|
TemplateEnd
|
||||||
|
|
||||||
|
|
||||||
|
Template LilyPond
|
||||||
|
GuiName "Lilypond typeset music"
|
||||||
|
HelpText
|
||||||
|
Sheet music typeset by GNU LilyPond,
|
||||||
|
converted to .pdf or .eps for inclusion
|
||||||
|
Using .eps requires at least lilypond 2.6
|
||||||
|
Using .pdf requires at least lilypond 2.9
|
||||||
|
HelpTextEnd
|
||||||
|
InputFormat "lilypond"
|
||||||
|
FileFilter "*.ly"
|
||||||
|
AutomaticProduction true
|
||||||
|
Transform Rotate
|
||||||
|
Transform Resize
|
||||||
|
Transform Clip
|
||||||
|
Transform Extra
|
||||||
|
Format LaTeX
|
||||||
|
TransformOption Rotate RotationLatexOption
|
||||||
|
TransformOption Resize ResizeLatexOption
|
||||||
|
TransformOption Clip ClipLatexOption
|
||||||
|
TransformOption Extra ExtraOption
|
||||||
|
Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
|
||||||
|
Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
|
||||||
|
UpdateFormat eps
|
||||||
|
UpdateResult "$$AbsPath$$Basename.eps"
|
||||||
|
Requirement "graphicx"
|
||||||
|
ReferencedFile latex "$$AbsPath$$Basename.eps"
|
||||||
|
ReferencedFile dvi "$$AbsPath$$Basename.eps"
|
||||||
|
FormatEnd
|
||||||
|
Format PDFLaTeX
|
||||||
|
TransformOption Rotate RotationLatexOption
|
||||||
|
TransformOption Resize ResizeLatexOption
|
||||||
|
TransformOption Clip ClipLatexOption
|
||||||
|
TransformOption Extra ExtraOption
|
||||||
|
Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
|
||||||
|
Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
|
||||||
|
UpdateFormat pdf
|
||||||
|
UpdateResult "$$AbsPath$$Basename.pdf"
|
||||||
|
Requirement "graphicx"
|
||||||
|
ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
|
||||||
|
FormatEnd
|
||||||
|
Format Ascii
|
||||||
|
Product "[LilyPond: $$FName]"
|
||||||
|
FormatEnd
|
||||||
|
Format DocBook
|
||||||
|
Product "[LilyPond: $$FName]"
|
||||||
|
FormatEnd
|
||||||
|
TemplateEnd
|
||||||
|
|
||||||
|
|
||||||
Template Date
|
Template Date
|
||||||
GuiName "Date"
|
GuiName "Date"
|
||||||
HelpText
|
HelpText
|
||||||
|
@ -323,6 +323,12 @@ bool Converters::convert(Buffer const * buffer,
|
|||||||
}
|
}
|
||||||
OutputParams runparams;
|
OutputParams runparams;
|
||||||
runparams.flavor = getFlavor(edgepath);
|
runparams.flavor = getFlavor(edgepath);
|
||||||
|
|
||||||
|
// Some converters (e.g. lilypond) can only output files to the
|
||||||
|
// current directory, so we need to change the current directory.
|
||||||
|
// This has the added benefit that all other files that may be
|
||||||
|
// generated by the converter are deleted when LyX closes and do not
|
||||||
|
// clutter the real working directory.
|
||||||
string path = OnlyPath(from_file);
|
string path = OnlyPath(from_file);
|
||||||
Path p(path);
|
Path p(path);
|
||||||
|
|
||||||
|
@ -330,6 +330,13 @@ void build_script(string const & from_file,
|
|||||||
"outfile = " << QuoteName(outfile, quote_python) << "\n"
|
"outfile = " << QuoteName(outfile, quote_python) << "\n"
|
||||||
"shutil.copy(infile, outfile)\n";
|
"shutil.copy(infile, outfile)\n";
|
||||||
|
|
||||||
|
// Some converters (e.g. lilypond) can only output files to the
|
||||||
|
// current directory, so we need to change the current directory.
|
||||||
|
// This has the added benefit that all other files that may be
|
||||||
|
// generated by the converter are deleted when LyX closes and do not
|
||||||
|
// clutter the real working directory.
|
||||||
|
script << "os.chdir(" << QuoteName(OnlyPath(outfile)) << ")\n";
|
||||||
|
|
||||||
if (edgepath.empty()) {
|
if (edgepath.empty()) {
|
||||||
// Either from_format is unknown or we don't have a
|
// Either from_format is unknown or we don't have a
|
||||||
// converter path from from_format to to_format, so we use
|
// converter path from from_format to to_format, so we use
|
||||||
|
@ -29,6 +29,8 @@ What's new
|
|||||||
|
|
||||||
- Outline support.
|
- Outline support.
|
||||||
|
|
||||||
|
- Add an external template for LilyPond (a music typesetter)
|
||||||
|
|
||||||
** Bug fixes:
|
** Bug fixes:
|
||||||
|
|
||||||
* Document Input/Output
|
* Document Input/Output
|
||||||
|
Loading…
Reference in New Issue
Block a user