Module: HeadMusic::Notation::LilyPond::StringText
- Defined in:
- lib/head_music/notation/lily_pond/string_text.rb
Overview
Escapes text for a double-quoted LilyPond string. LilyPond embeds executable Scheme, so an unescaped quote in a header field could break out of the string into code that runs at compile time; the backslash must double first so it cannot re-open what the quote escape closed.
Class Method Summary collapse
Class Method Details
.escape(text) ⇒ Object
8 9 10 |
# File 'lib/head_music/notation/lily_pond/string_text.rb', line 8 def self.escape(text) text.to_s.gsub("\\", "\\\\\\\\").gsub('"', "\\\"") end |