ultrabug / mkdocs-static-i18n

MkDocs i18n plugin using static translation markdown files
https://ultrabug.github.io/mkdocs-static-i18n/
MIT License
218 stars 37 forks source link

Incompatible with mkdocs-gen-files plugin #263

Open dvolodin7 opened 9 months ago

dvolodin7 commented 9 months ago

mkdocs-static-i18n v1.0.6 is incompatible with mkdocs-gen-files plugin.

The following warning is emitted for every auto-generated page

WARNING -  mkdocs_static_i18n: Unhandled file case - connection-types-reference/juniper.md

and then, the page is removed from navigation and not being rendered at all.

The root of the problem is in reconfigure.py in the reconfigure_files function. Exactly, in this condition

            if is_relative_to(file.abs_src_path, mkdocs_config.docs_dir):

Files, generated by mkdocs-gen-file have abs_src_path in the temporary directory. i.e.

File(
    src_uri='connection-types-reference/juniper.md',
   dest_uri='connection-types-reference/juniper/index.html',
   name='juniper',
   url='connection-types-reference/juniper/'
)
abs_src_path=/tmp/mkdocs_gen_files_cg_osgf4/connection-types-reference/juniper.md

As a result, the condition is not satisfied and the file is excluded.

I think we cannot rely on physical file location as the criteria. Maybe

file.is_documentation_page()

is a better criteria?

dvolodin7 commented 9 months ago

Just found the same bug affects the mkdocs-material blog plugin as well.