xml.css-to-obfl.xpl Maven / Gradle / Ivy
Convert a document with inline braille CSS to OBFL (Open Braille Formatting Language).
Make css:page, css:volume, css:after, css:before, css:footnote-call, css:duplicate,
css:alternate, css:_obfl-alternate-scenario, css:_obfl-on-toc-start,
css:_obfl-on-volume-start, css:_obfl-on-volume-end, css:_obfl-on-toc-end and
css:_obfl-volume-transition attributes.
For now, ignore @text-transform definitions.
Make css:flow attributes.
::-obfl-alternate-scenario pseudo-elements must participate in the normal flow.
Make css:before, css:after, css:duplicate, css:alternate and
css:footnote-call pseudo-elements from css:before, css:after, css:duplicate,
css:alternate and css:footnote-call attributes.
Make css:_obfl-on-toc-start, css:_obfl-on-volume-start,
css:_obfl-on-volume-end, css:_obfl-on-toc-end and
css:_obfl-alternate-scenario pseudo-elements.
Apply possible relative rules.
Make css:page and css:volume and css:_obfl-volume-transition attributes, css:after,
css:before, css:duplicate, css:alternate, css:footnote-call, css:_obfl-on-toc-start,
css:_obfl-on-volume-start, css:_obfl-on-volume-end and css:_obfl-on-toc-end
pseudo-elements.
Make css:display, css:render-table-by and css:table-header-policy attributes.
Layout tables as lists.
Need another pass because css:render-table-by inserts new styles.
Delete @css:_obfl-volume-transition attributes.
Extract css:_obfl-on-toc-start, css:_obfl-on-volume-start, css:_obfl-on-volume-end
and css:_obfl-on-toc-end pseudo-elements into their own documents.
Make css:content, css:string-set, css:counter-reset, css:counter-set,
css:counter-increment and css:_obfl-marker attributes.
Evaluate css:string-set attributes.
Make css:string, css:text, css:content, css:counter and css:custom-func elements from
css:content attributes.
Split into a sequence of flows.
Make css:flow attributes.
Extract named flows based on css:flow attributes and place anchors (css:id
attributes) in the normal flow.
Make css:id attributes.
Evaluate css:content elements.
Make css:white-space, css:display and css:list-style-type attributes.
Make css:white-space elements from css:white-space attributes.
Force "obfl-scenario" elements to be blocks.
Mark display:-obfl-toc elements.
Mark display:-obfl-list-of-references elements.
Treat display:-obfl-toc and display:-obfl-list-of-references as block.
Create table grid structures from HTML/DTBook tables.
Make css:box elements based on css:display and css:list-style-type attributes.
Move css:render-table-by, css:_obfl-table-col-spacing, css:_obfl-table-row-spacing
and css:_obfl-preferred-empty-space attributes to 'table' css:box elements.
Evaluate css:counter elements. All css:counter-set, css:counter-increment and
css:counter-reset attributes in the output will be manipulating page counters.
Evaluate css:flow elements.
Evaluate css:text elements.
Wrap/unwrap with inline css:box elements.
Don't support 'volume' within named flows. Don't support 'volume', 'page' and
'counter-set' within tables.
Move css:counter-set attribute to css:box elements.
Move css:page attributes to css:box elements.
Move css:volume attributes to css:box elements.
Move css:string-set attributes to inline css:box elements.
Move css:_obfl-marker attributes.
Move css:id attributes to css:box elements.
All css:_ elements except for root elements, top-level elements in named flows (with
css:anchor attribute), and empty elements with a css:id, css:string-set or
css:_obfl-marker attribute within a css:box element should be gone now.
Wrap inline css:box elements in block css:box elements where necessary.
Make css:margin-left, css:margin-right, css:margin-top, css:margin-bottom,
css:padding-left, css:padding-right, css:padding-top, css:padding-bottom,
css:border-left-pattern, css:border-right-pattern, css:border-top-pattern,
css:border-bottom-pattern, css:border-left-style, css:border-right-style,
css:border-top-style, css:border-bottom-style and css:text-indent attributes.
Convert CSS properties to corresponding OBFL attributes.
Remove text nodes from block boxes with no line boxes.
Don't support 'page-break-before' and 'page-break-after' within tables or
'-obfl-toc' elements.
Split flows into sections.
Insert forced page breaks to satisfy the 'page' and 'volume' properties.
Convert css:page-break-after="auto-right" to a css:page-break-before on the
following sibling, and css:volume-break-after="always" to a
css:volume-break-before on the following sibling.
Split before css:counter-set attributes, and before css:volume-break-before
attributes with value 'always'.
Move css:page, css:counter-set and css:volume attributes to css:_ root element.
Delete properties connected to the top of a box if it is not the first part of a
split up box. Delete properties connected to the bottom of a box if it is not
the last part of a split up box.
Move around and change page breaking related properties so that they can be mapped
one-to-one on OBFL properties.
Propagate css:page-break-before, css:page-break-after,
css:page-break-inside, css:volume-break-before and css:volume-break-after
attributes. (Needs to be done a second time because the box tree has been
broken up by css:split. css:page-break-before='right' will now be propagated
all the wait to the root box.)
Rename 'auto-right' (the special forced page break value to satisfy the
'page' property) to 'right'.
Convert css:page-break-before="avoid" to a css:page-break-after on the
preceding sibling and css:page-break-after="always|right|left" to a
css:page-break-before on the following sibling.
Move css:page-break-after="avoid" to last descendant block.
Repeat css:string-set attributes at the beginning of sections as css:string-entry.
Delete css:margin-top from first block and move css:margin-top of other blocks to
css:margin-bottom of their preceding block.