diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index fade55c631..0e25a42080 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -84,6 +84,9 @@ jobs: - name: Check with csslint if: always() run: python -m tox -e csslint + - name: Check with codespell + if: always() + run: python -m tox -e codespell translation: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 986bb402f2..ee05b63392 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ user guide. - Build static HTML files from Markdown files. - Use Plugins and Markdown Extensions to enhance MkDocs. -- Use the build-in themes, third party themes or create your own. +- Use the built-in themes, third party themes or create your own. - Publish your documentation anywhere that static files can be served. - Much more! @@ -27,11 +27,18 @@ user guide. If you need help with MkDocs, do not hesitate to get in contact with us! -You can either open a [Discussion] to ask questions or create an [Issue] to -report a bug or make a feature request. Please note that we may only provide +- For questions and high-level discussions, use **[Discussions]** on GitHub. + - For small questions, a good alternative is the **[Chat room]** on + Gitter/Matrix (**new!**) +- To report a bug or make a feature request, open an **[Issue]** on GitHub. + +Please note that we may only provide support for problems/questions regarding core features of MkDocs. Any questions or bug reports about features of third-party themes, plugins, -extensions or similar should be made to their respective projects. +extensions or similar should be made to their respective projects. +But, such questions are *not* banned from the [chat room]. + +Make sure to stick around to answer some questions as well! ## Links @@ -60,7 +67,8 @@ discussion forums is expected to follow the [PyPA Code of Conduct]. [mkdocs]: https://www.mkdocs.org [Issue]: https://github.com/mkdocs/mkdocs/issues -[Discussion]: https://github.com/mkdocs/mkdocs/discussions +[Discussions]: https://github.com/mkdocs/mkdocs/discussions +[Chat room]: https://gitter.im/mkdocs/community [release-notes]: https://www.mkdocs.org/about/release-notes/ [wiki]: https://github.com/mkdocs/mkdocs/wiki [Contributing Guide]: https://www.mkdocs.org/about/contributing/ diff --git a/docs/about/contributing.md b/docs/about/contributing.md index 7576d3ae4a..670379cf7e 100644 --- a/docs/about/contributing.md +++ b/docs/about/contributing.md @@ -61,7 +61,7 @@ root of your MkDocs repository. It will attempt to run the tests against all of the Python versions we support. So don't be concerned if you are missing some and they fail. The rest -will be verified by [Travis] when you submit a pull request. +will be verified by [Github Actions] when you submit a pull request. ## Translating themes @@ -70,7 +70,10 @@ Themes]. We welcome translation Pull Requests! ## Submitting Pull Requests -Once you are happy with your changes or you are ready for some feedback, push +If you're considering a large code contribution to MkDocs, please prefer to +open an issue first to get early feedback on the idea. + +Once you think the code is ready to be reviewed, push it to your fork and send a pull request. For a change to be accepted it will most likely need to have tests and documentation if it is a new feature. @@ -104,7 +107,7 @@ Themes] for details. [virtualenv]: https://virtualenv.pypa.io/en/latest/user_guide.html [pip]: https://pip.pypa.io/en/stable/ [tox]: https://tox.readthedocs.io/en/latest/ -[travis]: https://travis-ci.org/repositories +[Github Actions]: https://docs.github.com/actions [PyPA Code of Conduct]: https://www.pypa.io/en/latest/code-of-conduct/ [Translating Themes]: ../dev-guide/translations.md -[Jinja's i18n extension]: https://jinja.palletsprojects.com/en/master/extensions/#i18n-extension +[Jinja's i18n extension]: https://jinja.palletsprojects.com/en/latest/extensions/#i18n-extension diff --git a/docs/about/release-notes.md b/docs/about/release-notes.md index 33e75ad6dd..64aee9f6c3 100644 --- a/docs/about/release-notes.md +++ b/docs/about/release-notes.md @@ -21,6 +21,33 @@ The current and past members of the MkDocs team. * [@d0ugal](https://github.com/d0ugal/) * [@waylan](https://github.com/waylan/) +## Version 1.2.3 (2021-10-12) + +* Built-in themes now also support these languages: + * Simplified Chinese (#2497) + * Japanese (#2525) + * Brazilian Portuguese (#2535) + * Spanish (#2545, previously #2396) + +* Third-party plugins will take precedence over built-in plugins with the same + name (#2591) + +* Bugfix: Fix ability to load translations for some languages: + core support (#2565) and search plugin support with fallbacks (#2602) + +* Bugfix (regression in 1.2): Prevent directory traversal in the dev server + (#2604) + +* Bugfix (regression in 1.2): Prevent webserver warnings from being treated as + a build failure in strict mode (#2607) + +* Bugfix: Correctly print colorful messages in the terminal on Windows (#2606) + +* Bugfix: Python version 3.10 was displayed incorrectly in `--version` (#2618) + +Other small improvements; see +[commit log](https://github.com/mkdocs/mkdocs/compare/1.2.2...1.2.3). + ## Version 1.2.2 (2021-07-18) * Bugfix (regression in 1.2): Fix serving files/paths with Unicode characters diff --git a/docs/dev-guide/plugins.md b/docs/dev-guide/plugins.md index 1196844e60..79ed297950 100644 --- a/docs/dev-guide/plugins.md +++ b/docs/dev-guide/plugins.md @@ -211,7 +211,7 @@ entire site. ##### on_env : The `env` event is called after the Jinja template environment is created - and can be used to alter the [Jinja environment](https://jinja.palletsprojects.com/en/master/api/#jinja2.Environment). + and can be used to alter the [Jinja environment](https://jinja.palletsprojects.com/en/latest/api/#jinja2.Environment). Parameters: : __env:__ global Jinja environment @@ -441,7 +441,7 @@ class MyPlugin(BasePlugin): ### Entry Point Plugins need to be packaged as Python libraries (distributed on PyPI separate -from MkDocs) and each must register as a Plugin via a setuptools entry_point. +from MkDocs) and each must register as a Plugin via a setuptools `entry_points`. Add the following to your `setup.py` script: ```python @@ -457,7 +457,7 @@ The `pluginname` would be the name used by users (in the config file) and (`from path.to.some_plugin import SomePluginClass`) where `SomePluginClass` is a subclass of [BasePlugin] which defines the plugin behavior. Naturally, multiple Plugin classes could exist in the same module. Simply define each as a separate -entry_point. +entry point. ```python entry_points={ diff --git a/docs/dev-guide/themes.md b/docs/dev-guide/themes.md index 5e6607a9fd..9e72171603 100644 --- a/docs/dev-guide/themes.md +++ b/docs/dev-guide/themes.md @@ -562,7 +562,7 @@ And then displayed with this HTML in the custom theme. ## Template Filters -In addition to Jinja's default filters, the following custom filters are +In addition to [Jinja's default filters], the following custom filters are available to use in MkDocs templates: ### url @@ -698,6 +698,7 @@ index when it is available. The `index` object was new in MkDocs version *1.0*. [lunr.js]: https://lunrjs.com/ [site_dir]: ../user-guide/configuration.md#site_dir [prebuild_index]: ../user-guide/configuration.md#prebuild_index +[Jinja's default filters]: https://jinja.palletsprojects.com/en/latest/templates/#builtin-filters ## Packaging Themes @@ -778,9 +779,9 @@ setup( Fill in the URL, license, description, author and author email address. -The name should follow the convention `mkdocs-themename` (like `mkdocs- -bootstrap` and `mkdocs-bootswatch`), starting with MkDocs, using hyphens to -separate words and including the name of your theme. +The name should follow the convention `mkdocs-themename` (like +`mkdocs-bootstrap` and `mkdocs-bootswatch`), starting with MkDocs, using +hyphens to separate words and including the name of your theme. Most of the rest of the file can be left unedited. The last section we need to change is the entry_points. This is how MkDocs finds the theme(s) you are @@ -876,7 +877,8 @@ special options which alters its behavior: #### extends Defines a parent theme that this theme inherits from. The value should be - the string name of the parent theme. Normal Jinja inheritance rules apply. + the string name of the parent theme. Normal [Jinja inheritance rules] + apply. Plugins may also define some options which allow the theme to inform a plugin about which set of plugin options it expects. See the documentation for any @@ -902,6 +904,7 @@ documentation for [Packaging and Distributing Projects]. [Packaging and Distributing Projects]: https://packaging.python.org/en/latest/distributing/ [theme]: ../user-guide/configuration.md#theme +[Jinja inheritance rules]: https://jinja.palletsprojects.com/en/latest/templates/#template-inheritance ## Supporting theme Localization/Translation diff --git a/docs/index.md b/docs/index.md index 43cebdb0bf..f58af71789 100644 --- a/docs/index.md +++ b/docs/index.md @@ -33,7 +33,8 @@ configuration file. Start by reading the [introductory tutorial], then check the href="user-guide/choosing-your-theme/#mkdocs">mkdocs and readthedocs, select one of the third-party themes listed on the MkDocs Themes wiki page, or build your + href="https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes">MkDocs + Themes wiki page, or build your own.

