Module: Evernote2md

Defined in:
lib/evernote2md.rb,
lib/evernote2md/version.rb

Defined Under Namespace

Classes: Note

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.compile(file, output_dir) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/evernote2md.rb', line 5

def self.compile(file, output_dir)
  xml_file = File.new(file)
  xml_notes = Nokogiri::XML(xml_file).xpath('//note')
  xml_notes.each do |note|
    note_to_save = Note.new(note.xpath('title').first.text, note.xpath('content').first.text)
    puts "Saving note: #{note_to_save.title}"
    IO.write(File.join(output_dir, note_to_save.title + '.txt'), note_to_save.text)
  end

end