Forum Feature requests

Advanced cross references

thomas
I like the target-counter property, which enable to generate cross references. But the "page " target-counter(attr(href), page, decimal" scheme is too limited. For instance, the references "see the picture on this page" or "see the picture on the facing page" are better than "see the picture on page 5" if the picture is on the same/facing page.

In fact, I miss the power of the Latex varioref package.

Here is my proposal. Create a property which accepts 7 arguments:

prince-cross-ref(CURRENT-PAGE
                 PREVIOUS-AND-ODD-PAGE,
                 PREVIOUS-AND-EVEN-PAGE,
                 NEXT-AND-ODD-PAGE,
                 NEXT-AND-EVEN-PAGE,
                 ONE-PAGE-NUMBER,
                 MULTI-PAGE-NUMBER)


The first 6 arguments are mandatory.

If the 7th argument (MULTI-PAGE-NUMBER) is specified and if the referenced element spans over several pages, this argument is used for the reference.


Example 1: An english book (double sided printing):

:lang(en) {
  span.cref {
    content: prince-cross-ref("on this page",
      "on the preceding page",
      "on the facing page",
      "on the facing page",
      "on the following page",
      "on page " target-counter(attr(href), page, decimal)
      "on pages " target-counter(attr(href), page, decimal), "\002013" target-counter-end(attr(href), page, decimal)
  }
}


Possible renderings:
See the summary <span href="#summary" class="cref" />.

→ See the summary on the following page.
→ See the summary on pages 13–15.


Example 2: A french paper, single sided printing

:lang(fr) {
  span.cref {
    content: prince-cross-ref("sur cette page",   /* = on this page */
      "sur la page précédente",                   /* = on the preceding page */
      "sur la page précédente",                   /* = on the preceding page */
      "sur la page suivante",                     /* = on the next page */
      "sur la page suivante",                     /* = on the next page */
      "p.\0000A0" target-counter(attr(href), page, decimal)
  }
}


Since the 7th argument is not specified, it does not matter if the div fits on one page or not.

To me, this feature would give another great advantage to Prince! What do you think of this proposal?

Thomas
mikeday
It is a good proposal, and I will add it to the roadmap.
mikeday
Prince 8.0 includes a prince-script() value that can call JavaScript functions from CSS generated content. This may be sufficient to implement most of the cross-references ideas that you have described.