W3C home > Mailing lists > Public > public-digipub@w3.org > August 2015

Re: Cross-References in GCPM (was: CSS Pages and Pagination)

From: Dave Cramer <dauwhe@gmail.com>
Date: Mon, 10 Aug 2015 12:52:32 -0400
Message-ID: <CADxXqOysUVk8+svw3dUX3GTnkju1vhY_R6E4y-bkyM4MVKGb2Q@mail.gmail.com>
To: Sanders Kleinfeld <sanders@oreilly.com>
Cc: Håkon Wium Lie <howcome@opera.com>, Daniel Glazman <daniel.glazman@disruptive-innovations.com>, public-digipub <public-digipub@w3.org>
On Mon, Aug 10, 2015 at 12:34 PM, Sanders Kleinfeld <sanders@oreilly.com>
wrote:

> Thanks very much for your feedback, Håkon. My responses inline below.
>
> On Sun, Aug 9, 2015 at 7:50 AM, Håkon Wium Lie <howcome@opera.com> wrote:
>
> >
> > Still if you want an all-automatic solution, I'd probably base it on
> > named strings. First, I would set a named string with:
> >
> >   h1[id] { string-set: ref "Section " counter(sec) }
> >   figure[id] { string-set: ref "Figure " counter(fig) }
> >
> > Then I would refer to it with:
> >
> >   a { content: target-string(ref, attr(href url)) }
> >
> > The 'target-string' function doesn't exist, yet. But I think it could
> work, no?
>
> Yes, that's exactly what I would be looking for! I think leveraging
> string-set is the right way to go here.


I found a proposal that might also satisfy the use case [1]:

a[href] {
  // Use x-target-is as a switch for which link text to use
  content: x-target-is(attr(href), 'figure') 'See Figure';
  // Link to a section WITHOUT a title
  content: x-target-is(attr(href), 'section:not(:has(>.title))')
           'See ' target-text(attr(href), content(before));
  // Link to a section **with** a title
  content: x-target-is(attr(href), 'section:has(>.title)')
           'See ' target-text(attr(href), content(before))
           target-text(attr(href), content('> .title'));
}


Dave


[1] http://philschatz.com/css-polyfills.js/#section-target-counters
Received on Monday, 10 August 2015 16:53:03 UTC

This archive was generated by hypermail 2.3.1 : Monday, 10 August 2015 16:53:04 UTC