TEXI2HTML_FLAGS += --nomenu
-# Urgh, how can I do two replacements at once without messing up the order of the list?
-TMP = $(sort $(MUSICXML_FILES) $(MUSICMXL_FILES) $(TEXINFO_SOURCES) )
-TMP1 = ${TMP:%.xml=$(outdir)/%.ly}
-COLLATED_FILES = ${TMP1:%.mxl=$(outdir)/%.ly}
+COLLATED_FILES = $(sort $(MUSICXML_FILES) $(MUSICMXL_FILES) $(TEXINFO_SOURCES) )
include $(depth)/make/stepmake.make
TITLE=Unofficial MusicXML test suite
+AUTHOR=Reinhold Kainhofer
TEST_SUITE_VERSION=0.1
+LILYPOND_BOOK_FLAGS += --load-custom-package=book-musicxml-testsuite.py
+# This breaks since *.tex and *.texi still contains ac/lily-xxxxxx references!
+#LILYPOND_BOOK_FLAGS += --use-source-file-names
ifeq ($(out),www)
local-WWW-2: zip
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import book_base as BookBase
+import book_texinfo as BookTexinfo
+import book_snippets as BookSnippet
+import lilylib as ly
+
+MusicXMLOutputImage = r'''@noindent
+@ifinfo
+@image{%(info_image_path)s,,,%(alt)s,%(ext)s}
+@end ifinfo
+@html
+<p>
+ <a href="%(base)s%(ext)s">
+ <img align="middle" border="0" src="%(image)s" alt="%(alt)s">
+ </a>
+</p>
+@end html
+'''
+
+MusicXMLOutput = r'''
+@iftex
+@include %(base)s-systems.texi
+@end iftex
+'''
+
+MusicXMLPrintFilename = r'''
+@html
+<a href="%(base)s%(ext)s">
+@end html
+@file{%(filename)s}
+@html
+</a>
+@end html
+'''
+
+
+
+
+class BookMusicXML (BookTexinfo.BookTexinfoOutputFormat):
+ def __init__ (self):
+ BookTexinfo.BookTexinfoOutputFormat.__init__ (self)
+ self.format = "MusicXMLTest"
+ self.output[BookBase.OUTPUTIMAGE] = MusicXMLOutputImage
+ self.output[BookBase.OUTPUT] = MusicXMLOutput
+ self.output[BookBase.PRINTFILENAME] = MusicXMLPrintFilename
+ def snippet_class (self, type):
+ if type == "musicxml_file":
+ return MusicXMLTestSuiteSnippet
+ else:
+ return BookSnippet.snippet_type_to_class.get (type, BookSnippet.Snippet)
+ def snippet_output (self, basename, snippet):
+ return BookTexinfo.BookTexinfoOutputFormat.snippet_output (self, basename, snippet)
+
+
+class MusicXMLTestSuiteSnippet (BookSnippet.MusicXMLFileSnippet):
+ def __init__ (self, type, match, formatter, line_number, global_options):
+ BookSnippet.MusicXMLFileSnippet.__init__ (self, type, match, formatter, line_number, global_options)
+
+## TODO: Customize output with renderings from other MusicXML-supporting
+# applications. Also add some link to the intermediate .ly file
+
+
+BookBase.register_format (BookMusicXML ());
texi_file_re = re.compile ('.*\.i?te(ly|xi)$')
html_file_re = re.compile ('.*\.i?htm(l)?$')
-xml_file_re = re.compile ('.*\.i?xml$')
+xml_file_re = re.compile ('.*\.i?(xm|mx)l$')
tex_file_re = re.compile ('.*\.i?(la)?tex$')
pdf_file_re = re.compile ('.*\.i?pdf$')
# We have a texi include file, simply include it:
s = r"@include %s" % os.path.basename (n)
elif (html_file_re.match (n) or pdf_file_re.match (n) or
- xml_file_re.match (n) or tex_file_re.match (n)):
+ tex_file_re.match (n)):
s = r"""
@ifhtml
@html
@end html
@end ifhtml
""" % (os.path.basename (n), os.path.basename (n))
- return s
+
+ elif (xml_file_re.match (n)):
+ # Assume it's a MusicXML file -> convert, create image etc.
+ s = r"""
+@ifhtml
+@html
+<a name="%s"></a>
+@end html
+@end ifhtml
+
+@musicxmlfile[%s]{%s}
+""" % (os.path.basename (n), fragment_options, n)
+
else:
# Assume it's a lilypond file -> create image etc.
s = r"""