diff --git a/docs/user-guide/choosing-your-theme.md b/docs/user-guide/choosing-your-theme.md index d62dbf9ad1..f167b7396e 100644 --- a/docs/user-guide/choosing-your-theme.md +++ b/docs/user-guide/choosing-your-theme.md @@ -102,6 +102,9 @@ supports the following options: * `en`: English (default) * `fr`: French * `es`: Spanish + * `ja`: Japanese + * `pt_BR`: Portuguese (Brazil) + * `zh_CN`: Simplified Chinese See the guide on [localizing your theme] for more information. @@ -174,6 +177,9 @@ theme supports the following options: * `en`: English (default) * `fr`: French * `es`: Spanish + * `ja`: Japanese + * `pt_BR`: Portuguese (Brazil) + * `zh_CN`: Simplified Chinese See the guide on [localizing your theme] for more information. diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md index 91a44f7abf..d7da01eaa6 100644 --- a/docs/user-guide/configuration.md +++ b/docs/user-guide/configuration.md @@ -6,8 +6,9 @@ Guide to all available configuration settings. ## Introduction -Project settings are always configured by using a YAML configuration file in the -project directory named `mkdocs.yml`. +Project settings are configured by default using a YAML configuration file in +the project directory named `mkdocs.yml`. You can specify another path for it +by using the `-f`/`--config-file` option (see `mkdocs build --help`). As a minimum, this configuration file must contain the `site_name` and `site_url` settings. All other settings are optional. @@ -35,7 +36,7 @@ subdirectory in the setting (`https://example.com/foo/`). This setting is also used for `mkdocs serve`: the server will be mounted onto a path taken from the path component of the URL, e.g. `some/page.md` will be -served from `http://127.0.0.1:8000/foo/some/page/` to mimick the expected remote +served from `http://127.0.0.1:8000/foo/some/page/` to mimic the expected remote layout. **default**: `null` @@ -619,7 +620,7 @@ themes do). Set to `true` to enable. This option requires that [Node.js] be installed and the command `node` be on the system path. If the call to `node` fails for any reason, a warning - is issued and the build continues uninterupted. You may use the `--strict` + is issued and the build continues uninterrupted. You may use the `--strict` flag when building to cause such a failure to raise an error instead. !!! Note diff --git a/docs/user-guide/installation.md b/docs/user-guide/installation.md index 2748f6fd89..996979e45f 100644 --- a/docs/user-guide/installation.md +++ b/docs/user-guide/installation.md @@ -6,7 +6,7 @@ A detailed guide. ## Requirements -MkDocs requires a recent version of [Python] and the the Python package +MkDocs requires a recent version of [Python] and the Python package manager, [pip], to be installed on your system. You can check if you already have these installed from the command line: diff --git a/docs/user-guide/localizing-your-theme.md b/docs/user-guide/localizing-your-theme.md index f52b9648f9..2e5eba8ad4 100644 --- a/docs/user-guide/localizing-your-theme.md +++ b/docs/user-guide/localizing-your-theme.md @@ -23,7 +23,7 @@ pip install mkdocs[i18n] ## Supported locales -In most cases a locale is designated by the ISO-639-1 (2-letter) abbreviation +In most cases a locale is designated by the [ISO-639-1] (2-letter) abbreviation for your language. However, a locale may also include a territory (or region or county) code as well. The language and territory must be separated by an underscore. For example, some possible locales for English might include `en`, @@ -64,3 +64,4 @@ contribute a translation using the [Translation Guide]. [readthedocs]: choosing-your-theme.md#readthedocs-locale [locale]: configuration.md#locale [theme]: configuration.md#theme +[ISO-639-1]: https://en.wikipedia.org/wiki/ISO_639-1 diff --git a/mkdocs/__init__.py b/mkdocs/__init__.py index 4cf6396858..69760b0649 100644 --- a/mkdocs/__init__.py +++ b/mkdocs/__init__.py @@ -2,4 +2,4 @@ # For acceptable version formats, see https://www.python.org/dev/peps/pep-0440/ -__version__ = '1.2.2' +__version__ = '1.2.3' diff --git a/mkdocs/__main__.py b/mkdocs/__main__.py index a97014d1ae..4afd164b14 100644 --- a/mkdocs/__main__.py +++ b/mkdocs/__main__.py @@ -12,6 +12,15 @@ from mkdocs import config from mkdocs.commands import build, gh_deploy, new, serve + +if sys.platform.startswith("win"): + try: + import colorama + except ImportError: + pass + else: + colorama.init() + log = logging.getLogger(__name__) @@ -63,11 +72,6 @@ def __init__(self, log_name='mkdocs', level=logging.INFO): self.stream.name = 'MkDocsStreamHandler' self.logger.addHandler(self.stream) - # Add CountHandler for strict mode - self.counter = utils.log_counter - self.counter.setLevel(logging.WARNING) - self.logger.addHandler(self.counter) - pass_state = click.make_pass_decorator(State, ensure=True) @@ -142,7 +146,7 @@ def callback(ctx, param, value): click.option('--use-directory-urls/--no-directory-urls', is_flag=True, default=None, help=use_directory_urls_help) ]) -PYTHON_VERSION = sys.version[:3] +PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}" PKG_DIR = os.path.dirname(os.path.abspath(__file__)) diff --git a/mkdocs/commands/build.py b/mkdocs/commands/build.py index 8936197df4..1fd3182644 100644 --- a/mkdocs/commands/build.py +++ b/mkdocs/commands/build.py @@ -240,8 +240,16 @@ def _build_page(page, config, doc_files, nav, env, dirty=False): def build(config, live_server=False, dirty=False): """ Perform a full site build. """ - try: + logger = logging.getLogger('mkdocs') + + # Add CountHandler for strict mode + warning_counter = utils.CountHandler() + warning_counter.setLevel(logging.WARNING) + if config['strict']: + logging.getLogger('mkdocs').addHandler(warning_counter) + + try: from time import time start = time() @@ -308,8 +316,8 @@ def build(config, live_server=False, dirty=False): # Run `post_build` plugin events. config['plugins'].run_event('post_build', config=config) - counts = utils.log_counter.get_counts() - if config['strict'] and len(counts): + counts = warning_counter.get_counts() + if counts: msg = ', '.join([f'{v} {k.lower()}s' for k, v in counts]) raise Abort(f'\nAborted with {msg} in strict mode!') @@ -323,6 +331,9 @@ def build(config, live_server=False, dirty=False): raise Abort('\nAborted with a BuildError!') raise + finally: + logger.removeHandler(warning_counter) + def site_directory_contains_stale_files(site_directory): """ Check if the site directory contains stale files from a previous build. """ diff --git a/mkdocs/config/config_options.py b/mkdocs/config/config_options.py index 43039f87b1..f0ec7d2cb6 100644 --- a/mkdocs/config/config_options.py +++ b/mkdocs/config/config_options.py @@ -549,7 +549,7 @@ class MarkdownExtensions(OptionallyRequired): A string must be a valid Markdown extension name with no config options defined. The key of a dict item must be a valid Markdown extension name and the value must be a dict of config options for that extension. Extension configs are set on the private setting passed to - `configkey`. The `builtins` keyword accepts a list of extensions which cannot be overriden by + `configkey`. The `builtins` keyword accepts a list of extensions which cannot be overridden by the user. However, builtins can be duplicated to define config options for them if desired. """ def __init__(self, builtins=None, configkey='mdx_configs', **kwargs): super().__init__(**kwargs) diff --git a/mkdocs/contrib/search/__init__.py b/mkdocs/contrib/search/__init__.py index 1ca09863e0..66eb92d88a 100644 --- a/mkdocs/contrib/search/__init__.py +++ b/mkdocs/contrib/search/__init__.py @@ -13,20 +13,29 @@ class LangOption(config_options.OptionallyRequired): """ Validate Language(s) provided in config are known languages. """ - def lang_file_exists(self, lang): - path = os.path.join(base_path, 'lunr-language', f'lunr.{lang}.js') - return os.path.isfile(path) + def get_lunr_supported_lang(self, lang): + for lang_part in lang.split("_"): + lang_part = lang_part.lower() + if os.path.isfile(os.path.join(base_path, 'lunr-language', f'lunr.{lang_part}.js')): + return lang_part def run_validation(self, value): if isinstance(value, str): value = [value] elif not isinstance(value, (list, tuple)): raise config_options.ValidationError('Expected a list of language codes.') - for lang in value: - if lang != 'en' and not self.lang_file_exists(lang): - raise config_options.ValidationError( - f'"{lang}" is not a supported language code.' - ) + for lang in list(value): + if lang != 'en': + lang_detected = self.get_lunr_supported_lang(lang) + if not lang_detected: + log.info(f"Option search.lang '{lang}' is not supported, falling back to 'en'") + value.remove(lang) + if 'en' not in value: + value.append('en') + elif lang_detected != lang: + value.remove(lang) + value.append(lang_detected) + log.info(f"Option search.lang '{lang}' switched to '{lang_detected}'") return value diff --git a/mkdocs/livereload/__init__.py b/mkdocs/livereload/__init__.py index c9f7afa8e7..998022de7e 100644 --- a/mkdocs/livereload/__init__.py +++ b/mkdocs/livereload/__init__.py @@ -4,6 +4,7 @@ import mimetypes import os import os.path +import posixpath import re import socketserver import threading @@ -183,9 +184,11 @@ def condition(): if path == "/js/livereload.js": file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "livereload.js") elif path.startswith(self.mount_path): - rel_file_path = path[len(self.mount_path):].lstrip("/") + rel_file_path = path[len(self.mount_path):] if path.endswith("/"): rel_file_path += "index.html" + # Prevent directory traversal - normalize the path. + rel_file_path = posixpath.normpath("/" + rel_file_path).lstrip("/") file_path = os.path.join(self.root, rel_file_path) elif path == "/": start_response("302 Found", [("Location", self.mount_path)]) diff --git a/mkdocs/localization.py b/mkdocs/localization.py index 42ddbd6ac7..6f772ec3d4 100644 --- a/mkdocs/localization.py +++ b/mkdocs/localization.py @@ -56,9 +56,13 @@ def _get_merged_translations(theme_dirs, locales_dir, locale): merged_translations = None log.debug(f"Looking for translations for locale '{locale}'") + if locale.territory: + locale_str = f"{locale.language}_{locale.territory}" + else: + locale_str = locale.language for theme_dir in reversed(theme_dirs): dirname = os.path.join(theme_dir, locales_dir) - translations = Translations.load(dirname, [locale]) + translations = Translations.load(dirname, [locale_str]) if type(translations) is NullTranslations: log.debug(f"No translations found here: '{dirname}'") diff --git a/mkdocs/plugins.py b/mkdocs/plugins.py index 117e182f83..8cd60e2d36 100644 --- a/mkdocs/plugins.py +++ b/mkdocs/plugins.py @@ -26,7 +26,15 @@ def get_plugins(): plugins = importlib_metadata.entry_points(group='mkdocs.plugins') - return {plugin.name: plugin for plugin in plugins} + # Allow third-party plugins to override core plugins + pluginmap = {} + for plugin in plugins: + if plugin.name in pluginmap and plugin.value.startswith("mkdocs.contrib."): + continue + + pluginmap[plugin.name] = plugin + + return pluginmap class BasePlugin: diff --git a/mkdocs/structure/files.py b/mkdocs/structure/files.py index 0a0ec786d0..2626462595 100644 --- a/mkdocs/structure/files.py +++ b/mkdocs/structure/files.py @@ -1,7 +1,6 @@ import fnmatch import os import logging -from functools import cmp_to_key from urllib.parse import quote as urlquote from mkdocs import utils @@ -142,6 +141,11 @@ def __eq__(self, other): def __ne__(self, other): return not self.__eq__(other) + def __repr__(self): + return "File(src_path='{}', dest_path='{}', name='{}', url='{}')".format( + self.src_path, self.dest_path, self.name, self.url + ) + def _get_stem(self): """ Return the name of the file without it's extension. """ filename = os.path.basename(self.src_path) @@ -252,16 +256,12 @@ def get_files(config): def _sort_files(filenames): """ Always sort `index` or `README` as first filename in list. """ - def compare(x, y): - if x == y: - return 0 - if os.path.splitext(y)[0] in ['index', 'README']: - return 1 - if os.path.splitext(x)[0] in ['index', 'README'] or x < y: - return -1 - return 1 + def key(f): + if os.path.splitext(f)[0] in ['index', 'README']: + return (0,) + return (1, f) - return sorted(filenames, key=cmp_to_key(compare)) + return sorted(filenames, key=key) def _filter_paths(basename, path, is_dir, exclude): diff --git a/mkdocs/tests/build_tests.py b/mkdocs/tests/build_tests.py index 00809795e2..87795e7fb1 100644 --- a/mkdocs/tests/build_tests.py +++ b/mkdocs/tests/build_tests.py @@ -24,20 +24,6 @@ def build_page(title, path, config, md_src=''): class BuildTests(PathAssertionMixin, unittest.TestCase): - def assert_mock_called_once(self, mock): - """assert that the mock was called only once. - - The `mock.assert_called_once()` method was added in PY36. - TODO: Remove this when PY35 support is dropped. - """ - try: - mock.assert_called_once() - except AttributeError: - if not mock.call_count == 1: - mock_name = mock._mock_name or 'mock' - msg = f"Expected '{mock_name}' to have been called once. Called {self.call_count} times." - raise AssertionError(msg) - def _get_env_with_null_translations(self, config): env = config['theme'].get_env() env.add_extension('jinja2.ext.i18n') @@ -204,8 +190,8 @@ def test_build_theme_template(self, mock_build_template, mock_write_file): cfg = load_config() env = cfg['theme'].get_env() build._build_theme_template('main.html', env, mock.Mock(), cfg, mock.Mock()) - self.assert_mock_called_once(mock_write_file) - self.assert_mock_called_once(mock_build_template) + mock_write_file.assert_called_once() + mock_build_template.assert_called_once() @mock.patch('mkdocs.utils.write_file') @mock.patch('mkdocs.commands.build._build_template', return_value='some content') @@ -214,9 +200,9 @@ def test_build_sitemap_template(self, mock_gzip_gzipfile, mock_build_template, m cfg = load_config() env = cfg['theme'].get_env() build._build_theme_template('sitemap.xml', env, mock.Mock(), cfg, mock.Mock()) - self.assert_mock_called_once(mock_write_file) - self.assert_mock_called_once(mock_build_template) - self.assert_mock_called_once(mock_gzip_gzipfile) + mock_write_file.assert_called_once() + mock_build_template.assert_called_once() + mock_gzip_gzipfile.assert_called_once() @mock.patch('mkdocs.utils.write_file') @mock.patch('mkdocs.commands.build._build_template', return_value='') @@ -244,7 +230,7 @@ def test_skip_theme_template_empty_output(self, mock_build_template, mock_write_ ["INFO:mkdocs.commands.build:Template skipped: 'main.html' generated empty output."] ) mock_write_file.assert_not_called() - self.assert_mock_called_once(mock_build_template) + mock_build_template.assert_called_once() # Test build._build_extra_template @@ -339,7 +325,7 @@ def test_populate_page_read_error(self, docs_dir, mock_open): "ERROR:mkdocs.commands.build:Error reading page 'missing.md': Error message." ] ) - self.assert_mock_called_once(mock_open) + mock_open.assert_called_once() @tempdir(files={'index.md': 'page content'}) @mock.patch('mkdocs.plugins.PluginCollection.run_event', side_effect=PluginError('Error message.')) @@ -354,7 +340,7 @@ def test_populate_page_read_plugin_error(self, docs_dir, mock_open): "ERROR:mkdocs.commands.build:Error reading page 'index.md':" ] ) - self.assert_mock_called_once(mock_open) + mock_open.assert_called_once() # Test build._build_page @@ -390,7 +376,7 @@ def test_build_page(self, site_dir): # cm.output, # ["INFO:mkdocs.commands.build:Page skipped: 'index.md'. Generated empty output."] # ) - # self.assert_mock_called_once(mock_template.render) + # mock_template.render.assert_called_once() # self.assertPathNotFile(site_dir, 'index.html') @tempdir(files={'index.md': 'page content'}) @@ -420,7 +406,7 @@ def test_build_page_dirty_not_modified(self, site_dir, mock_write_file): page.markdown = 'page content' page.content = '

