AJim <[email protected]> writes:
> I just discovered this problem for myself. I was hoping to use both
> the Dynamic Page List and Collection extensions; I would not like to
> have to choose one or the other.
>
> The dpl maintainers appear ready to cooperate with your suggestion
> that "patches are welcome",
> http://semeb.com/dpldemo/index.php?title=Issue_talk:Export_to_pdf
> , but they would need help to add this support. I assume, from your
> answer, that it would be possible.
>
> To get started, could provide a pointer to a discussion of what is
> required to support a new tag, such as dpl, in the mwlib parser?
Parsing a new tag is easy:
diff --git a/mwlib/refine/core.py b/mwlib/refine/core.py
index fa561a3..338ebf2 100755
--- a/mwlib/refine/core.py
+++ b/mwlib/refine/core.py
@@ -790,6 +790,9 @@ class parse_uniq(object):
txt = util.replace_html_entities(txt)
return T(type=T.t_text, text=txt)
+ def create_dpl(self, name, vlist, inner, xopts):
+ print "DPL:", (name, vlist, inner)
+
class XBunch(object):
def __init__(self, **kw):
self.__dict__.update(kw)
diff --git a/mwlib/uniq.py b/mwlib/uniq.py
index 5e73b6e..d5def22 100644
--- a/mwlib/uniq.py
+++ b/mwlib/uniq.py
@@ -60,7 +60,7 @@ class Uniquifier(object):
self.txt = txt
rx = self.rx
if rx is None:
- tags = set("nowiki math imagemap gallery source pre ref
timeline".split())
+ tags = set("nowiki math imagemap gallery source pre ref timeline
dpl".split())
from mwlib import tagext
tags.update(tagext.default_registry.names())
This lets me do:
>>> from mwlib.refine import core
>>> core.parse_txt("<dpl val=1>blabla</dpl>")
DPL: ('dpl', {'val': 1}, 'blabla')
[]
create_dpl would need to return a meaningful parse tree for the dpl tag
however.
Regards,
- Ralf
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---