Module: Synclenote::NoteBuilder
- Defined in:
- lib/synclenote/note_builder.rb
Constant Summary collapse
- DEFAULT_TAGS =
%w[syncle]- TITLE_IF_EMPTY =
"no title"
Class Method Summary collapse
Class Method Details
.call(raw_note, guid: nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/synclenote/note_builder.rb', line 7 def call(raw_note, guid: nil) lines = raw_note.each_line.lazy title, , body_markdown = *parse_lines(lines) title = TITLE_IF_EMPTY if /\A\s*\z/ === title = (DEFAULT_TAGS + ).uniq enml = Synclenote::MarkdownToEnmlBuilder.(body_markdown) = { title:, content: enml, tagNames: , } [:guid] = guid if guid return Evernote::EDAM::Type::Note.new() end |