AntiCompositeNumber
64691b93d3
Revert "nodes: Add __contains__ to Template"
This reverts commit b87f4eef8f
.
hace 3 años
AntiCompositeNumber
b87f4eef8f
nodes: Add __contains__ to Template
This allows the use of `key in Template` syntax
hace 3 años
AntiCompositeNumber
204266c3df
nodes: Use def instead of assignment of a lambda in Template
Per PEP8, there is no benefit to using a lambda here, and some
downsides. It's the same number of SLOC either way, so might as well
change it.
hace 3 años
AntiCompositeNumber
a42c728744
nodes: Add __getitem__, __setitem__, and __delitem__ to Template
These are just aliases for existing methods, without the ability to
specifiy additional parameters. However, including them makes Template
more dict-like, so it's a good idea to have them.
hace 3 años
AntiCompositeNumber
c8dbc5f8cd
nodes: add a `default` param to Template.get
Similar to dict.get, Template.get with a default param supplied will
return that value instead of raising an exception. If default is unset,
Template.get will keep its previous behavior and raise an exception.
hace 3 años
Kunal Mehta
7e5297fbe6
Drop Python 2 support
Fixes #221 .
hace 4 años
Yuri Astrakhan
e66a2db0ed
add missing public items to __all__
Added a few more public classes, and sorted the __all__ value.
The Attribute and Parameter classes are not included as they can
be imported from the `mwparserfromhell.nodes.extras` without
linter complaining. They could be added to this __all__ too.
hace 4 años
Ben Kurtovic
6e61c99c90
Update API query example; clarify docstring
hace 5 años
Ben Kurtovic
708bee59e1
Minor cleanup
hace 5 años
Ben Kurtovic
83bcb902b8
Support manual construction of Node objects ( fixes #214 )
hace 5 años
Hugo
e457b39f32
Upgrade Python syntax with pyupgrade https://github.com/asottile/pyupgrade
hace 5 años
Ben Kurtovic
7a30e47f76
Some improvements to whitespace recognition; unit tests ( #185 ).
hace 6 años
Ben Kurtovic
7308c8055e
Not perfect, but slightly better template param space guessing ( #155 )
hace 7 años
Ben Kurtovic
68ded2f890
Add keep_template_params to Wikicode.strip_code ( #175 )
hace 7 años
Ben Kurtovic
6159171e04
Make Template.remove(keep_field=True) slightly more reasonable.
hace 7 años
Ben Kurtovic
aaffb7f66b
Update copyright for 2016.
hace 8 años
Ben Kurtovic
699d0638f6
Fix param blanking logic by Template.remove() ( #109 )
hace 9 años
Ben Kurtovic
4c2540060b
Fix preserve_spacing behavior in Template.add() on hidden keys ( #109 )
hace 9 años
Ben Kurtovic
e71e7b4ece
Update copyright years for 2015; fix whitespace in docs.
hace 9 años
Ben Kurtovic
504b8bace0
Add test code for a missing branch of Tag.wiki_markup.setter; cleanup.
hace 9 años
Ben Kurtovic
810c24e123
Don't check quotes when attributes are built from tokens.
hace 9 años
David Winegar
1b3e3c3657
Change wiki tags to use style separators
For wiki syntax tables, add `wiki_style_separator` as an attribute
for the Tag node. Also reorder `closing_wiki_markup` property and tests
to match its place in the constructor.
hace 10 años
David Winegar
7bbeb6899a
Fix ordering of tag representation
Self-closing wiki syntax tags have incorrectly ordered wiki syntax
and padding, fixed the ordering.
hace 10 años
David Winegar
ec08001871
Tables and rows now use newline as padding
Tables and rows use newlines as padding, partly because these characters
are pretty important to the integrity of the table. They might need
to be in the preceding whitespace of inner tags instead as padding after,
not sure.
hace 10 años
David Winegar
d356a570b3
Added closing_wiki_markup support to Tag node
Added support for allowing different wiki syntax for replacing the opening
and closing tags. Added for table support.
hace 10 años
Ben Kurtovic
87e0079512
Take proper advantage of Sphinx's default domains.
hace 10 años
Ben Kurtovic
b997e4cd71
Support attributes quoted with '; add required quotes in value setter.
hace 10 años
Ben Kurtovic
8bc7ea669d
Improve test coverage; fix some node-related bugs.
* Parameters with non-integer keys can no longer be created with
showkey=False, nor have the value of this attribute be set to False
later.
* Calling Template.remove() with a Parameter object that is not part of
the template now raises ValueError instead of doing nothing.
* Added tests for HTMLEntity._unichr() being called with out-of-range
codepoints.
* Added tests for Tag.__children__() and Tag.__showtree__() involving
attributes that have no values.
hace 10 años
Ben Kurtovic
08cafc0576
Raise ParserError for internal problems. Improve coverage. Cleanup.
hace 10 años
Ricordisamoa
9108d49d68
fix some typos: occurance → occurrence, parasable → parsable
hace 10 años
Ben Kurtovic
e5f17eea00
Update copyright notices for 2014.
hace 10 años
Ben Kurtovic
45aec31629
Move range/xrange compatibility code to compat.py.
hace 10 años
Ben Kurtovic
99d433c2d5
Change protocol for Node iteration; rename __iternodes__ to __children__.
hace 10 años
Ben Kurtovic
066049b46a
Update email address.
hace 10 años
Ben Kurtovic
cf90557229
Template.has() should be passed ignore_empty=False by default.
**Breaking change**; closes #51 .
hace 10 años
Ben Kurtovic
40b92358b4
Simplify parameter removal.
hace 10 años
Ben Kurtovic
f2442906db
Implement support for Template.remove() taking Parameters as arguments.
hace 10 años
Ben Kurtovic
bdfd0632b3
A couple very minor nitpicks.
hace 11 años
Ben Kurtovic
d1a7d25220
Set right context for ExternalLink.url; Wikicode.filter_external_links()
hace 11 años
Ben Kurtovic
67f1762aa4
Doc updates, and allow passing a starting context to tokenize().
hace 11 años
Ben Kurtovic
d91c65dc1f
TestExternalLink; some fixes in ExternalLink.
hace 11 años
Ben Kurtovic
5e6e5b6301
tag_defs.py -> definitions.py; more outline stuff
hace 11 años
Ben Kurtovic
8fe8b1fef5
Implement ExternalLinks as tokens and in the builder.
hace 11 años
Ben Kurtovic
0886b6fbf6
Add ExternalLink Node type.
hace 11 años
Ben Kurtovic
800bd20e39
Implement Tag.has(), Tag.get(), Tag.add(), and Tag.remove() ( closes #11 ).
hace 11 años
Ben Kurtovic
9280cb16fe
Fix behavior with quoted attrs and spaces before the =.
hace 11 años
Ben Kurtovic
53c26589ee
Some node fixes; attributes with empty values now display correctly.
hace 11 años
Ben Kurtovic
a7dda77474
Template.has_param() -> Template.has()
hace 11 años
Ben Kurtovic
7a4b1625d3
Strip self-closing tags correctly.
hace 11 años
Ben Kurtovic
4f52887e17
wiki_markup stores the markup itself instead of a bool
hace 11 años