Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/docutils/parsers/rst/languages/__init__.py: 91%
11 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:06 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:06 +0000
1# $Id$
2# Author: David Goodger <goodger@python.org>
3# Copyright: This module has been placed in the public domain.
5# Internationalization details are documented in
6# <https://docutils.sourceforge.io/docs/howto/i18n.html>.
8"""
9This package contains modules for language-dependent features of
10reStructuredText.
11"""
13__docformat__ = 'reStructuredText'
16from docutils.languages import LanguageImporter
19class RstLanguageImporter(LanguageImporter):
20 """Import language modules.
22 When called with a BCP 47 language tag, instances return a module
23 with localisations for "directive" and "role" names for from
24 `docutils.parsers.rst.languages` or the PYTHONPATH.
26 If there is no matching module, warn (if a `reporter` is passed)
27 and return None.
28 """
29 packages = ('docutils.parsers.rst.languages.', '')
30 warn_msg = 'rST localisation for language "%s" not found.'
31 fallback = None
33 def check_content(self, module):
34 """Check if we got an rST language module."""
35 if not (isinstance(module.directives, dict)
36 and isinstance(module.roles, dict)):
37 raise ImportError
40get_language = RstLanguageImporter()