|
1 |
| -# -*- coding: utf-8 -*- |
2 | 1 | """
|
3 |
| - sphinx.domains.php |
4 |
| - ~~~~~~~~~~~~~~~~~~~ |
| 2 | + Sphinx PHP domain. |
5 | 3 |
|
6 |
| - The PHP domain. Based off of the rubydomain by SHIBUKAWA Yoshiki |
7 |
| -
|
8 |
| - :copyright: Copyright 2017 by Mark Story |
| 4 | + :copyright: Copyright 2023 by Mark Story |
9 | 5 | :license: BSD, see LICENSE for details.
|
10 | 6 | """
|
11 | 7 | import re
|
|
24 | 20 | from sphinx.util.docfields import Field, GroupedField, TypedField
|
25 | 21 | from sphinx import __version__ as sphinx_version
|
26 | 22 |
|
27 |
| -# log informative messages |
28 | 23 | def log_info(
|
29 | 24 | fromdocnode,
|
30 | 25 | message: str
|
31 | 26 | ):
|
| 27 | + """ |
| 28 | + Log informative message. Should have no affect on exit code. |
| 29 | + """ |
32 | 30 | logger = logging.getLogger(__name__)
|
33 | 31 | logger.info(f"[phpdomain.info] {message}", location=fromdocnode)
|
34 | 32 |
|
35 |
| -# log messages that should fail CI |
36 | 33 | def log_warning(
|
37 | 34 | fromdocnode,
|
38 | 35 | message: str
|
39 | 36 | ):
|
| 37 | + """ |
| 38 | + Log warning. Should set exit code to non-zero. |
| 39 | + """ |
40 | 40 | logger = logging.getLogger(__name__)
|
41 | 41 | logger.warning(f"[phpdomain.warning] {message}", location=fromdocnode)
|
42 | 42 |
|
43 |
| -# log assertions that should fail CI |
| 43 | +# |
44 | 44 | def log_assert(
|
45 | 45 | fromdocnode,
|
46 | 46 | value: bool
|
47 | 47 | ):
|
| 48 | + """ |
| 49 | + Log assertion. Should set exit code to non-zero. |
| 50 | + """ |
48 | 51 | if not value:
|
49 | 52 | caller = inspect.getframeinfo(inspect.stack()[1][0])
|
50 | 53 | logger = logging.getLogger(__name__)
|
@@ -87,7 +90,8 @@ def log_assert(
|
87 | 90 |
|
88 | 91 | def _pseudo_parse_arglist(signode, arglist):
|
89 | 92 | # type: (addnodes.desc_signature, unicode) -> None
|
90 |
| - """"Parse" a list of arguments separated by commas. |
| 93 | + """ |
| 94 | + "Parse" a list of arguments separated by commas. |
91 | 95 | Arguments can have "optional" annotations given by enclosing them in
|
92 | 96 | brackets. Currently, this will split at any comma, even if it's inside a
|
93 | 97 | string literal (e.g. default argument value).
|
@@ -640,7 +644,9 @@ def generate(self, docnames=None):
|
640 | 644 |
|
641 | 645 |
|
642 | 646 | class PhpDomain(Domain):
|
643 |
| - """PHP language domain.""" |
| 647 | + """ |
| 648 | + PHP language domain. |
| 649 | + """ |
644 | 650 | name = 'php'
|
645 | 651 | label = 'PHP'
|
646 | 652 | object_types = {
|
|
0 commit comments