pfalcon / zim-desktop-wiki-markdown

pfalcon's fork of Zim desktop wiki project - quick Markdown format support for notebooks, usability improvements, etc. Everything WIP.
http://zim-wiki.org
GNU General Public License v2.0
29 stars 3 forks source link

Links in markdown syntax ending in ".md" kill the parser #7

Open Korodny opened 3 years ago

Korodny commented 3 years ago

Add a new page to your wiki, immediately choose Edit sourcecode and add the following link to the page:

[www.dell.com/support/drivers](https://www.dell.com/support/home?app=drivers.md)

Saving the document and then confirming the Zim dialog asking me to tell it when I'm done editing results in the error message below and Zim displaying an empty page whenever I try to access it. The culprit is the ".md" extension at the end of the given URL - remove that and Zim has no problem displaying the page.

This is zim 0.73.5
Platform: posix
Locale: de_DE UTF-8
FS encoding: utf-8
Python: (3, 9, 2, 'final', 0)
PyGObject: (3, 38, 0)

======= Traceback =======
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/actions.py", line 115, in do_activate
    self.__get__(instance, instance.__class__)()
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/actions.py", line 98, in func
    return self.func(instance, *args, **kwargs)
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/gui/uiactions.py", line 357, in edit_page_source
    page.check_source_changed()
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/notebook/page.py", line 516, in check_source_changed
    return self._check_source_etag()
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/notebook/page.py", line 534, in _check_source_etag
    parsetree = self.get_parsetree()
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/notebook/page.py", line 586, in get_parsetree
    self._parsetree = parser.parse(text, file_input=True)
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/formats/zim_markdown.py", line 712, in parse
    mywikiparser(builder, input)
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/formats/zim_markdown.py", line 195, in __call__
    self.block_parser(builder, text)
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/parser.py", line 447, in __call__
    self._raise_exception(error, text, iter, end, builder)
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/parser.py", line 445, in __call__
    self.process_unmatched(builder, text[iter:])
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/formats/zim_markdown.py", line 473, in parse_para
    self.list_and_indent_parser(builder, block)
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/parser.py", line 447, in __call__
    self._raise_exception(error, text, iter, end, builder)
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/parser.py", line 445, in __call__
    self.process_unmatched(builder, text[iter:])
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/parser.py", line 437, in __call__
    self._raise_exception(error, text, mstart, mend, builder, self.rules[i])
  File "/home/christoph/Temp/zim-desktop-wiki-markdown-pfalcon/zim/parser.py", line 459, in _raise_exception
    error = ParserError(error.message)
AttributeError: 'AssertionError' object has no attribute 'message'
pfalcon commented 3 years ago

Thanks for the report, confirming this. Apparently, I never linked to an .md URL in my wiki, and the code otherwise assumes that a link ending with .md is an intra-wiki link. This is high-priority to fix, but I'm currently in the "summer mode", so apologize in advance if it may take some time.