def test_note_markdown(self, processing_options, conversion_settings): contents = [ Paragraph(processing_options, [TextItem(processing_options, '#tag1')]), Paragraph(processing_options, [TextItem(processing_options, '#tag2')]), Paragraph(processing_options, [TextItem(processing_options, 'some text')]), ] note = NimbusNote(processing_options, contents, conversion_settings, 'My Note') expected = '#tag1\n#tag2\nsome text\n' result = note.markdown() assert result == expected
def test_add_front_matter_to_content(self, processing_options, conversion_settings): contents = [ Head(processing_options, [TextItem(processing_options, 'title')]), Body(processing_options, [ Paragraph(processing_options, [TextItem(processing_options, '#tag1/tag3')]), Paragraph(processing_options, [TextItem(processing_options, '#tag2')]), TextItem(processing_options, 'my title'), ] ) ] conversion_settings.split_tags = False note = NimbusNote(processing_options, contents, conversion_settings, 'My Note') note.find_tags() note.add_front_matter_to_content() expected = '---\ngenerator: YANOM\ntag:\n- tag1/tag3\n- tag2\ntitle: My Note\n---\n\ntitle\n\nmy title' result = note.markdown() assert result == expected
def test_find_tags_keep_tag_content_with_more_than_tag_on_it(self, processing_options, conversion_settings): contents = [ Head(processing_options, [TextItem(processing_options, 'title')]), Body(processing_options, [ Paragraph(processing_options, [TextItem(processing_options, '#tag1/tag3')]), Paragraph(processing_options, [TextItem(processing_options, '#tag2'), TextItem(processing_options, ' extra content on tag line') ] ), TextItem(processing_options, 'my title'), ] ) ] note = NimbusNote(processing_options, contents, conversion_settings, 'My Note') note.find_tags() expected = 'title\n#tag2 extra content on tag line\nmy title' assert note.markdown() == expected