30
     	ˆÃÂÁ567ÀÅÄ 7    	‹      Õ–]oÚ0…ïû+<_ì.yCB;Ñ&™:‚4$
ˆfÚ¦išLloNÙÚþú…M°	1íÊ¯“ç<ÇvœðE2ê¦Ç=ô6½ ñ»7ƒ~aà}ÐHÒ¤¹Ñv½@oˆ.Œ©¯–Ë¥»\©rH'P˜R´AÅ3ãRCq|®®Å(,¡¶E¡áF°¸_Qö€ä�œÍ)ó·PYjÐ¬¢3.˜KY)ÝB»™”µ}•™v´[µçÃ)KB¡’”})%�¦aÁsj1ÏyåÔK”k™à¬2@Ù"„Æ…õcáTÒÇ•ßÖ?÷f-¬ƒ"ÓµÅU©âÐhAÏ«Yã8äeŽ´Ê"<“•†© Õ77ç3Œˆ0þÔïŽ>[˜bõtT(6‹ðën4¼E	Ž‡¤d!�Ãš;«¹Åñ€hƒ¬w>ãŒß7â{þt|À¤Ñ$LgŠ×†Ëj'‹¸�šI¡kbY/-A¡öU�„þ.’ýÆøvÒ¦IÒDBWCìÜ�¦q<&Ê(áŠeFªÇM�³—ÕT×7Û.Ú *žÇ9è ò/ò1ìÁìç“~H&S+Fìnþªqü\î;ýÉšïùWŽ×qü+äu®ƒ ¡#Â ýêl;„“�3äví0µ�xîœ‚£ÕöÎÆ¡¥àt±­N2—íó,˜0¬AØ–ÿÛ~XÌ€¦=‰{ÿWkè¿ë°9ñBXŸÅ!4ÿß-ÝQÐž    B   ˆl–äY>”êhŠe@=q�ÜªbÑ¿�þBÛn¬Ü¯²HÛm¶@?¿ƒm§Â_ŠI|¥�+Wé3ž¯ÇÆ W    """The changeset domain."""

from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, cast

from docutils import nodes
from docutils.nodes import Node

from sphinx import addnodes
from sphinx.domains import Domain
from sphinx.locale import _
from sphinx.util.docutils import SphinxDirective
from sphinx.util.typing import OptionSpec

if TYPE_CHECKING:
    from sphinx.application import Sphinx
    from sphinx.environment import BuildEnvironment


versionlabels = {
    'versionadded':   _('New in version %s'),
    'versionchanged': _('Changed in version %s'),
    'deprecated':     _('Deprecated since version %s'),
}

versionlabel_classes = {
    'versionadded':     'added',
    'versionchanged':   'changed',
    'deprecated':       'deprecated',
}


class ChangeSet(NamedTuple):
    type: str
    docname: str
    lineno: int
    module: str
    descname: str
    content: str


class VersionChange(SphinxDirective):
    """
    Directive to describe a change/addition/deprecation in a specific version.
    """
    has_content = True
    required_arguments = 1
    optional_arguments = 1
    final_argument_whitespace = True
    option_spec: OptionSpec = {}

    def run(self) -> List[Node]:
        node = addnodes.versionmodified()
        node.document = self.state.document
        self.set_source_info(node)
        node['type'] = self.name
        node['version'] = self.arguments[0]
        text = versionlabels[self.name] % self.arguments[0]
        if len(self.arguments) == 2:
            inodes, messages = self.state.inline_text(self.arguments[1],
                                                      self.lineno + 1)
            para = nodes.paragraph(self.arguments[1], '', *inodes, translatable=False)
            self.set_source_info(para)
            node.append(para)
        else:
            messages = []
        if self.content:
            self.state.nested_parse(self.content, self.content_offset, node)
        classes = ['versionmodified', versionlabel_classes[self.name]]
        if len(node) > 0 and isinstance(node[0], nodes.paragraph):
            # the contents start with a paragraph
            if node[0].rawsource:
                # make the first paragraph translatable
                content = nodes.inline(node[0].rawsource, translatable=True)
                content.source = node[0].source
                content.line = node[0].line
                content += node[0].children
                node[0].replace_self(nodes.paragraph('', '', content, translatable=False))

            para = node[0]
            para.insert(0, nodes.inline('', '%s: ' % text, classes=classes))
        elif len(node) > 0:
            # the contents do not starts with a paragraph
            para = nodes.paragraph('', '',
                                   nodes.inline('', '%s: ' % text, classes=classes),
                                   translatable=False)
            node.insert(0, para)
        else:
            # the contents are empty
            para = nodes.paragraph('', '',
                                   nodes.inline('', '%s.' % text, classes=classes),
                                   translatable=False)
            node.append(para)

        domain = cast(ChangeSetDomain, self.env.get_domain('changeset'))
        domain.note_changeset(node)

        ret: List[Node] = [node]
        ret += messages
        return ret


class ChangeSetDomain(Domain