Discussion:
Move block into another block
Leho Kraav
2014-09-21 00:36:16 UTC
Permalink
Hi!
<?python altlinks = select('*|text()') ?>
</py:match>
<div id="ctxtnav" class="nav">
${select('*|text()')}
${altlinks}
</div>
</py:match>
Is there any better/correct/working way of moving contents of altlinks
div into ctxtnav div in Trac?
I'm looking for exactly this information - how to move divs around with
Genshi. Did you ever figure it out?
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/d/optout.
Simon Cross
2014-09-24 23:08:30 UTC
Permalink
The following code:

# movediv.py
from genshi.template import MarkupTemplate

template = """<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/" lang="en">

<py:match path="div[@id='altlinks']">
<?python altlinks = select('*|text()') ?>
</py:match>
<py:match path="div[@id='ctxtnav']">
<div id="ctxtnav" class="nav">
${select('*|text()')}
${altlinks}
</div>
</py:match>

<div id="altlinks">
ALT LINKS
</div>
<div id="ctxtnav">
CTXTNAV
</div>

</html>"""

t = MarkupTemplate(template)
s = t.generate()

print s.render()
# end

Outputs the following for me on Genshi trunk:

$ python movediv.py
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<div id="ctxtnav" class="nav">
CTXTNAV
ALT LINKS
</div>
</html>

Which seems to do what people want? Not sure why the original poster
thought this didn't work?

Schiavo
Simon
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/d/optout.
Loading...