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