Skip to Content
Menu
This question has been flagged
2 Replies
6843 Views

Hi,

I want to achieve report page count in .mako file of webkit reports, as it is in standard webkit footer (in xml). Following footer example, I have tried this in .mako (output is "Number of pages: undefined"):

<html>
<head>
<script>
    function subst() {
    var vars={};
    var x=document.location.search.substring(1).split('&');
    for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
    var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
    for(var i in x) {
    var y = document.getElementsByClassName(x[i]);
    for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
        }
    }
</script>
<style type="text/css">
${css}
</style>
</head>
<body onload="subst()">
%for o in objects:
<p>Number of pages: <span class="topage"/> </p>
%endfor
</body>
</html>

Many thanks in advance!

Avatar
Discard
Best Answer

To my knowledge this is not possible since the header and footer get parsed separately from the mako through a different procedure.The header and footer have access to this information since they get parsed at the initial stages, after which mako is used and concatenated

I really hope I am wrong but my investigations revealed this so far

Avatar
Discard
Best Answer

webkir report use the mako template, the mako template allows you to use inside a loop the magic variable loop

Page ${loop.index+1} of ${len(objects)}

look at: --docs.makotemplates.org/en/latest/runtime.html#mako.runtime.LoopContext

for more datails

Avatar
Discard
Related Posts Replies Views Activity
4
Dec 23
29407
1
Jan 24
4292
1
Aug 16
10741
7
Mar 15
6254
1
Mar 15
9411