Markdown converter not working #2

Closed
opened 2022-11-05 17:03:46 +01:00 by Ghost · 1 comment

Hi,

The markdown converter isn't working for me. It looks like the decorators for the converter classes aren't kicking in, so the MarkdownConverter.converters list remains empty when the convert function is called.

I'm using Python 3.10.8.

Test output:

$ python3 runtests.py
loaded markdown converters: simplestyle, emoji, images, todo, code, links, lists, headers
test_convert_code_with_specific_language (markdown.test_code.TestMarkdownCode) ... ok
test_convert_code_without_language (markdown.test_code.TestMarkdownCode) ... ok
test_convert_file_with_some_language (markdown.test_code.TestMarkdownCode) ... ok
test_convert_file_without_language (markdown.test_code.TestMarkdownCode) ... ok
test_replace_one_emoji (markdown.test_emoji.TestMarkdownEmoji) ... ok
test_replace_some_emojis_in_one_line (markdown.test_emoji.TestMarkdownEmoji) ... ok
test_convert_does_nothing_if_no_header (markdown.test_header.TestMarkdownHeader) ... ok
test_convert_h1 (markdown.test_header.TestMarkdownHeader) ... ok
test_convert_h2 (markdown.test_header.TestMarkdownHeader) ... ok
test_convert_h3 (markdown.test_header.TestMarkdownHeader) ... ok
test_convert_h4 (markdown.test_header.TestMarkdownHeader) ... ok
test_convert_h5 (markdown.test_header.TestMarkdownHeader) ... ok
test_does_not_convert_if_too_long (markdown.test_header.TestMarkdownHeader) ... ok
test_image_center_aligned (markdown.test_images.TestMarkdownImages) ... ok
test_image_in_subdir (markdown.test_images.TestMarkdownImages) ... ok
test_image_left_aligned (markdown.test_images.TestMarkdownImages) ... ok
test_image_right_aligned (markdown.test_images.TestMarkdownImages) ... ok
test_image_right_aligned_with_specific_dimensions (markdown.test_images.TestMarkdownImages) ... ok
test_image_with_specific_dimensions (markdown.test_images.TestMarkdownImages) ... ok
test_image_with_specific_width (markdown.test_images.TestMarkdownImages) ... ok
test_simple_image_embed (markdown.test_images.TestMarkdownImages) ... ok
test_do_not_convert_starting_with_space (markdown.test_links.TestMarkdownLinks) ... ok
test_external_link_without_title (markdown.test_links.TestMarkdownLinks) ... ok
test_external_links_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_link_prefixed_with_configured_root_dir_if_subdir (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_link_to_home_converted_to_index (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_link_with_image_tag (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_link_with_ref_to_root_not_prefixed_with_root_dir (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_link_with_space_converted_to_underscore (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_links_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_links_not_prefixed_with_configured_root_dir_if_currdir (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_links_with_extension_not_suffixed_with_md (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_links_with_some_text_in_line_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_links_with_sublink_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok
test_internal_links_without_text_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok
test_known_interwiki_link_converts_successfully (markdown.test_links.TestMarkdownLinks) ... ok
test_known_interwiki_link_with_some_spaces (markdown.test_links.TestMarkdownLinks) ... ok
test_multiple_links_in_text_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok
test_unknown_interwiki_link_throws_exception (markdown.test_links.TestMarkdownLinks) ... ok
test_dont_convert_if_no_list_found (markdown.test_lists.TestMarkdownLists) ... ok
test_multiple_ordered_lists_in_text (markdown.test_lists.TestMarkdownLists) ... ok
test_only_convert_dashes_if_beginning_sentence (markdown.test_lists.TestMarkdownLists) ... ok
test_ordered_lists_nested (markdown.test_lists.TestMarkdownLists) ... ok
test_ordered_lists_super_deeply_deeper_than_deep_nested (markdown.test_lists.TestMarkdownLists) ... ok
test_single_ordered_list (markdown.test_lists.TestMarkdownLists) ... ok
test_convert_inline_code (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok
test_inline_html_simply_removes_tags (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok
test_some_bold_styles (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok
test_some_italic_styles (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok
test_some_linebreaks (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok
test_some_strikethrough_style (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok
test_converts_todos (markdown.test_todo.TestMarkdownTodo) ... ok
test_converts_todos_with_marked_as_done (markdown.test_todo.TestMarkdownTodo) ... ok
test_convert_whole_dir (test_dokuwiki_to_hugo.TestDokuWikiToHugo) ... generating output/test/subdir/_index.md

generating output/test/subdir/moar/dokuwiki_header_in_subdir.md

FAIL
test_doku_to_hugo_converts_home_to_index_markdown_files (test_dokuwiki_to_hugo.TestDokuWikiToHugo) ... generating output/test/subdir/_index.md

generating output/test/subdir/moar/dokuwiki_header_in_subdir.md

ok
test_dokuwiki_header_example (test_hugo_front_matter.TestHugoFrontMatter) ... ok
test_dokuwiki_in_subdir_creates_tags_for_each_dir (test_hugo_front_matter.TestHugoFrontMatter) ... ok
test_acceptance_test_case (test_markdown_converter.TestMarkdownHeader) ... # header 1 

##### header 5 

[hi]({{< relref "hello_world.md" >}}) this is a test!

{{< wp "Dogs" >}} are cool, look it up. [sublink]({{< relref "link/sub.md" >}}) example.

FAIL

======================================================================
FAIL: test_convert_whole_dir (test_dokuwiki_to_hugo.TestDokuWikiToHugo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/adakaleh/Downloads/dokuwiki-to-hugo/test/test_dokuwiki_to_hugo.py", line 25, in test_convert_whole_dir
    self.assertIn('##### some header', expected)  # some conversion done, check
AssertionError: '##### some header' not found in '+++\ntitle = "dokuwiki_header_in_subdir"\ndraft = false\ntags = [\n    "test",\n    "subdir",\n    "moar",\n    "dokuwiki_header_in_subdir"\n]\n\ndate = "2014-10-10"\n+++\n== some header ==\n\nhello there!\n\nThis is //dokuwiki// style stuff right there. \\\\\nThanks for stopping by.\n'

======================================================================
FAIL: test_acceptance_test_case (test_markdown_converter.TestMarkdownHeader)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/adakaleh/Downloads/dokuwiki-to-hugo/test/test_markdown_converter.py", line 18, in test_acceptance_test_case
    self.assertEqual(expected, actual, "Files not matching!")
AssertionError: '# header 1\n\n##### header 5 \n\n[hi]({{< relref "h[125 chars]e.\n' != '# header 1 \n\n##### header 5 \n\n[hi]({{< relref "[126 chars]e.\n'
- # header 1
+ # header 1 
?           +
  
  ##### header 5 
  
  [hi]({{< relref "hello_world.md" >}}) this is a test!
  
  {{< wp "Dogs" >}} are cool, look it up. [sublink]({{< relref "link/sub.md" >}}) example.
 : Files not matching!

----------------------------------------------------------------------
Ran 58 tests in 0.012s

FAILED (failures=2)
Hi, The markdown converter isn't working for me. It looks like the decorators for the converter classes aren't kicking in, so the `MarkdownConverter.converters` list remains empty when the `convert` function is called. I'm using Python 3.10.8. Test output: ``` $ python3 runtests.py loaded markdown converters: simplestyle, emoji, images, todo, code, links, lists, headers test_convert_code_with_specific_language (markdown.test_code.TestMarkdownCode) ... ok test_convert_code_without_language (markdown.test_code.TestMarkdownCode) ... ok test_convert_file_with_some_language (markdown.test_code.TestMarkdownCode) ... ok test_convert_file_without_language (markdown.test_code.TestMarkdownCode) ... ok test_replace_one_emoji (markdown.test_emoji.TestMarkdownEmoji) ... ok test_replace_some_emojis_in_one_line (markdown.test_emoji.TestMarkdownEmoji) ... ok test_convert_does_nothing_if_no_header (markdown.test_header.TestMarkdownHeader) ... ok test_convert_h1 (markdown.test_header.TestMarkdownHeader) ... ok test_convert_h2 (markdown.test_header.TestMarkdownHeader) ... ok test_convert_h3 (markdown.test_header.TestMarkdownHeader) ... ok test_convert_h4 (markdown.test_header.TestMarkdownHeader) ... ok test_convert_h5 (markdown.test_header.TestMarkdownHeader) ... ok test_does_not_convert_if_too_long (markdown.test_header.TestMarkdownHeader) ... ok test_image_center_aligned (markdown.test_images.TestMarkdownImages) ... ok test_image_in_subdir (markdown.test_images.TestMarkdownImages) ... ok test_image_left_aligned (markdown.test_images.TestMarkdownImages) ... ok test_image_right_aligned (markdown.test_images.TestMarkdownImages) ... ok test_image_right_aligned_with_specific_dimensions (markdown.test_images.TestMarkdownImages) ... ok test_image_with_specific_dimensions (markdown.test_images.TestMarkdownImages) ... ok test_image_with_specific_width (markdown.test_images.TestMarkdownImages) ... ok test_simple_image_embed (markdown.test_images.TestMarkdownImages) ... ok test_do_not_convert_starting_with_space (markdown.test_links.TestMarkdownLinks) ... ok test_external_link_without_title (markdown.test_links.TestMarkdownLinks) ... ok test_external_links_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok test_internal_link_prefixed_with_configured_root_dir_if_subdir (markdown.test_links.TestMarkdownLinks) ... ok test_internal_link_to_home_converted_to_index (markdown.test_links.TestMarkdownLinks) ... ok test_internal_link_with_image_tag (markdown.test_links.TestMarkdownLinks) ... ok test_internal_link_with_ref_to_root_not_prefixed_with_root_dir (markdown.test_links.TestMarkdownLinks) ... ok test_internal_link_with_space_converted_to_underscore (markdown.test_links.TestMarkdownLinks) ... ok test_internal_links_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok test_internal_links_not_prefixed_with_configured_root_dir_if_currdir (markdown.test_links.TestMarkdownLinks) ... ok test_internal_links_with_extension_not_suffixed_with_md (markdown.test_links.TestMarkdownLinks) ... ok test_internal_links_with_some_text_in_line_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok test_internal_links_with_sublink_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok test_internal_links_without_text_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok test_known_interwiki_link_converts_successfully (markdown.test_links.TestMarkdownLinks) ... ok test_known_interwiki_link_with_some_spaces (markdown.test_links.TestMarkdownLinks) ... ok test_multiple_links_in_text_converted_properly (markdown.test_links.TestMarkdownLinks) ... ok test_unknown_interwiki_link_throws_exception (markdown.test_links.TestMarkdownLinks) ... ok test_dont_convert_if_no_list_found (markdown.test_lists.TestMarkdownLists) ... ok test_multiple_ordered_lists_in_text (markdown.test_lists.TestMarkdownLists) ... ok test_only_convert_dashes_if_beginning_sentence (markdown.test_lists.TestMarkdownLists) ... ok test_ordered_lists_nested (markdown.test_lists.TestMarkdownLists) ... ok test_ordered_lists_super_deeply_deeper_than_deep_nested (markdown.test_lists.TestMarkdownLists) ... ok test_single_ordered_list (markdown.test_lists.TestMarkdownLists) ... ok test_convert_inline_code (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok test_inline_html_simply_removes_tags (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok test_some_bold_styles (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok test_some_italic_styles (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok test_some_linebreaks (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok test_some_strikethrough_style (markdown.test_simplestyle.TestMarkdownSimpleStyles) ... ok test_converts_todos (markdown.test_todo.TestMarkdownTodo) ... ok test_converts_todos_with_marked_as_done (markdown.test_todo.TestMarkdownTodo) ... ok test_convert_whole_dir (test_dokuwiki_to_hugo.TestDokuWikiToHugo) ... generating output/test/subdir/_index.md generating output/test/subdir/moar/dokuwiki_header_in_subdir.md FAIL test_doku_to_hugo_converts_home_to_index_markdown_files (test_dokuwiki_to_hugo.TestDokuWikiToHugo) ... generating output/test/subdir/_index.md generating output/test/subdir/moar/dokuwiki_header_in_subdir.md ok test_dokuwiki_header_example (test_hugo_front_matter.TestHugoFrontMatter) ... ok test_dokuwiki_in_subdir_creates_tags_for_each_dir (test_hugo_front_matter.TestHugoFrontMatter) ... ok test_acceptance_test_case (test_markdown_converter.TestMarkdownHeader) ... # header 1 ##### header 5 [hi]({{< relref "hello_world.md" >}}) this is a test! {{< wp "Dogs" >}} are cool, look it up. [sublink]({{< relref "link/sub.md" >}}) example. FAIL ====================================================================== FAIL: test_convert_whole_dir (test_dokuwiki_to_hugo.TestDokuWikiToHugo) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/adakaleh/Downloads/dokuwiki-to-hugo/test/test_dokuwiki_to_hugo.py", line 25, in test_convert_whole_dir self.assertIn('##### some header', expected) # some conversion done, check AssertionError: '##### some header' not found in '+++\ntitle = "dokuwiki_header_in_subdir"\ndraft = false\ntags = [\n "test",\n "subdir",\n "moar",\n "dokuwiki_header_in_subdir"\n]\n\ndate = "2014-10-10"\n+++\n== some header ==\n\nhello there!\n\nThis is //dokuwiki// style stuff right there. \\\\\nThanks for stopping by.\n' ====================================================================== FAIL: test_acceptance_test_case (test_markdown_converter.TestMarkdownHeader) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/adakaleh/Downloads/dokuwiki-to-hugo/test/test_markdown_converter.py", line 18, in test_acceptance_test_case self.assertEqual(expected, actual, "Files not matching!") AssertionError: '# header 1\n\n##### header 5 \n\n[hi]({{< relref "h[125 chars]e.\n' != '# header 1 \n\n##### header 5 \n\n[hi]({{< relref "[126 chars]e.\n' - # header 1 + # header 1 ? + ##### header 5 [hi]({{< relref "hello_world.md" >}}) this is a test! {{< wp "Dogs" >}} are cool, look it up. [sublink]({{< relref "link/sub.md" >}}) example. : Files not matching! ---------------------------------------------------------------------- Ran 58 tests in 0.012s FAILED (failures=2) ```
Ghost closed this issue 2022-11-05 17:06:43 +01:00
Ghost reopened this issue 2022-11-05 17:07:03 +01:00
Owner

Yeah this project is really outdated and probably broken, sorry about that, but I don't have the time to really dig into this issue, and I don't think I'll ever be changing any of the code, so if you or someone else finds the time, go ahead, but in the meantime, it's here for reference.

Yeah this project is really outdated and probably broken, sorry about that, but I don't have the time to really dig into this issue, and I don't think I'll ever be changing any of the code, so if you or someone else finds the time, go ahead, but in the meantime, it's here for reference.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: wgroeneveld/dokuwiki-to-hugo#2
No description provided.