]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Fix indentation of the Output_printer
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sun, 23 Sep 2007 12:03:03 +0000 (14:03 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Wed, 3 Oct 2007 16:40:29 +0000 (18:40 +0200)
a < increases indentation by one. However, \< or -< should not and <<
should only increase by one, too. The same goes for \>, -> and >>.

Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
python/musicexp.py

index 504cdf139a8c073999270f2f02c6dffb65fba547..8649528abaa3f69413bf034d178cbcf98805096e 100644 (file)
@@ -75,8 +75,14 @@ class Output_printer:
         self._line += str
 
     def unformatted_output (self, str):
-        self._nesting += str.count ('<') + str.count ('{')
-        self._nesting -= str.count ('>') + str.count ('}')
+        # don't indent on \< and indent only once on <<
+        self._nesting += ( str.count ('<') 
+                         - str.count ('\<') - str.count ('<<') 
+                         + str.count ('{') )
+        self._nesting -= ( str.count ('>') - str.count ('\>') - str.count ('>>')
+                                           - str.count ('->') - str.count ('_>')
+                                           - str.count ('^>')
+                         + str.count ('}') )
         self.print_verbatim (str)
         
     def print_duration_string (self, str):