W3C home > Mailing lists > Public > www-style@w3.org > November 2018

[css-content] Generated content: should distinguish between content that's above or below a reference

From: Hans Meiser <brille1@hotmail.com>
Date: Sun, 4 Nov 2018 19:39:07 +0000
To: "www-style@w3.org" <www-style@w3.org>
Message-ID: <VI1PR0901MB1422EBE1EEAB5422AADAB917E2C90@VI1PR0901MB1422.eurprd09.prod.outlook.com>
Particularly when hyperlinks reference content on the same printed page, there should be an option to have generated content be able to recognize this. Also, there should be a content option to tell whether referenced content is above or below an element correspondingly.


So, when a hyperlink references content that's printed on the "previous", "next" or "this" page, there should be an option to have the content: property define an array of element's content accordingly:


a::before

{ content: "see ";

}


a::after

{ content: ".";

}


a

{

  content: ["page " page(attr(data-ref-id)) ", section " paragraph(attr(data-ref-id)), "previous page", "above", "below", "next page", "page " page(attr(data-ref-id)) ", section " paragraph(attr(data-ref-id))]

}



Here's the logic behind the suggested parameter array:


[ text to insert  when:  currentPageNumber - referencedElementPageNumber > 1

, text to insert  when:  currentPageNumber - referencedElementPageNumber == 1

, text to insert  when:  currentPageNumber - referencedElementPageNumber == 0

                           && preceeding::element(#referencedElement) != null

, text to insert  when:  referencedItemPageNumber - currentPageNumber == 0

                           && following::element(#referencedElement) != null

, text to insert  when:  referencedElementPageNumber - currentPageNumber == 1

, text to insert  when:  referencedElementPageNumber - currentPageNumber > 1

]


Here's a table showing samples of generated content for the above suggested CSS:


Position of Anchor element
        Position of referenced element
        Replaced text of Anchor element

page 10, paragraph 5
        page 2, paragraph 3
        page 2, section 3

page 10, paragraph 5
        page 5, paragraph 18
        page 5, section 18

page 10, paragraph 5
        page 9, paragraph 8
        previous page

page 10, paragraph 5
        page 10, paragraph 2
        above

page 10, paragraph 5
        page 10, paragraph 23
        below

page 10, paragraph 5
        page 11, paragraph 5
        next page

page 10, paragraph 5
        page 12, paragraph 1
        page 12, section 1

page 10, paragraph 5
        page 26, paragraph 7
        page 26, section 7




Axel Dahmen
Received on Sunday, 4 November 2018 19:39:31 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 4 November 2018 19:39:32 UTC