Making pagination controls accessible to DITA writers

chrispitude
Posts: 77
Joined: Thu May 02, 2019 2:32 pm

Making pagination controls accessible to DITA writers

Post by chrispitude » Tue Aug 06, 2019 5:56 pm

In our DITA flow, I used my RelaxNG DITA grammar creator (https://github.com/chrispy-snps/DITA-plugin-utilities) to create a specialized pagination attribute constrained to a set of values:

Code: Select all

 <attributedomain filename="paginateAttMod.rng" domain="paginate">
  <specialize attribute="paginate" from="base" model="(keep-with-next|keep-with-previous|top-of-page)*"/>
 </attributedomain>
Oxygen XML Author is clever enough to present only the allowed attribute values to our writers. In this example, I apply a keep-with-next directive to the paragraph before a figure:
paginate.gif
paginate.gif (106.88 KiB) Viewed 200 times
In Oxygen PDF Chemistry, our CSS file applies the pagination properties as follows:

Code: Select all

@media print {
  *[paginate~="keep-with-next"] { page-break-after: avoid; }
  *[paginate~="keep-with-previous"] { page-break-before: avoid; }
  *[paginate~="top-of-page"] { page-break-before: always; }
}
We have similar specialized attributes for cross-reference format and table/example/inline style controls:

Code: Select all

 <attributedomain filename="xformatAttMod.rng" domain="xformat">
  <specialize attribute="xformat" from="base" model="(\(equation\)|appendix|chapter|command|endnote|equation|example|figure|footnote|heading|page|partdiv|section|step|table|topic|unknown|_uselabel|_onpage)*"/>
 </attributedomain>

 <attributedomain filename="styleAttMod.rng" domain="style">
  <specialize attribute="style" from="base" model="(bold|italic|wide|smallfonts|tight)*"/>
 </attributedomain>
I wanted to share our approach in case it was useful to someone.

- Chris

chrispitude
Posts: 77
Joined: Thu May 02, 2019 2:32 pm

Re: Making pagination controls accessible to DITA writers

Post by chrispitude » Sun Aug 18, 2019 10:21 pm

I added the following alternate CSS file that the user can toggle on and off:

Code: Select all

/* implement visual markers for pagination properties */
*[paginate ~= "top-of-page"]::before(1000) {
	display: block;
    content: '\00a0';
    height:5px;
    border-top:5px dashed #f00;
    margin-left: -1000in;
    margin-right: -1000in;
}
*[paginate ~= "keep-with-previous"] {
    border-top:5px dotted #0f0 !important;
}
*[paginate ~= "keep-with-next"] {
    border-bottom:5px dotted #0f0 !important;
}
This makes the top-of-page dividers (red) and keep-with-previous, keep-with-next properties visible as follows:
pagination.png
pagination.png (57.96 KiB) Viewed 147 times

Post Reply