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=u'"', pad_first=u' ', pad_before_eq=u'', pad_after_eq=u'', check_quotes=True)[source]¶ Bases:
mwparserfromhell.string_mixin.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.
-
pad_after_eq
¶ Spacing to insert right after the equal sign.
-
pad_before_eq
¶ Spacing to insert right before the equal sign.
-
pad_first
¶ Spacing to insert right before the attribute.
-
quotes
¶ How to enclose the attribute value.
"
,'
, orNone
.
-
static
parameter
Module¶
-
class
mwparserfromhell.nodes.extras.parameter.
Parameter
(name, value, showkey=True)[source]¶ Bases:
mwparserfromhell.string_mixin.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
.-
showkey
¶ Whether to show the parameter’s key (i.e., its “name”).
-