> they are not part __dict__ of every node, they belong to the
> class and give somehow sane defaults...at least we do not have to use
> hasattr(...)
You're right: they're not part of the __dict__ of every node.
But I'm not convinced that using class variables for default Nones is
neater than using hasattr or getattr (even if the syntax of the latter
isn't so pretty).
Thanks for clarifying the nature of the parser change. There seem to be a
number of regressions in link parsing, some related to things I patched
last year (should I add tests?):
(1) WAS:
>>> uparser.simpleparse("[[''Donkey'']]")
Article 'unknown': 1 children
Paragraph '': 1 children
Link '': 1 children
'Donkey'
(1) IS:
>>> uparser.simpleparse("[[Donkey]]")
Article
ArticleLink target=u"Donkey" ns=0
I.e. no caption underneath link node which we added for consistency with
[[aaa|bbb]].
(2) WAS:
>>> uparser.simpleparse("[[''Donkey'']]")
Article 'unknown': 1 children
Paragraph '': 1 children
Link '': 1 children
Style "''": 1 children
'Donkey'
(2) IS:
>>> uparser.simpleparse("[[''Donkey'']]")
Article
ArticleLink target=u"''Donkey''" ns=0
(3) WAS:
>>> print
>>> uparser.simpleparse("[[en:Donkey]]").children[0].children[0].target
Article 'unknown': 1 children
Paragraph '': 1 children
LangLink '': 1 children
'en:Donkey'
Donkey
(3) IS:
>>> print uparser.simpleparse("[[en:Donkey]]").children[0].target
Article
LangLink target=u'en:Donkey' interwiki='en' langlink='English'
en:Donkey
I.e. we had distinguished between a full_target and the stripped target,
which just had the title of the target page.
(4) WAS:
>>> print uparser.simpleparse("[[Donkey]]s")
Article 'unknown': 1 children
Paragraph '': 2 children
ArticleLink '': 1 children
'Donkeys'
(4) IS:
>>> print uparser.simpleparse("[[Donkey]]s")
Article
ArticleLink target=u'Donkey' ns=0
u's'
This *is* considered in an existing text case, though that test is marked
to fail.
Are these regressions intentional? Or are they side-effects of some other
change? Should I reimplement the features?
Also note that previously parsing "Some string" would automatically create
a paragraph node. Now in order to create a paragraph node, "\n\n" needs to
be present (and "\n\nText" erroneously creates two paragraph nodes).
It would seem that more of a test-driven development might be helpful.
Thanks,
- Joel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"mwlib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/mwlib?hl=en
-~----------~----~----~----~------~----~------~--~---