page content

' build._build_page(page, cfg, files, nav, self._get_env_with_null_translations(cfg), dirty=True) - self.assert_mock_called_once(mock_write_file) + mock_write_file.assert_called_once() @tempdir() def test_build_page_custom_template(self, site_dir): @@ -461,7 +447,7 @@ def test_build_page_error(self, site_dir, mock_write_file): cm.output, ["ERROR:mkdocs.commands.build:Error building page 'index.md': Error message."] ) - self.assert_mock_called_once(mock_write_file) + mock_write_file.assert_called_once() @tempdir() @mock.patch('mkdocs.plugins.PluginCollection.run_event', side_effect=PluginError('Error message.')) @@ -480,7 +466,7 @@ def test_build_page_plugin_error(self, site_dir, mock_write_file): cm.output, ["ERROR:mkdocs.commands.build:Error building page 'index.md':"] ) - self.assert_mock_called_once(mock_write_file) + mock_write_file.assert_called_once() # Test build.build diff --git a/mkdocs/tests/config/config_options_tests.py b/mkdocs/tests/config/config_options_tests.py index e94ee46d72..64996aee9a 100644 --- a/mkdocs/tests/config/config_options_tests.py +++ b/mkdocs/tests/config/config_options_tests.py @@ -197,18 +197,6 @@ def test_default_address(self): self.assertEqual(value.host, '127.0.0.1') self.assertEqual(value.port, 8000) - @unittest.skipIf( - sys.version_info >= (3, 9, 5), - "Leading zeros not allowed in IP addresses since Python3.9.5", - ) - def test_IP_normalization(self): - addr = '127.000.000.001:8000' - option = config_options.IpAddress(default=addr) - value = option.validate(None) - self.assertEqual(str(value), '127.0.0.1:8000') - self.assertEqual(value.host, '127.0.0.1') - self.assertEqual(value.port, 8000) - @unittest.skipIf( sys.version_info < (3, 9, 5), "Leading zeros allowed in IP addresses before Python3.9.5", diff --git a/mkdocs/tests/gh_deploy_tests.py b/mkdocs/tests/gh_deploy_tests.py index efb87b25e0..f2301df803 100644 --- a/mkdocs/tests/gh_deploy_tests.py +++ b/mkdocs/tests/gh_deploy_tests.py @@ -10,20 +10,6 @@ class TestGitHubDeploy(unittest.TestCase): - def assert_mock_called_once(self, mock): - """assert that the mock was called only once. - - The `mock.assert_called_once()` method was added in PY36. - TODO: Remove this when PY35 support is dropped. - """ - try: - mock.assert_called_once() - except AttributeError: - if not mock.call_count == 1: - mock_name = mock._mock_name or 'mock' - msg = f"Expected '{mock_name}' to have been called once. Called {self.call_count} times." - raise AssertionError(msg) - @mock.patch('subprocess.Popen') def test_is_cwd_git_repo(self, mock_popeno): @@ -128,7 +114,7 @@ def test_deploy_ignore_version_default(self, mock_import, check_version, get_rem remote_branch='test', ) gh_deploy.gh_deploy(config) - self.assert_mock_called_once(check_version) + check_version.assert_called_once() @mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True) @mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas') diff --git a/mkdocs/tests/search_tests.py b/mkdocs/tests/search_tests.py index 596da48e8d..439faea741 100644 --- a/mkdocs/tests/search_tests.py +++ b/mkdocs/tests/search_tests.py @@ -60,11 +60,18 @@ def test_lang_bad_type(self): def test_lang_bad_code(self): option = search.LangOption() - self.assertRaises(ValidationError, option.validate, ['foo']) + value = option.validate(['foo']) + self.assertEqual(['en'], value) def test_lang_good_and_bad_code(self): option = search.LangOption() - self.assertRaises(ValidationError, option.validate, ['en', 'foo']) + value = option.validate(['en', 'foo']) + self.assertEqual(['en'], value) + + def test_lang_missing_and_with_territory(self): + option = search.LangOption() + value = option.validate(['zh_CN', 'pt_BR', 'fr']) + self.assertEqual(['fr', 'en', 'pt'], value) class SearchPluginTests(unittest.TestCase): diff --git a/mkdocs/tests/structure/page_tests.py b/mkdocs/tests/structure/page_tests.py index 86bd0f1a23..095f4f11ae 100644 --- a/mkdocs/tests/structure/page_tests.py +++ b/mkdocs/tests/structure/page_tests.py @@ -806,17 +806,17 @@ def test_no_links(self): '

