diff --git a/.bumpversion.cfg b/.bumpversion.cfg index fe0a51c..793ce28 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.0.26 +current_version = 0.0.27 [bumpversion:file:mkdocs_mdpo_plugin/__init__.py] diff --git a/mkdocs_mdpo_plugin/__init__.py b/mkdocs_mdpo_plugin/__init__.py index 90912fd..ff05969 100644 --- a/mkdocs_mdpo_plugin/__init__.py +++ b/mkdocs_mdpo_plugin/__init__.py @@ -1,3 +1,3 @@ """mkdocs-mdpo-plugin package""" -__version__ = '0.0.26' +__version__ = '0.0.27' diff --git a/mkdocs_mdpo_plugin/plugin.py b/mkdocs_mdpo_plugin/plugin.py index 4a57c43..5d47d5e 100644 --- a/mkdocs_mdpo_plugin/plugin.py +++ b/mkdocs_mdpo_plugin/plugin.py @@ -461,7 +461,7 @@ def on_page_markdown(self, markdown, page, config, files): ][language] temp_abs_dirpath = os.path.dirname(temp_abs_path) os.makedirs(temp_abs_dirpath, exist_ok=True) - with open(temp_abs_path, 'w') as f: + with open(temp_abs_path, 'w', encoding='utf-8') as f: f.write(content) new_file = mkdocs.structure.files.File( @@ -732,7 +732,7 @@ def on_post_page(self, output, page, config): ) + '/' self.translations.locations[location] = page.file._mdpo_language - with open(render_path, 'w') as f: + with open(render_path, 'w', encoding='utf-8') as f: f.write(output) return output diff --git a/mkdocs_mdpo_plugin/search_indexes.py b/mkdocs_mdpo_plugin/search_indexes.py index 05a1e61..f659bcc 100644 --- a/mkdocs_mdpo_plugin/search_indexes.py +++ b/mkdocs_mdpo_plugin/search_indexes.py @@ -84,7 +84,7 @@ def _material_patch_worker_js_files(files, language): '/search/search_index.json', f'/search/search_index_{language}.json', ) - with open(new_path, 'w') as f: + with open(new_path, 'w', encoding='utf-8') as f: f.write(new_content) @@ -100,7 +100,7 @@ def _mkdocs_patch_worker_js_files(files, language): 'search_index.json', f'search_index_{language}.json', ) - with open(new_worker_js_path, 'w') as f: + with open(new_worker_js_path, 'w', encoding='utf-8') as f: f.write(new_worker_js_content) new_main_js_path = _language_extension_path( @@ -112,7 +112,7 @@ def _mkdocs_patch_worker_js_files(files, language): 'worker.js', f'worker_{language}.js', ) - with open(new_main_js_path, 'w') as f: + with open(new_main_js_path, 'w', encoding='utf-8') as f: f.write(new_main_js_content) @@ -142,7 +142,7 @@ def _material_patch_html_file(fpath, language, worker_files): f'{worker_js_fname}', f'{worker_js_fname_lang}', ) - with open(fpath, 'w') as f: + with open(fpath, 'w', encoding='utf-8') as f: f.write(new_content) @@ -154,7 +154,7 @@ def _mkdocs_patch_html_file(fpath, language, *args): 'search/main.js', f'search/main_{language}.js', ) - with open(fpath, 'w') as f: + with open(fpath, 'w', encoding='utf-8') as f: f.write(new_content) @@ -206,7 +206,7 @@ def _reathedocs_patch_search_files( f'search/main_{default_language}.js', f'search/main_{language}.js', ) - with open(lang_search_path, 'w') as f: + with open(lang_search_path, 'w', encoding='utf-8') as f: f.write(lang_search_path_content) # patch search file URL in language file @@ -216,7 +216,7 @@ def _reathedocs_patch_search_files( 'search.html', f'search_{language}.html', ) - with open(fpath, 'w') as f: + with open(fpath, 'w', encoding='utf-8') as f: f.write(new_content) @@ -369,7 +369,7 @@ def _create_lang_search_index_json(self, language, records): language, ) with open(new_path, 'w') as f: - f.write(json.dumps(search_index)) + json.dump(search_index, f) def _get_html_files_by_language(self): language_files = {language: [] for language in self.languages} diff --git a/setup.cfg b/setup.cfg index 4ec3714..c0f5dbb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mkdocs_mdpo_plugin -version = 0.0.26 +version = 0.0.27 description = Mkdocs plugin for translations using PO files. long_description = file: README.md long_description_content_type = text/markdown