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

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