On Wed, Jul 11, 2001 at 07:20:38AM -0400, Norman Walsh wrote:
> / Yann Dirson <[EMAIL PROTECTED]> was heard to say:
> | I'd like to get a page numbering like "page 1 of 10", and can't find a
> | documented way of getting the number of pages in an element.  I found
> 
> Jade can't. It doesn't actually do the formatting so it doesn't know.
> The best you can do, I think, is put an <anchor> at the end of your
> document and tweak the page-numbering code to print the page number on
> which that element occurs.

Hm... I'd prefer not having to hardcode things in the document.  Here
is a little attempt that gives strange results:


  (define (last-descendant-node nd)
    (if (node-list-empty? (children nd))
        nd
        (last-descendant-node (node-list-last (children nd)))))      
  
And then I insert the following to get my number of pages:

  (element-page-number-sosofo (last-descendant-node (sgml-root-element)))


Then I end up ROTFL when the formatted postscript reads "Page 1 of n"
and so on. :)

Did I miss something ? (appart from the potential possibility of
getting a wrong number if the last-descendant-node computed spans
several pages, that is)

-- 
Yann Dirson <[EMAIL PROTECTED]>                 http://www.alcove.com/
Free-Software Engineer                                Ing�nieur Logiciel Libre
Free-Software time Coordinator         Responsable du temps Informatique Libre

Reply via email to