Closed gnaegi closed 11 months ago
Hello @gnaegi thanks for your kind words and sorry to have broken something.
I'm particulary surprised since I do have dot files in the tests suite to check the plugin's behavior with this kind of files... :/
To be truly helpful, I need a repository I can reproduce the problem from please?
Hi @ultrabug thanks for your promt reply. Our documentation is here: https://github.com/OpenOLAT/OpenOLAT-docs
BUT: it is not yet compliant with the new release yet, I did the modification only locally. It is quite large, so it's probably no worth trying with our repo.
To be more precise on the issue: I think the problem with the dots is only if you have two pages that have the same beginning and differs only after the dot: page1.0.md
and page1.1.md
.
If that works in your case, then I will see if I did some mistake in the configuration migration.
Indeed @gnaegi I don't see any Release_notes_17
related files in the repo?
Look at the structure here in the topic2 you'll see dotted files.
What should I do to trigger the problem on my test structure?
Ok scratch that, I have found out how to reproduce on my tests!
I'll fix that for you.
Thank you, much appreciated!
@gnaegi the #259 PR should address the issue, mind the note comment I added please.
Meanwhile, this should unblock you.
Just released 1.0.5 which should fix that!
Friendly ping @jodygarnett
Friendly ping @jodygarnett
It works! I am new to python so had to figure out how to update to newer version :)
Sorry @ultrabug for my slow response, I was sick and had no time to update everything. The error I described is now gone, thank you.
However, I sill can't compile. I updated everything to 1.0.5 and migrated the structure, but now I get a new error. When I completely remove the i18n plugin the error disappears, to it is somehow connected.
ERROR - Error reading page 'index.de.md': PurePosixPath('.') has an empty name
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/__main__.py", line 361, in <module>
cli()
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/__main__.py", line 270, in serve_command
serve.serve(**kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 86, in serve
builder(config)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 67, in builder
build(config, live_server=None if is_clean else server, dirty=is_dirty)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/commands/build.py", line 354, in build
config.plugins.on_post_build(config=config)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/plugins.py", line 542, in on_post_build
return self.run_event('post_build', config=config)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/plugins.py", line 509, in run_event
result = method(**kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs_static_i18n/plugin.py", line 195, in on_post_build
build(config, dirty=dirty)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/commands/build.py", line 322, in build
_populate_page(file.page, config, files, dirty)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/commands/build.py", line 175, in _populate_page
page.render(config, files)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/structure/pages.py", line 271, in render
self.content = md.convert(self.markdown)
File "/opt/homebrew/lib/python3.10/site-packages/markdown/core.py", line 258, in convert
newRoot = treeprocessor.run(root)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/structure/pages.py", line 299, in run
new_url = self.path_to_url(url)
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/structure/pages.py", line 401, in path_to_url
if self.files.get_file_from_path(path) is not None:
File "/opt/homebrew/lib/python3.10/site-packages/mkdocs_static_i18n/suffix.py", line 121, in get_file_from_path
expected_src_uri.with_suffix(
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 782, in with_suffix
raise ValueError("%r has an empty name" % (self,))
ValueError: PurePosixPath('.') has an empty name
Update: the problem is triggered by any link to /. This breaks the i18n plugin.
Testcase:
Good catch @gnaegi thanks, this is fixed in 1.0.6
I also hope you're doing better now @gnaegi ; hf
Thanks for the great update to version 1! Unfortunately it breaks many of our pages that contain dots.
E.g.
Release_notes_17.2.md
When I also have a page
Release_notes_17.1.md
I get errors "Exception: Conflicting files for the default language 'en': choose either ..."When I replace the file
Release_notes_17_2.md
the error is gone, however all our existing links from our tool to the documentation will be wrong. I think the parsing of the language goes for the first dot instead of the last one.Any chance this could be fixed in the plugin?
Thanks & regards Florian
Stack
Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/__main__.py", line 361, in <module> cli() File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/__main__.py", line 270, in serve_command serve.serve(**kwargs) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 86, in serve builder(config) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 67, in builder build(config, live_server=None if is_clean else server, dirty=is_dirty) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/commands/build.py", line 304, in build files = config.plugins.on_files(files, config=config) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/plugins.py", line 533, in on_files return self.run_event('files', files, config=config) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs/plugins.py", line 507, in run_event result = method(item, **kwargs) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs_static_i18n/plugin.py", line 50, in on_files i18n_files = self.reconfigure_files(files, config) File "/opt/homebrew/lib/python3.10/site-packages/mkdocs_static_i18n/reconfigure.py", line 570, in reconfigure_files raise Exception( Exception: Conflicting files for the default language 'en': choose either 'manual_user/area_modules/catalog2.0_angebote.md' or 'manual_user/area_modules/catalog2.0.md' but not both