extras Package¶
extras
Package¶
This package contains objects used by Node
s, but that are not
nodes themselves. This includes template parameters and HTML tag attributes.
attribute
Module¶
- class mwparserfromhell.nodes.extras.attribute.Attribute(name, value=None, quotes='"', pad_first=' ', pad_before_eq='', pad_after_eq='')[source]¶
Bases:
StringMixIn
Represents an attribute of an HTML tag.
This is used by
Tag
objects. For example, the tag<ref name="foo">
contains an Attribute whose name is"name"
and whose value is"foo"
.- static coerce_quotes(quotes)[source]¶
Coerce a quote type into an acceptable value, or raise an error.
- property pad_after_eq¶
Spacing to insert right after the equal sign.
- property pad_before_eq¶
Spacing to insert right before the equal sign.
- property pad_first¶
Spacing to insert right before the attribute.
- property quotes¶
How to enclose the attribute value.
"
,'
, orNone
.
parameter
Module¶
- class mwparserfromhell.nodes.extras.parameter.Parameter(name, value, showkey=True)[source]¶
Bases:
StringMixIn
Represents a paramater of a template.
For example, the template
{{foo|bar|spam=eggs}}
contains two Parameters: one whose name is"1"
, value is"bar"
, andshowkey
isFalse
, and one whose name is"spam"
, value is"eggs"
, andshowkey
isTrue
.- property showkey¶
Whether to show the parameter’s key (i.e., its “name”).