Lines Matching +full:target +full:- +full:module

6 # pylint: disable=too-many-lines
72 ) -> Tuple[nodes.field_name, nodes.field_body]:
74 docutils helper: unpack a field node in a type-safe manner.
98 target: str,
99 ) -> tuple[str, str]:
101 refnode["qapi:module"] = env.ref_context.get("qapi:module")
103 # Cross-references that begin with a tilde adjust the title to
104 # only show the reference without a leading module, even if one
105 # was provided. This is a Sphinx-standard syntax; give it
106 # priority over QAPI-specific type markup below.
108 if target.startswith("~"):
110 target = target[1:]
115 if target.endswith("?"):
117 target = target[:-1]
121 if target.startswith("[") and target.endswith("]"):
123 target = target[1:-1]
128 # :qapi:type:`target <explicit title>`
130 return title, target
132 title = target
134 title = target.split(".")[-1]
136 return title, target
144 ) -> Tuple[List[nodes.Node], List[nodes.system_message]]:
170 def handle_signature(self, sig: str, signode: desc_signature) -> Signature:
176 # render the signature; here we do nothing instead - the
180 def get_index_text(self, name: Signature) -> Tuple[str, str]:
186 def _get_context(self) -> Tuple[str, str]:
191 "module", self.env.ref_context.get("qapi:module", "")
196 def _get_fqn(self, name: Signature) -> str:
199 # If we're documenting a module, don't include the module as
200 # part of the FQN; we ARE the module!
201 if self.objtype == "module":
212 ) -> None:
231 if "no-index-entry" not in self.options:
240 def split_fqn(name: str) -> Tuple[str, str, str]:
247 module, name = name.split(".")
249 module = ""
251 return (ns, module, name)
255 ) -> Tuple[str, ...]:
260 def _toc_entry_name(self, sig_node: desc_signature) -> str:
274 "qapi:module", ""
304 "module": directives.unchanged,
323 def get_signature_prefix(self) -> List[nodes.Node]:
331 def get_signature_suffix(self) -> List[nodes.Node]:
345 def handle_signature(self, sig: str, signode: desc_signature) -> Signature:
357 # No module or domain info allowed in the signature!
364 signode["module"] = modname
376 def _add_infopips(self, contentnode: addnodes.desc_content) -> None:
377 # Add various eye-catches and things that go below the signature
378 # bar, but precede the user-defined content.
380 infopips.attributes["classes"].append("qapi-infopips")
384 ) -> None:
390 node.attributes["classes"].extend(["qapi-infopip", classname])
397 "qapi-deprecated",
404 "qapi-unstable",
416 "qapi-ifcond",
422 def _validate_field(self, field: nodes.field) -> None:
444 # This is a special docfield, yet-to-be-processed. Catch
470 def transform_content(self, content_node: addnodes.desc_content) -> None:
486 def make_field(self, *args: Any, **kwargs: Any) -> nodes.field:
489 # Look for the characteristic " -- " text node that Sphinx
491 for node in ret.traverse(lambda n: str(n) == " -- "):
498 del par.children[:-1]
590 # pylint: disable=too-many-ancestors
595 # pylint: disable=too-many-ancestors
601 Directive to mark description of a new module.
604 a pass-through for the content body. Named section titles are
607 Use this directive to create entries for the QAPI module in the
609 definitions with the module they are defined in for purposes of
612 :arg: The name of the module.
613 :opt no-index: Don't add cross-reference targets or index entries.
614 :opt no-typesetting: Don't render the content body (but preserve any
615 cross-reference target IDs in the squelched output.)
619 .. qapi:module:: block-core
620 :no-index:
621 :no-typesetting:
626 def run(self) -> List[Node]:
628 self.env.ref_context["qapi:module"] = modname
632 # want module items to be "invisible", however.
635 assert isinstance(ret[-1], addnodes.desc)
636 desc_node = ret.pop(-1)
640 # Re-home node_ids so anchor refs still work:
647 target_node = nodes.target(ids=node_ids)
657 def run(self) -> List[Node]:
669 # pylint: disable=too-few-public-methods
679 ) -> Tuple[List[Tuple[str, List[IndexEntry]]], bool]:
726 # This table associates cross-reference object types (key) with an
727 # ObjType instance, which defines the valid cross-reference roles
730 # e.g., the :qapi:type: cross-reference role can refer to enum,
732 # anything. Each object also gets its own targeted cross-reference role.
734 "module": ObjType(_("module"), "mod", "any"),
743 # e.g. .. qapi:module:: block-core
746 "module": QAPIModule,
754 # These are all cross-reference roles; e.g.
755 # :qapi:cmd:`query-block`. The keys correlate to the names used in
770 # this is the internal index of reference-able objects.
772 "objects": {}, # fullname -> ObjectEntry
781 def objects(self) -> Dict[str, ObjectEntry]:
783 return ret # type: ignore[no-any-return]
785 def setup(self) -> None:
791 new_index.name = f"{namespace.lower()}-index"
807 ) -> None:
822 "other instance in %s, use :no-index: for one of them"
832 def clear_doc(self, docname: str) -> None:
839 ) -> None:
846 "bug - collision on merge?"
853 ) -> List[Tuple[str, ObjectEntry]]:
861 :param modname: The current module context (if any!) under
863 :param name: The name of the x-ref to resolve; may or may not
865 :param type: The role name of the x-ref we're resolving, if
893 # convert this to eligible object types (e.g. command, module)
901 def _search(needle: str) -> List[str]:
925 # Try searching for *:module.name or module.name
928 # Try searching for context-ns:*.name or context-ns:name
931 # Try searching for *:context-mod.name or context-mod.name
958 target: str,
961 ) -> nodes.reference | None:
963 modname = node.get("qapi:module")
964 matches = self.find_obj(namespace, modname, target, typ)
968 # but that will trigger on references to these built-in types,
972 # reference isn't to one of our built-in core types.
973 if target not in (
983 __("qapi:%s reference target not found: %r"),
985 target,
994 __("more than one target found for cross-reference %r: %s"),
995 target,
1012 target: str,
1015 ) -> List[Tuple[str, nodes.reference]]:
1018 node.get("qapi:namespace"), node.get("qapi:module"), target, None
1031 def setup(app: Sphinx) -> Dict[str, Any]: