diff --git a/lib/ever2boost/enex_converter.rb b/lib/ever2boost/enex_converter.rb index cc92c25..8f0825f 100644 --- a/lib/ever2boost/enex_converter.rb +++ b/lib/ever2boost/enex_converter.rb @@ -29,12 +29,18 @@ def parse_plural_notes(enex, output_dir) xml_document = REXML::Document.new(el.to_s).elements Note.new({ title: xml_document['note/title'].text, - content: "
#{xml_document['note/content/text()'].to_s.sub(/<\?xml(.*?)\?>(.*?)<\!DOCTYPE(.*?)>/m, '')}
", + content: "
#{strip_doctype(xml_document)}
", output_dir: output_dir }) end end.compact.flatten end + + private + + def strip_doctype(xml_document) + xml_document['note/content/text()'].to_s.sub(/(<\?xml(.*?)\?>(.*?))?<\!DOCTYPE(.*?)>/m, '') + end end end end