Interface
- class bTagScript.interface.Adapter[source]
Bases:
object
The base class for TagScript adapters.
Implementations must subclass this to create adapters.
- get_value(ctx: Context) Optional[str] [source]
Processes the adapter’s actions for a given
Context
.Subclasses must implement this.
- Parameters
ctx (Context) – The context object containing the TagScript
Verb
.- Returns
The adapters’s processed value.
- Return type
Optional[str]
- Raises
NotImplementedError – The subclass did not implement this required method.
- class bTagScript.interface.Block[source]
Bases:
object
The base class for TagScript blocks.
Implementations must subclass this to create new blocks.
- ACCEPTED_NAMES
The accepted names for this block. This ideally should be set as a class attribute.
- Type
Tuple[str, …]
- classmethod will_accept(ctx: Context) bool [source]
Describes whether the block is valid for the given
Context
.
- pre_process(ctx: Context) Optional[str] [source]
Any pre processing that needs to be done before the block is processed.
- process(ctx: Context) Optional[str] [source]
Processes the block’s actions for a given
Context
.Subclasses must implement this.
- Parameters
ctx (Context) – The context object containing the TagScript
Verb
.- Returns
The block’s processed value.
- Return type
Optional[str]
- Raises
NotImplementedError – The subclass did not implement this required method.
- bTagScript.interface.verb_required_block(implicit: bool, *, parameter: bool = False, payload: bool = False) Block [source]
Get a Block subclass that requires a verb to implicitly or explicitly have a parameter or payload passed.
- Parameters
implicit (bool) – Specifies whether the value is required to be passed implicitly or explicitly.
{block()}
would be allowed if implicit is False.parameter (bool) – Passing True will cause the block to require a parameter to be passed.
payload (bool) – Passing True will cause the block to require the payload to be passed.