From 1e0ac13e12a626411c2cc78f5053cb62bf83cc89 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sat, 16 Aug 2008 20:42:59 +0000 Subject: [PATCH] Handle smart quotes --- Filters/VLLilypondType.reader | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Filters/VLLilypondType.reader b/Filters/VLLilypondType.reader index 12b75c0..6bd27f6 100755 --- a/Filters/VLLilypondType.reader +++ b/Filters/VLLilypondType.reader @@ -187,7 +187,7 @@ def parseLilypond INFILE.each do |line| line.chomp!.sub!(/%.*/, "") line.gsub!(/\\breve/, "1*8/4") - line.scan(%r$\G\s*(\{|\}|\(|\)|\||=|~|<<|>>|--|#'|#\(|##t|##f|\\\w+|\".*?\"|\w[-+^\w\d.',:*/?!]+|.)$) do |token| + line.scan(%r$\G\s*(\{|\}|\(|\)|\||=|~|<<|>>|--|#'|#\(|##t|##f|\\\w+|\".*?\"|(\w|'|`)[-+^\w\d.'`,:*/?!]+|.)$) do |token| tokens.push(token[0]) end end @@ -349,7 +349,13 @@ def parseLilypond p [$1, lyricFlags] if $DEBUG lyrics.push [$1, lyricFlags] lyricFlags = 0 - elsif token =~ /^\w.*/ + elsif token =~ /^(\w|'|`).*/ + # + # Handle smart quotes + # + token.gsub!(/``/, "\xE2\x80\x9C"); + token.gsub!(/''/, "\xE2\x80\x9D"); + token.gsub!(/'/, "\xE2\x80\x99"); p [token, lyricFlags] if $DEBUG lyrics.push [token, lyricFlags] lyricFlags = 0