def _visit_github_object_link_node_latex(translator: LaTeXTranslator,
                                         node: GitHubObjectLinkNode):
    """
	Visit a :class:`~.GitHubObjectLinkNode`.

	:param translator:
	:param node: The node being visited.
	"""

    node.children = node.children[:1]
    translator.visit_reference(node)
Пример #2
0
def _visit_issue_node_latex(translator: LaTeXTranslator, node: IssueNode):
    """
	Visit an :class:`~.IssueNode`.

	If the node points to a valid issue / pull request,
	add a tooltip giving the title of the issue / pull request and a hyperlink to the page on GitHub.

	:param translator:
	:param node: The node being visited.
	"""

    node.children = node.children[:1]
    translator.visit_reference(node)
Пример #3
0
    def visit_reference(self, node):
        uri = node.get("refuri", "")
        match = self.inter_doc_re.match(uri)
        if match:
            target_docname = match.group("docname")
            short_uri = match.group("short_uri")

            for latex_document in \
                self.settings.multilatex_all_latex_document_nodes:
                docnames = latex_document["multilatex-docnames"]
                if target_docname in docnames:
                    target_latex_document = latex_document
                    break
            else:
                target_latex_document = None

            if target_latex_document:
                options = target_latex_document["multilatex-options"]
                parameters = {
                    "ref": short_uri[1:].replace("#", ":"),
                    "title": options.get("title", "unknown external document"),
                }
                prefix = self.exdoc_ref_prefix.format(**parameters)
                suffix = self.exdoc_ref_suffix.format(**parameters)
            else:
                prefix = self.unknown_exdoc_ref_prefix
                suffix = self.unknown_exdoc_ref_suffix
            self.body.append(prefix)
            self.context.append(suffix)

            node["refuri"] = short_uri
            try:
                LaTeXTranslator.visit_reference(self, node)
            finally:
                node["refuri"] = uri

        else:
            self.context.append("")
            LaTeXTranslator.visit_reference(self, node)
Пример #4
0
    def visit_reference(self, node):
        uri = node.get("refuri", "")
        match = self.inter_doc_re.match(uri)
        if match:
            target_docname = match.group("docname")
            short_uri = match.group("short_uri")

            for latex_document in \
                self.settings.multilatex_all_latex_document_nodes:
                docnames = latex_document["multilatex-docnames"]
                if target_docname in docnames:
                    target_latex_document = latex_document
                    break
            else:
                target_latex_document = None

            if target_latex_document:
                options = target_latex_document["multilatex-options"]
                parameters = {
                    "ref": short_uri[1:].replace("#", ":"),
                    "title": options.get("title", "unknown external document"),
                }
                prefix = self.exdoc_ref_prefix.format(**parameters)
                suffix = self.exdoc_ref_suffix.format(**parameters)
            else:
                prefix = self.unknown_exdoc_ref_prefix
                suffix = self.unknown_exdoc_ref_suffix
            self.body.append(prefix)
            self.context.append(suffix)

            node["refuri"] = short_uri
            try:
                LaTeXTranslator.visit_reference(self, node)
            finally:
                node["refuri"] = uri

        else:
            self.context.append("")
            LaTeXTranslator.visit_reference(self, node)