Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
6863 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
4
dic 23
29415
1
ene 24
4316
1
ago 16
10760
7
mar 15
6288
1
mar 15
9433