- From: Brady Duga <duga@google.com>
- Date: Mon, 10 Aug 2015 07:57:52 -0700
- To: Håkon Wium Lie <howcome@opera.com>
- Cc: Sanders Kleinfeld <sanders@oreilly.com>, Daniel Glazman <daniel.glazman@disruptive-innovations.com>, public-digipub <public-digipub@w3.org>
- Message-ID: <CAH_p_eXLKZ_U8KpYTa-iH_fF1Ddoyh8mdcgkVhaSSk52GaJbDg@mail.gmail.com>
Looking at this specific use case, why is it better to do this at render time, instead of during content processing/creation? That is, it seems like you have an existing working solution, what problem are you trying to solve by moving this into CSS? I ask because this really seems to cross the styling/content barrier, moving what seems to be entirely content into stylesheets, and doesn't seem much like an edge case (I can't see a plausible argument for this being stylistic). Moving content into styles like this makes other automated processing of the content harder (or at least more expensive). For instance, a search for "figure 1.1" across all the books in my library will now require loading all chapters of all books into a UA, instead of just using an xml or html parser to find the text. On Sun, Aug 9, 2015 at 4:50 AM, Håkon Wium Lie <howcome@opera.com> wrote: > Sanders Kleinfeld wrote: > > > Re: cross-references, the main use case I would love to see covered is > > the ability to automatically customize the text content based on the > > type of element that is being linked to. So for example, if we had > > markup like the following: > > > > <section> > > <h1 id="a_section">The First section title</h1> > > <p>Some text here</p> > > <figure id="a_figure"> > > <figcaption>An interesting icon</figcaption> > > <img src="icon.gif"/> > > </figure> > > > > <p>In <a href="#a_section"/>, we have some cross references.</p> > > <p>In <a href="#a_figure"/>, we have an icon image</p> > > </section> > > > > We might want the cross-reference to the section heading (#a_section) > > to contain the text "Section 1.1", and the cross-reference to the > > figure caption to contain the text "Figure 1.1". > > You could this by adding a class to the <a> element, e.g.: > > <a class=figref href=...> > > Combined with something like: > > a.figref:before { content: "Figure: " } > > But I guess you're looking for a solution where you only insert simple > <a> elements that transform themselves? > > Sometimes this could lead to errors. E.g: > > See figure 2.3 on page 56. > Figure 2.3 on page 56 illustrates this. > > That is, the spelling of figure/Figure changes, this would be tough to > adjust automatically. > > 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? > > Cheers, > > -h&kon > Håkon Wium Lie CTO °þe®ª > howcome@opera.com http://people.opera.com/howcome > >
Received on Monday, 10 August 2015 14:58:21 UTC