not a link.

' ) - @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](non-existant.md)')) + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](non-existent.md)')) def test_bad_relative_html_link(self): with self.assertLogs('mkdocs', level='WARNING') as cm: self.assertEqual( self.get_rendered_result(['index.md']), - '

link

' + '

link

' ) self.assertEqual( cm.output, ["WARNING:mkdocs.structure.pages:Documentation file 'index.md' contains a link " - "to 'non-existant.md' which is not found in the documentation files."] + "to 'non-existent.md' which is not found in the documentation files."] ) @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[external](http://example.com/index.md)')) diff --git a/mkdocs/themes/mkdocs/js/base.js b/mkdocs/themes/mkdocs/js/base.js index 8ba6faa1cf..b0f4726bf1 100644 --- a/mkdocs/themes/mkdocs/js/base.js +++ b/mkdocs/themes/mkdocs/js/base.js @@ -30,7 +30,7 @@ $(document).ready(function() { $search_modal.modal(); } - // make sure search input gets autofocus everytime modal opens. + // make sure search input gets autofocus every time modal opens. $search_modal.on('shown.bs.modal', function() { $search_modal.find('#mkdocs-search-query').focus(); }); diff --git a/mkdocs/themes/mkdocs/locales/es/LC_MESSAGES/messages.po b/mkdocs/themes/mkdocs/locales/es/LC_MESSAGES/messages.po index 5743383f2f..cdd0beef32 100644 --- a/mkdocs/themes/mkdocs/locales/es/LC_MESSAGES/messages.po +++ b/mkdocs/themes/mkdocs/locales/es/LC_MESSAGES/messages.po @@ -78,8 +78,8 @@ msgstr "Página anterior" #: mkdocs/themes/mkdocs/search-modal.html:9 msgid "From here you can search these documents. Enter your search terms below." msgstr "" -"Desde aquí puede buscar estos documentos. Ingrese sus términos de búsqueda a " -"continuación." +"Desde aquí puede buscar estos documentos. Ingrese sus términos de " +"búsqueda a continuación." #: mkdocs/themes/mkdocs/search-modal.html:12 msgid "Search..." @@ -96,3 +96,4 @@ msgstr "No se encontraron resultados" #: mkdocs/themes/mkdocs/toc.html:3 msgid "Table of Contents" msgstr "Tabla de contenidos" + diff --git a/mkdocs/themes/mkdocs/locales/fr/LC_MESSAGES/messages.po b/mkdocs/themes/mkdocs/locales/fr/LC_MESSAGES/messages.po index 711164de31..daebed1bb7 100644 --- a/mkdocs/themes/mkdocs/locales/fr/LC_MESSAGES/messages.po +++ b/mkdocs/themes/mkdocs/locales/fr/LC_MESSAGES/messages.po @@ -6,15 +6,16 @@ msgid "" msgstr "" "Project-Id-Version: MkDocs 1.2\n" "Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" -"POT-Creation-Date: 2021-04-08 22:46+0200\n" +"POT-Creation-Date: 2021-04-08 22:44+0200\n" "PO-Revision-Date: 2021-02-23 23:56+0100\n" "Last-Translator: Alexys Jacob @ultrabug\n" "Language: fr\n" +"Language-Team: fr \n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.0\n" +"Generated-By: Babel 2.9.1\n" #: mkdocs/themes/mkdocs/404.html:8 msgid "Page not found" diff --git a/mkdocs/themes/mkdocs/locales/ja/LC_MESSAGES/messages.po b/mkdocs/themes/mkdocs/locales/ja/LC_MESSAGES/messages.po new file mode 100644 index 0000000000..1cce02221b --- /dev/null +++ b/mkdocs/themes/mkdocs/locales/ja/LC_MESSAGES/messages.po @@ -0,0 +1,97 @@ +# Japanese translations for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:44+0200\n" +"PO-Revision-Date: 2021-07-31 12:06+0900\n" +"Last-Translator: Goto Hayato \n" +"Language: ja\n" +"Language-Team: ja \n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/mkdocs/404.html:8 +msgid "Page not found" +msgstr "ページが見つかりません" + +#: mkdocs/themes/mkdocs/base.html:107 +#: mkdocs/themes/mkdocs/keyboard-modal.html:31 +#: mkdocs/themes/mkdocs/search-modal.html:5 +msgid "Search" +msgstr "検索" + +#: mkdocs/themes/mkdocs/base.html:117 +msgid "Previous" +msgstr "前へ" + +#: mkdocs/themes/mkdocs/base.html:122 +msgid "Next" +msgstr "次へ" + +#: mkdocs/themes/mkdocs/base.html:133 mkdocs/themes/mkdocs/base.html:135 +#: mkdocs/themes/mkdocs/base.html:137 mkdocs/themes/mkdocs/base.html:139 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "%(repo_name)s で編集" + +#: mkdocs/themes/mkdocs/base.html:179 +#, python-format +msgid "Documentation built with %(mkdocs_link)s." +msgstr "%(mkdocs_link)s でビルドされたドキュメンテーション" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:5 +msgid "Keyboard Shortcuts" +msgstr "キーボードショートカット" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:6 +#: mkdocs/themes/mkdocs/search-modal.html:6 +msgid "Close" +msgstr "閉じる" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:12 +msgid "Keys" +msgstr "キー" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:13 +msgid "Action" +msgstr "アクション" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:19 +msgid "Open this help" +msgstr "このヘルプを開く" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:23 +msgid "Next page" +msgstr "次のページ" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:27 +msgid "Previous page" +msgstr "前のページ" + +#: mkdocs/themes/mkdocs/search-modal.html:9 +msgid "From here you can search these documents. Enter your search terms below." +msgstr "これらのドキュメントをこちらから検索できます。検索語句を以下に入力してください。" + +#: mkdocs/themes/mkdocs/search-modal.html:12 +msgid "Search..." +msgstr "検索..." + +#: mkdocs/themes/mkdocs/search-modal.html:12 +msgid "Type search term here" +msgstr "検索語句を入力してください" + +#: mkdocs/themes/mkdocs/search-modal.html:15 +msgid "No results found" +msgstr "結果がありません" + +#: mkdocs/themes/mkdocs/toc.html:3 +msgid "Table of Contents" +msgstr "目次" + diff --git a/mkdocs/themes/mkdocs/locales/pt_BR/LC_MESSAGES/messages.po b/mkdocs/themes/mkdocs/locales/pt_BR/LC_MESSAGES/messages.po new file mode 100644 index 0000000000..9034b9936b --- /dev/null +++ b/mkdocs/themes/mkdocs/locales/pt_BR/LC_MESSAGES/messages.po @@ -0,0 +1,99 @@ +# Portuguese (Brazil) translations for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:44+0200\n" +"PO-Revision-Date: 2021-09-07 12:06+0200\n" +"Last-Translator: Nicole Buitoni \n" +"Language: pt_BR\n" +"Language-Team: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/mkdocs/404.html:8 +msgid "Page not found" +msgstr "Página não encontrada" + +#: mkdocs/themes/mkdocs/base.html:107 +#: mkdocs/themes/mkdocs/keyboard-modal.html:31 +#: mkdocs/themes/mkdocs/search-modal.html:5 +msgid "Search" +msgstr "Buscar" + +#: mkdocs/themes/mkdocs/base.html:117 +msgid "Previous" +msgstr "Anterior" + +#: mkdocs/themes/mkdocs/base.html:122 +msgid "Next" +msgstr "Seguinte" + +#: mkdocs/themes/mkdocs/base.html:133 mkdocs/themes/mkdocs/base.html:135 +#: mkdocs/themes/mkdocs/base.html:137 mkdocs/themes/mkdocs/base.html:139 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "Editar em %(repo_name)s" + +#: mkdocs/themes/mkdocs/base.html:179 +#, python-format +msgid "Documentation built with %(mkdocs_link)s." +msgstr "Documentação construída com %(mkdocs_link)s." + +#: mkdocs/themes/mkdocs/keyboard-modal.html:5 +msgid "Keyboard Shortcuts" +msgstr "Atalhos de teclado" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:6 +#: mkdocs/themes/mkdocs/search-modal.html:6 +msgid "Close" +msgstr "Fechar" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:12 +msgid "Keys" +msgstr "Teclas" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:13 +msgid "Action" +msgstr "Ação" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:19 +msgid "Open this help" +msgstr "Abrir esta ajuda" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:23 +msgid "Next page" +msgstr "Próxima página" + +#: mkdocs/themes/mkdocs/keyboard-modal.html:27 +msgid "Previous page" +msgstr "Página anterior" + +#: mkdocs/themes/mkdocs/search-modal.html:9 +msgid "From here you can search these documents. Enter your search terms below." +msgstr "" +"A partir daqui você pode buscar pelo documento. Digite os termos de " +"pesquisa abaixo." + +#: mkdocs/themes/mkdocs/search-modal.html:12 +msgid "Search..." +msgstr "Buscando..." + +#: mkdocs/themes/mkdocs/search-modal.html:12 +msgid "Type search term here" +msgstr "Digite o termo a ser buscado aqui" + +#: mkdocs/themes/mkdocs/search-modal.html:15 +msgid "No results found" +msgstr "Não foram encontrados resultados" + +#: mkdocs/themes/mkdocs/toc.html:3 +msgid "Table of Contents" +msgstr "Tabela de Conteúdos" + diff --git a/mkdocs/themes/mkdocs/locales/zh_CN/LC_MESSAGES/messages.po b/mkdocs/themes/mkdocs/locales/zh_CN/LC_MESSAGES/messages.po index cf875a6ba5..b8cbce85ea 100644 --- a/mkdocs/themes/mkdocs/locales/zh_CN/LC_MESSAGES/messages.po +++ b/mkdocs/themes/mkdocs/locales/zh_CN/LC_MESSAGES/messages.po @@ -4,19 +4,18 @@ # msgid "" msgstr "" -"Project-Id-Version: MkDocs\n" +"Project-Id-Version: MkDocs 1.2\n" "Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" "POT-Creation-Date: 2021-04-08 22:44+0200\n" "PO-Revision-Date: 2021-07-14 06:00+0800\n" "Last-Translator: xingkong0113 \n" "Language: zh_CN\n" "Language-Team: zh_Hans_CN \n" -"Plural-Forms: nplurals=1; plural=0;\n" +"Plural-Forms: nplurals=1; plural=0\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -"X-Generator: Poedit 3.0\n" #: mkdocs/themes/mkdocs/404.html:8 msgid "Page not found" @@ -95,3 +94,4 @@ msgstr "没有搜索到结果" #: mkdocs/themes/mkdocs/toc.html:3 msgid "Table of Contents" msgstr "目录" + diff --git a/mkdocs/themes/readthedocs/css/theme_extra.css b/mkdocs/themes/readthedocs/css/theme_extra.css index ec7002a6b6..69d567d40e 100644 --- a/mkdocs/themes/readthedocs/css/theme_extra.css +++ b/mkdocs/themes/readthedocs/css/theme_extra.css @@ -122,7 +122,7 @@ form .search-query { /* * Account for wide tables which go off the side. - * Override borders to avoid wierdness on narrow tables. + * Override borders to avoid weirdness on narrow tables. * * https://github.com/mkdocs/mkdocs/issues/834 * https://github.com/mkdocs/mkdocs/pull/1034 diff --git a/mkdocs/themes/readthedocs/locales/es/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/es/LC_MESSAGES/messages.po index 5743383f2f..c2ee816814 100644 --- a/mkdocs/themes/readthedocs/locales/es/LC_MESSAGES/messages.po +++ b/mkdocs/themes/readthedocs/locales/es/LC_MESSAGES/messages.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: MkDocs 1.2\n" "Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" -"POT-Creation-Date: 2021-04-08 22:44+0200\n" +"POT-Creation-Date: 2021-04-08 22:46+0200\n" "PO-Revision-Date: 2021-05-07 12:06+0200\n" "Last-Translator: Álvaro Mondéjar Rubio \n" "Language: es\n" @@ -17,82 +17,63 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: mkdocs/themes/mkdocs/404.html:8 +#: mkdocs/themes/readthedocs/404.html:7 msgid "Page not found" msgstr "Página no encontrada" -#: mkdocs/themes/mkdocs/base.html:107 -#: mkdocs/themes/mkdocs/keyboard-modal.html:31 -#: mkdocs/themes/mkdocs/search-modal.html:5 -msgid "Search" -msgstr "Buscar" +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "Documentos" -#: mkdocs/themes/mkdocs/base.html:117 -msgid "Previous" -msgstr "Anterior" - -#: mkdocs/themes/mkdocs/base.html:122 -msgid "Next" -msgstr "Siguiente" - -#: mkdocs/themes/mkdocs/base.html:133 mkdocs/themes/mkdocs/base.html:135 -#: mkdocs/themes/mkdocs/base.html:137 mkdocs/themes/mkdocs/base.html:139 +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 #, python-format msgid "Edit on %(repo_name)s" msgstr "Editar en %(repo_name)s" -#: mkdocs/themes/mkdocs/base.html:179 -#, python-format -msgid "Documentation built with %(mkdocs_link)s." -msgstr "Documentación construida con %(mkdocs_link)s." - -#: mkdocs/themes/mkdocs/keyboard-modal.html:5 -msgid "Keyboard Shortcuts" -msgstr "Atajos de teclado" - -#: mkdocs/themes/mkdocs/keyboard-modal.html:6 -#: mkdocs/themes/mkdocs/search-modal.html:6 -msgid "Close" -msgstr "Cerrar" - -#: mkdocs/themes/mkdocs/keyboard-modal.html:12 -msgid "Keys" -msgstr "Teclas" - -#: mkdocs/themes/mkdocs/keyboard-modal.html:13 -msgid "Action" -msgstr "Acción" - -#: mkdocs/themes/mkdocs/keyboard-modal.html:19 -msgid "Open this help" -msgstr "Abrir esta ayuda" - -#: mkdocs/themes/mkdocs/keyboard-modal.html:23 -msgid "Next page" -msgstr "Página siguiente" +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "Siguiente" -#: mkdocs/themes/mkdocs/keyboard-modal.html:27 -msgid "Previous page" -msgstr "Página anterior" +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "Anterior" -#: mkdocs/themes/mkdocs/search-modal.html:9 -msgid "From here you can search these documents. Enter your search terms below." +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "" +"Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " +"%(rtd_link)s." msgstr "" -"Desde aquí puede buscar estos documentos. Ingrese sus términos de búsqueda a " -"continuación." +"Construído con %(mkdocs_link)s usando %(sphinx_link)s provisto " +"por%(rtd_link)s." -#: mkdocs/themes/mkdocs/search-modal.html:12 -msgid "Search..." -msgstr "Buscando..." +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "Resultados de búsqueda" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "Buscar en la documentación" -#: mkdocs/themes/mkdocs/search-modal.html:12 +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 msgid "Type search term here" msgstr "Escriba el término de búsqueda aquí" -#: mkdocs/themes/mkdocs/search-modal.html:15 +#: mkdocs/themes/readthedocs/search.html:12 msgid "No results found" msgstr "No se encontraron resultados" -#: mkdocs/themes/mkdocs/toc.html:3 -msgid "Table of Contents" -msgstr "Tabla de contenidos" +#: mkdocs/themes/readthedocs/search.html:13 +#, fuzzy +msgid "Searching..." +msgstr "Buscando..." + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "Buscar documentos" + diff --git a/mkdocs/themes/readthedocs/locales/fr/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/fr/LC_MESSAGES/messages.po index 4990c7be3f..b3409374e2 100644 --- a/mkdocs/themes/readthedocs/locales/fr/LC_MESSAGES/messages.po +++ b/mkdocs/themes/readthedocs/locales/fr/LC_MESSAGES/messages.po @@ -10,11 +10,12 @@ msgstr "" "PO-Revision-Date: 2021-02-23 23:56+0100\n" "Last-Translator: Alexys Jacob @ultrabug\n" "Language: fr\n" +"Language-Team: fr \n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.0\n" +"Generated-By: Babel 2.9.1\n" #: mkdocs/themes/readthedocs/404.html:7 msgid "Page not found" diff --git a/mkdocs/themes/readthedocs/locales/ja/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/ja/LC_MESSAGES/messages.po new file mode 100644 index 0000000000..e526548edf --- /dev/null +++ b/mkdocs/themes/readthedocs/locales/ja/LC_MESSAGES/messages.po @@ -0,0 +1,76 @@ +# Japanese translations for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:46+0200\n" +"PO-Revision-Date: 2021-07-31 12:07+0900\n" +"Last-Translator: Goto Hayato \n" +"Language: ja\n" +"Language-Team: ja \n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/readthedocs/404.html:7 +msgid "Page not found" +msgstr "ページが見つかりません" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "ドキュメント" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "%(repo_name)s で編集" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "次へ" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "前へ" + +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "" +"Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " +"%(rtd_link)s." +msgstr "%(rtd_link)s 提供の %(sphinx_link)s を使って %(mkdocs_link)s でビルドされました。" + +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "検索結果" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "ドキュメントを検索" + +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Type search term here" +msgstr "検索語句を入力してください" + +#: mkdocs/themes/readthedocs/search.html:12 +msgid "No results found" +msgstr "結果がありません" + +#: mkdocs/themes/readthedocs/search.html:13 +msgid "Searching..." +msgstr "検索しています..." + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "ドキュメントを検索" + diff --git a/mkdocs/themes/readthedocs/locales/pt_BR/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/pt_BR/LC_MESSAGES/messages.po new file mode 100644 index 0000000000..69e819d030 --- /dev/null +++ b/mkdocs/themes/readthedocs/locales/pt_BR/LC_MESSAGES/messages.po @@ -0,0 +1,77 @@ +# Portuguese (Brazil) translations for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:46+0200\n" +"PO-Revision-Date: 2021-09-07 12:06+0200\n" +"Last-Translator: Nicole Buitoni \n" +"Language: pt_BR\n" +"Language-Team: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/readthedocs/404.html:7 +msgid "Page not found" +msgstr "Página não encontrada" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "Editar em %(repo_name)s" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "Seguinte" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "Anterior" + +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "" +"Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " +"%(rtd_link)s." +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Type search term here" +msgstr "Digite o termo a ser buscado aqui" + +#: mkdocs/themes/readthedocs/search.html:12 +msgid "No results found" +msgstr "Não foram encontrados resultados" + +#: mkdocs/themes/readthedocs/search.html:13 +#, fuzzy +msgid "Searching..." +msgstr "Buscando..." + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "" + diff --git a/mkdocs/themes/readthedocs/locales/zh_CN/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/zh_CN/LC_MESSAGES/messages.po index 36c9f3ca98..6d6d8dd6fb 100644 --- a/mkdocs/themes/readthedocs/locales/zh_CN/LC_MESSAGES/messages.po +++ b/mkdocs/themes/readthedocs/locales/zh_CN/LC_MESSAGES/messages.po @@ -4,19 +4,18 @@ # msgid "" msgstr "" -"Project-Id-Version: MkDocs\n" +"Project-Id-Version: MkDocs 1.2\n" "Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" "POT-Creation-Date: 2021-04-08 22:46+0200\n" "PO-Revision-Date: 2021-07-14 06:01+0800\n" "Last-Translator: xingkong0113 \n" "Language: zh_CN\n" "Language-Team: zh_Hans_CN \n" -"Plural-Forms: nplurals=1; plural=0;\n" +"Plural-Forms: nplurals=1; plural=0\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -"X-Generator: Poedit 3.0\n" #: mkdocs/themes/readthedocs/404.html:7 msgid "Page not found" @@ -48,8 +47,7 @@ msgstr "上一张" msgid "" "Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " "%(rtd_link)s." -msgstr "" -"用%(mkdocs_link)s构建,使用%(rtd_link)s提供的%(sphinx_link)s。" +msgstr "用%(mkdocs_link)s构建,使用%(rtd_link)s提供的%(sphinx_link)s。" #: mkdocs/themes/readthedocs/search.html:5 msgid "Search Results" @@ -75,3 +73,4 @@ msgstr "搜索中..." #: mkdocs/themes/readthedocs/searchbox.html:3 msgid "Search docs" msgstr "搜索文档" + diff --git a/mkdocs/utils/__init__.py b/mkdocs/utils/__init__.py index d92a836178..4a7b6e8ad3 100644 --- a/mkdocs/utils/__init__.py +++ b/mkdocs/utils/__init__.py @@ -442,9 +442,6 @@ def get_counts(self): return [(logging.getLevelName(k), v) for k, v in sorted(self.counts.items(), reverse=True)] -# A global instance to use throughout package -log_counter = CountHandler() - # For backward compatibility as some plugins import it. # It is no longer necessary as all messages on the # `mkdocs` logger get counted automatically. diff --git a/requirements/project-min.txt b/requirements/project-min.txt index 2d9fce6178..20a9327df0 100644 --- a/requirements/project-min.txt +++ b/requirements/project-min.txt @@ -12,3 +12,4 @@ mkdocs-redirects==1.0.1 importlib_metadata==3.10.0 packaging==20.5 mergedeep==1.3.4 +colorama==0.4; platform_system == 'Windows' diff --git a/requirements/project.txt b/requirements/project.txt index 38b1b38e59..c8fd11335c 100644 --- a/requirements/project.txt +++ b/requirements/project.txt @@ -12,3 +12,4 @@ mkdocs-redirects>=1.0.1 importlib_metadata>=3.10 packaging>=20.5 mergedeep>=1.3.4 +colorama>=0.4; platform_system == 'Windows' diff --git a/tox.ini b/tox.ini index 6b7fe30714..ad890b636a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = py{36,37,38,39,py3}-{unittests,min-req,integration,integration-no-babel}, - flake8, markdown-lint, linkchecker, jshint, csslint, nobabel + flake8, markdown-lint, linkchecker, jshint, csslint, nobabel, codespell [testenv] passenv = LANG @@ -30,6 +30,11 @@ commands= markdownlint --version markdownlint README.md CONTRIBUTING.md docs/ --ignore docs/CNAME +[testenv:codespell] +deps=codespell +commands= + {envbindir}/codespell mkdocs docs *.* -S .tox -S LC_MESSAGES -S '*.min.js' -S 'lunr*.js' -S fontawesome-webfont.svg -S tinyseg.js + [testenv:linkchecker] basepython = python2.7 passenv=*