lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lilypond-book: Fix links in texinfo output (issue 2224). (issue 5557056)


From: julien . rioux
Subject: lilypond-book: Fix links in texinfo output (issue 2224). (issue 5557056)
Date: Thu, 19 Jan 2012 00:18:17 +0000

Reviewers: Reinhold,

Message:
Please review.

Description:
lilypond-book:

Fix links in texinfo output (issue 2224).
Also, specify filename and ext for all snippets.

Please review this at http://codereview.appspot.com/5557056/

Affected files:
  M python/book_snippets.py
  M python/book_texinfo.py


Index: python/book_snippets.py
diff --git a/python/book_snippets.py b/python/book_snippets.py
index e5a43110ffa268ae6733d09e7c96dc768503ef61..7e5e94686352fd413148dc7f01eabf7ca64c3f50 100644
--- a/python/book_snippets.py
+++ b/python/book_snippets.py
@@ -329,6 +329,8 @@ class IncludeSnippet (Snippet):
 class LilypondSnippet (Snippet):
def __init__ (self, type, match, formatter, line_number, global_options): Snippet.__init__ (self, type, match, formatter, line_number, global_options)
+        self.filename = ''
+        self.ext = '.ly'
         os = match.group ('options')
         self.parse_snippet_options (os, self.type)

@@ -651,7 +653,10 @@ printing diff against existing file." % filename)
     def additional_files_to_consider (self, base, full):
         return []
     def additional_files_required (self, base, full):
-        return []
+        result = [];
+        if self.ext != '.ly':
+            result.append (base + self.ext)
+        return result


     def all_output_files (self, output_dir, output_dir_files):
@@ -803,7 +808,6 @@ class LilypondFileSnippet (LilypondSnippet):
def __init__ (self, type, match, formatter, line_number, global_options): LilypondSnippet.__init__ (self, type, match, formatter, line_number, global_options)
         self.filename = self.substring ('filename')
-        self.ext = os.path.splitext (os.path.basename (self.filename))[1]
         self.contents = file (BookBase.find_file (self.filename,
global_options.include_path, global_options.original_dir)).read ()

@@ -838,6 +842,7 @@ class MusicXMLFileSnippet (LilypondFileSnippet):
LilypondFileSnippet.__init__ (self, type, match, formatter, line_number, global_options)
         self.compressed = False
         self.converted_ly = None
+        self.ext = os.path.splitext (os.path.basename (self.filename))[1]
         self.musicxml_options_dict = {
            'verbose': '--verbose',
            'lxml': '--lxml',
@@ -881,14 +886,6 @@ class MusicXMLFileSnippet (LilypondFileSnippet):
         return ('\\sourcefilename \"%s\"\n\\sourcefileline 0\n%s'
                 % (name, self.converted_ly))

-    def additional_files_required (self, base, full):
-        result = [];
-        if self.compressed:
-            result.append (base + '.mxl')
-        else:
-            result.append (base + '.xml')
-        return result
-
     def write_ly (self):
         base = self.basename ()
         path = os.path.join (self.global_options.lily_output_dir, base)
Index: python/book_texinfo.py
diff --git a/python/book_texinfo.py b/python/book_texinfo.py
index ca9ee31754f84dfe6adfd57d510dc2c292577957..234092ee4b2fed204d53e98629a4ae6335d63fa8 100644
--- a/python/book_texinfo.py
+++ b/python/book_texinfo.py
@@ -114,7 +114,7 @@ TexInfo_output = {

     OUTPUTIMAGE: r'''@noindent
 @ifinfo
address@hidden(info_image_path)s,,,%(alt)s,%(ext)s}
address@hidden(info_image_path)s,,,%(alt)s,}
 @end ifinfo
 @html
 <p>
@@ -313,19 +313,17 @@ class BookTexinfoOutputFormat (BookBase.BookOutputFormat):
     def output_info (self, basename, snippet):
         str = ''
         rep = snippet.get_replacements ();
+        rep['base'] = basename
+        rep['filename'] = os.path.basename (snippet.filename)
+        rep['ext'] = snippet.ext
         for image in snippet.get_images ():
             rep1 = copy.copy (rep)
-            (rep1['base'], rep1['ext']) = os.path.splitext (image)
+            rep1['base'] = os.path.splitext (image)[0]
             rep1['image'] = image
-
-            # URG, makeinfo implicitly prepends dot to extension.
-            # Specifying no extension is most robust.
-            rep1['ext'] = ''
             rep1['alt'] = snippet.option_dict[ALT]
rep1['info_image_path'] = os.path.join (self.global_options.info_images_dir, rep1['base'])
             str += self.output[OUTPUTIMAGE] % rep1

-        rep['base'] = basename
         str += self.output[OUTPUT] % rep
         return str






reply via email to

[Prev in Thread] Current Thread [Next in Thread]