diff --git a/Filters/VLLilypondType.reader b/Filters/VLLilypondType.reader index 20b44cb..5cc89f1 100755 --- a/Filters/VLLilypondType.reader +++ b/Filters/VLLilypondType.reader @@ -3,6 +3,8 @@ # VLLilypondType.reader - Import lilypond files # +$KCODE = 'u' + require File.dirname($0)+'/plistWriter' require File.dirname($0)+'/vl' @@ -392,11 +394,15 @@ def parseLilypond tokens[0] = nil when '\new' if tokens[0] == "Lyrics" - stack.push([block, level, ""]) - block = '\lyricmode' - level = nestLevel - STANZAS.push(lyrics= []) - tokens[0..0] = nil + if tokens[1] =~ /^\\/ + tokens[0..1] = nil + else + stack.push([block, level, ""]) + block = '\lyricmode' + level = nestLevel + STANZAS.push(lyrics= []) + tokens[0..0] = nil + end end when '\relative' stack.push([block, level, ""]) diff --git a/Filters/plistWriter.rb b/Filters/plistWriter.rb index fd048ab..ab231ac 100644 --- a/Filters/plistWriter.rb +++ b/Filters/plistWriter.rb @@ -15,6 +15,18 @@ class PlistData end end +def _encodeEntities(string) + encoded = [] + string.unpack('U*').each do |ch| + if ch <= 0x7F + encoded << ch + else + encoded.concat("&\##{ch};".unpack('C*')) + end + end + encoded.pack('C*') +end + def _encodePlist(destination, object, indent) destination.print " "*indent case object @@ -23,7 +35,7 @@ def _encodePlist(destination, object, indent) when true then destination.print "\n" when String then - destination.print "#{object}\n" + destination.print "#{_encodeEntities(object)}\n" when PlistData then destination.print "#{object}\n" when Integer then