timvink / mkdocs-table-reader-plugin

MkDocs plugin that enables a markdown tag like {{ read_csv('table.csv') }} to directly insert various table formats into a page
https://timvink.github.io/mkdocs-table-reader-plugin/
MIT License
117 stars 20 forks source link

Whitespace in csv path breaks mkDocs build process #9

Closed codegarden13 closed 4 years ago

codegarden13 commented 4 years ago

Given an abspath, it wmf if there is no whitespace in the path. With whitespace fails in MkDocs /serve build process.

Path is: '/Users/username/Documents/1. Test

    'page_markdown', page.markdown, page=page, config=config, files=files
  File "/usr/local/lib/python3.7/site-packages/mkdocs/plugins.py", line 94, in run_event
    result = method(item, **kwargs)
  File "/Users/username/Library/Python/3.7/lib/python/site-packages/mkdocs_table_reader_plugin/plugin.py", line 94, in on_page_markdown
    pd_args, pd_kwargs = parse_argkwarg(result)
  File "/Users/username/Library/Python/3.7/lib/python/site-packages/mkdocs_table_reader_plugin/safe_eval.py", line 86, in parse_argkwarg
    args.append(literal_eval(i))
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 46, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    '/Users/username/Documents/1.
timvink commented 4 years ago

Thanks (again!) for the report, I missed that one.

Fixed in 0.4.1 and also added some unit tests to prevent the issue from popping up again.

pip install --upgrade mkdocs-table-reader-plugin

Let me know if this fixes it for you.