textoutpc.nodes – Node definitions#
- class textoutpc.nodes.LinkTarget(value)#
- 
Target to add to links. - SELF = 'self'#
- Whether the target is the current window and tab. 
 - BLANK = 'blank'#
- Whether the target is a different window / tab. - In this case, - rel="noopener"is also added, in order for the new window / tab to have no access to the current window / tab.
 
- class textoutpc.nodes.NodeHTMLRenderEnvironment(*, link_target: LinkTarget = LinkTarget.BLANK, smiley_url_format: str = 'https://www.planet-casio.com/images/smileys/{name}.gif', calc_url_format: str = 'https://www.planet-casio.com/images/icones/calc/{name}.png', staff_image_url_format: str = 'https://www.planet-casio.com/storage/staff/{path}', user_profile_url_format: str = 'https://www.planet-casio.com/Fr/compte/voir_profil.php?membre={username}', topic_url_format: str = 'https://www.planet-casio.com/Fr/forums/lecture_sujet.php?id={id}', tutorial_url_format: str = 'https://www.planet-casio.com/Fr/programmation/tutoriels.php?id={id}', program_url_format: str = 'https://www.planet-casio.com/Fr/programmes/voir_un_programme_casio.php?showid={id}', email_script_url: str = 'https://www.planet-casio.com/scripts/public/email.php')#
- Bases: - BaseModel- Node rendering environment. - link_target: LinkTarget#
- Link target. 
 
- class textoutpc.nodes.Node#
- 
Base node in a textoutpc tree. - abstract render_html(env: NodeHTMLRenderEnvironment, /) str#
- Render the node as HTML. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Rendered HTML version of the node. 
 
 
- class textoutpc.nodes.TextNode(content: str | None = None)#
- Bases: - Node- Textual node in a textoutpc tree. - render_html(env: NodeHTMLRenderEnvironment, /) str#
- Render the node as HTML. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Rendered HTML version of the node. 
 
 
- class textoutpc.nodes.ContainerNode(children: Iterable[Node] | None = None)#
- Bases: - Node- Container node in a textoutpc tree. - AUTHORIZED_CHILDREN_TYPES: ClassVar[Sequence[type[Node] | tuple[type[Node], int | range]] | None] = None#
- Authorized children types. - This is a sequence of either the type to check, or the authorized count of this type of node. Here’s an example use of this property: - class MyContainerNode(ContainerNode): AUTHORIZED_CHILDREN_TYPES = ( MyFirstNode, (MySecondNode, 4), (MyThirdNode, range(1, 3)), ) - This example presents the following constraints: - Children are either instances of - MyFirstNode,- MySecondNodeor- MyThirdNode;
- There must be exactly 4 - MySecondNodeinstances;
- There must be 1 or 2 - MyThirdNodeinstances.
 
 - find_children(type_or_types: tuple[type, ...] | type | None = None, /, *, exclude_type: type | None = None, exclude_types: tuple[type, ...] | None = None) Iterator[Node]#
- Find children with the provided filters. - Parameters:
- type_or_types – Only count children of the provided type or types. 
- exclude_type – Exclude the provided type in the count. 
- exclude_types – Exclude the provided types in the count. 
 
- Returns:
- Children for the provided filters. 
 
 - find_child(type_or_types: tuple[type, ...] | type | None = None, /, *, exclude_type: type | None = None, exclude_types: tuple[type, ...] | None = None, optional: Literal[True]) Node | None#
- find_child(type_or_types: tuple[type, ...] | type | None = None, /, *, exclude_type: type | None = None, exclude_types: tuple[type, ...] | None = None, optional: Literal[False] = False) Node
- Find a single child with the provided filters. - Parameters:
- type_or_types – Only count children of the provided type or types. 
- exclude_type – Exclude the provided type in the count. 
- exclude_types – Exclude the provided types in the count. 
 
- Returns:
- Child for the provided filters. 
- Raises:
 
 - count_children(type_or_types: tuple[type, ...] | type | None = None, /, *, exclude_type: type | None = None, exclude_types: tuple[type, ...] | None = None) int#
- Count children of a provided type. - Parameters:
- type_or_types – Only count children of the provided type or types. 
- exclude_type – Exclude the provided type in the count. 
- exclude_types – Exclude the provided types in the count. 
 
- Returns:
- Count of children for the provided filters. 
 
 - render_children_html(env: NodeHTMLRenderEnvironment, /) str#
- Render the node’s children as HTML. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Rendered HTML version of the node’s children. 
 
 
- class textoutpc.nodes.BlockContainerNode(children: Iterable[Node] | None = None)#
- Bases: - ContainerNode,- BlockNode- Block-level node that can contain both block and inline nodes. 
- class textoutpc.nodes.BlockInlineContainerNode(children: Iterable[Node] | None = None)#
- Bases: - ContainerNode,- BlockNode- Block-level node that can contain inline nodes. 
- class textoutpc.nodes.InlineContainerNode(children: Iterable[Node] | None = None)#
- Bases: - ContainerNode,- InlineNode- Inline-level node that can contain other inline nodes. 
- class textoutpc.nodes.ParagraphNode(children: Iterable[Node] | None = None, *, align: Literal['center', 'left', 'right', 'justify'] | None = None)#
- Bases: - BlockInlineContainerNode- Paragraph node. - align: Literal['center', 'left', 'right', 'justify'] | None#
- Optional method to use to align the text within the paragraph. 
 - render_html(env: NodeHTMLRenderEnvironment, /) str#
- Render the node as HTML. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Rendered HTML version of the node. 
 
 
- class textoutpc.nodes.SmileyNode(*, name: str, style: str | None = None)#
- Bases: - InlineNode- Smiley node. - render_html(env: NodeHTMLRenderEnvironment, /) str#
- Render the node as HTML. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Rendered HTML version of the node. 
 
 
- class textoutpc.nodes.EmailAddressNode(*, email_address: str)#
- Bases: - InlineNode- E-mail address node. - email_address: Annotated[str, StringConstraints(pattern='^[^@]+@[^@]+$')]#
- E-mail address. 
 - render_html(env: NodeHTMLRenderEnvironment, /) str#
- Render the node as HTML. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Rendered HTML version of the node. 
 
 
- class textoutpc.nodes.BaseReferenceNode(children: Iterable[Node] | None = None)#
- Bases: - InlineContainerNode- Reference to an HTTP URL. - abstract build_html_url(env: NodeHTMLRenderEnvironment, /) str#
- Build the URL for HTML output. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Obtained URL. 
 
 - render_html(env: NodeHTMLRenderEnvironment, /) str#
- Render the node as HTML. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Rendered HTML version of the node. 
 
 
- class textoutpc.nodes.ReferenceNode(children: Iterable[Node] | None = None, *, url: AnyUrl)#
- Bases: - BaseReferenceNode- Reference to an HTTP URL. - url: AnyUrl#
- URL to reference. 
 - build_html_url(env: NodeHTMLRenderEnvironment, /) str#
- Build the URL for HTML output. - Parameters:
- env – Environment with all of the options. 
- Returns:
- Obtained URL.