Improve robustness

This commit is contained in:
Matthias Neeracher 2007-08-30 22:34:22 +00:00
parent 7a155ad3f1
commit 5696f5d649
2 changed files with 11 additions and 7 deletions

View File

@ -35,10 +35,14 @@ def _identification
poet.add_attribute('type', 'poet')
ident.add_element(poet)
encoding = REXML::Element.new('encoding')
if INPUT['saved']
date = newTextElement('encoding-date', INPUT['saved'].strftime("%Y-%m-%d"))
encoding.add_element(date)
software = newTextElement('software', INPUT['software'])
encoding.add_element(software)
encoding.add_element(date)
end
if INPUT['software']
software = newTextElement('software', INPUT['software']) if INPUT['software']
encoding.add_element(software)
end
ident.add_element(encoding)
return ident
@ -215,7 +219,7 @@ def _melody
end
meas['melody'].each do |note|
dur = (note['durNum'] * $DIVISIONS * 4) / note['durDenom']
n = _note(note['pitch'], dur, note['tied'])
n = _note(note['pitch'], dur, note['tied'] || 0)
stanza = 1
note['lyrics'].each do |syll|
if syll['text']
@ -226,7 +230,7 @@ def _melody
n.add_element(lyr)
end
stanza += 1
end
end if note['lyrics']
m.add_element(n)
end
if r = meas['end-repeat']

View File

@ -47,7 +47,7 @@ class PlistListener
def text(text)
case @kind
when "string", "key" then
@obj = text
@obj += text
when "data" then
@obj = Base64.decode(text)
when "date" then