Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/docutils/parsers/rst/languages/__init__.py: 91%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

11 statements  

1# $Id$ 

2# Author: David Goodger <goodger@python.org> 

3# Copyright: This module has been placed in the public domain. 

4 

5# Internationalization details are documented in 

6# <https://docutils.sourceforge.io/docs/howto/i18n.html>. 

7 

8""" 

9This package contains modules for language-dependent features of 

10reStructuredText. 

11""" 

12 

13__docformat__ = 'reStructuredText' 

14 

15 

16from docutils.languages import LanguageImporter 

17 

18 

19class RstLanguageImporter(LanguageImporter): 

20 """Import language modules. 

21 

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. 

25 

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 

32 

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 

38 

39 

40get_language = RstLanguageImporter()