Skip to content

Commit

Permalink
Merge matrix tables
Browse files Browse the repository at this point in the history
  • Loading branch information
bertfrees committed Feb 11, 2016
2 parents 2138654 + 48cb99e commit 627830c
Show file tree
Hide file tree
Showing 31 changed files with 1,146 additions and 200 deletions.
10 changes: 5 additions & 5 deletions maven/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
<artifactId>css-utils</artifactId>
<version>2.7.0</version>
<version>2.7.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
Expand All @@ -62,7 +62,7 @@
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
<artifactId>dotify-formatter</artifactId>
<version>1.7.0</version>
<version>1.7.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
Expand Down Expand Up @@ -261,7 +261,7 @@
<dependency>
<groupId>org.daisy.dotify</groupId>
<artifactId>dotify.api</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.daisy.dotify</groupId>
Expand All @@ -271,7 +271,7 @@
<dependency>
<groupId>org.daisy.dotify</groupId>
<artifactId>dotify.translator.impl</artifactId>
<version>2.0.1</version>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.daisy.dotify</groupId>
Expand All @@ -281,7 +281,7 @@
<dependency>
<groupId>org.daisy.dotify</groupId>
<artifactId>dotify.formatter.impl</artifactId>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.daisy.dotify</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@
The input is assumed to be a tree-of-boxes representation of a document where boxes are
represented by css:box elements. The document root must be a box or a css:_ element. The
parent of a box must be another box (or a css:_ element if it's the document
root). Inline boxes must not have descendant or sibling block boxes. All other nodes
must have at least one inline box ancestor. Computed values of 'margin-left',
'margin-right', 'border-left', 'border-top', 'border-right', 'border-bottom' and
'text-indent' properties must be declared in css:margin-left, css:margin-right,
css:border-left, css:border-top, css:border-right, css:border-bottom and css:text-indent
attributes. Boxes must have no padding.
root). Inline boxes must not have non-inline descendant or sibling boxes. Table-cell
boxes must have a parent table box and table boxes must have only table-cell child
boxes. All other nodes must have at least one inline box ancestor. Computed values of
'margin-left', 'margin-right', 'border-left', 'border-top', 'border-right',
'border-bottom' and 'text-indent' properties must be declared in css:margin-left,
css:margin-right, css:border-left, css:border-top, css:border-right, css:border-bottom
and css:text-indent attributes. Boxes must have no padding.
</p:documentation>
</p:input>

<p:output port="result">
<p:documentation>
Block boxes are repositioned and reshaped in such a way that their content (including
the first line box) does not overflow the left and right margin edges (i.e. the left and
right content edges of the container box), and does not overflow the left and right
border edges if a left or right border is present. While the edges of boxes may be
adjusted, the text content and borders remain at their original position unless it would
break the constraints above.
Block and table boxes are repositioned and reshaped in such a way that their content
(including the first line box) does not overflow the left and right margin edges
(i.e. the left and right content edges of the container box), and does not overflow the
left and right border edges if a left or right border is present. While the edges of
boxes may be adjusted, the text content and borders remain at their original position
unless it would break the constraints above. Table-cell boxes are not reshaped.
</p:documentation>
</p:output>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</xsl:copy>
</xsl:template>

<xsl:template match="css:box[@type='block']">
<xsl:template match="css:box[@type=('block','table')]">
<xsl:param name="used-container-left-content-edge" as="xs:integer" select="0"/>
<xsl:param name="actual-container-left-content-edge" as="xs:integer" select="0"/>
<xsl:param name="used-container-right-content-edge" as="xs:integer" select="0"/>
Expand All @@ -26,7 +26,7 @@
<xsl:variable name="used-left-border-edge" as="xs:integer" select="$used-left-margin-edge + $computed-margin-left"/>
<xsl:variable name="used-left-content-edge" as="xs:integer" select="$used-left-border-edge + $computed-border-left-width"/>
<xsl:variable name="actual-left-margin-edge" as="xs:integer" select="$actual-container-left-content-edge"/>
<xsl:variable name="actual-left-border-edge" as="xs:integer" select="if (descendant::css:box[@type='block']
<xsl:variable name="actual-left-border-edge" as="xs:integer" select="if (child::css:box[@type=('block','table')]
and not((@css:border-left|@css:border-top|@css:border-bottom)[not(.='none')]))
then $actual-left-margin-edge
else max(($actual-left-margin-edge,$used-left-border-edge))"/>
Expand All @@ -36,7 +36,7 @@
<xsl:variable name="used-first-line-left-edge" as="xs:integer" select="$used-left-content-edge + $computed-text-indent"/>
<xsl:variable name="actual-first-line-left-edge" as="xs:integer" select="if ((@css:border-left|@css:border-top|@css:border-bottom)[not(.='none')])
then max(($used-first-line-left-edge,$actual-left-content-edge))
else if (descendant::css:box[@type='block'])
else if (child::css:box[@type=('block','table')])
then $actual-left-margin-edge
else max(($used-first-line-left-edge,$actual-left-margin-edge))"/>
<xsl:variable name="actual-text-indent" as="xs:integer" select="$actual-first-line-left-edge - $actual-left-content-edge"/>
Expand All @@ -46,14 +46,14 @@
<xsl:variable name="used-right-border-edge" as="xs:integer" select="$used-right-margin-edge + $computed-margin-right"/>
<xsl:variable name="used-right-content-edge" as="xs:integer" select="$used-right-border-edge + $computed-border-right-width"/>
<xsl:variable name="actual-right-margin-edge" as="xs:integer" select="$actual-container-right-content-edge"/>
<xsl:variable name="actual-right-border-edge" as="xs:integer" select="if (descendant::css:box[@type='block']
<xsl:variable name="actual-right-border-edge" as="xs:integer" select="if (child::css:box[@type=('block','table')]
and not((@css:border-right|css:border-top|@css:border-bottom)[not(.='none')]))
then $actual-right-margin-edge
else max(($actual-right-margin-edge,$used-right-border-edge))"/>
<xsl:variable name="actual-right-content-edge" as="xs:integer" select="$actual-right-border-edge + $computed-border-right-width"/>
<xsl:variable name="actual-margin-right" as="xs:integer" select="$actual-right-border-edge - $actual-right-margin-edge"/>
<xsl:copy>
<xsl:sequence select="@* except (@css:margin-left|@css:margin-right|@css:text-indent)"/>
<xsl:apply-templates select="@* except (@css:margin-left|@css:margin-right|@css:text-indent)"/>
<xsl:if test="$actual-margin-left &gt; 0">
<xsl:attribute name="css:margin-left" select="$actual-margin-left"/>
</xsl:if>
Expand All @@ -74,6 +74,24 @@
</xsl:copy>
</xsl:template>

<xsl:template match="css:box[@type='table-cell']">
<xsl:copy>
<xsl:apply-templates select="@*|node()">
<xsl:with-param name="used-container-left-content-edge" select="0"/>
<xsl:with-param name="actual-container-left-content-edge" select="0"/>
<xsl:with-param name="used-container-right-content-edge" select="0"/>
<xsl:with-param name="actual-container-right-content-edge" select="0"/>
<xsl:with-param name="computed-container-text-indent" select="0"/>
<xsl:with-param name="actual-container-text-indent" select="0"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>

<!--
ignore non-collapsing margins
-->
<xsl:template match="@css:collapsing-margins"/>

<xsl:template match="@*|node()">
<xsl:sequence select="."/>
</xsl:template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@
<xsl:param name="properties" as="xs:string*" select="('#all')"/>
<xsl:param name="validate" as="xs:boolean" select="false()"/>
<xsl:variable name="declarations" as="element()*">
<xsl:apply-templates select="@css:*[local-name()=$properties]" mode="css:attribute-as-property"/>
<xsl:apply-templates select="@css:*[replace(local-name(),'^_','-')=$properties]" mode="css:attribute-as-property"/>
</xsl:variable>
<xsl:variable name="declarations" as="element()*"
select="(css:parse-declaration-list(css:parse-stylesheet(@style)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,26 @@
<xsl:variable name="css:applies-to" as="xs:string*"
select="('.*',
'.*',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|table|list-item)$',
'^(block|table|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'^(block|table|table-cell|list-item)$',
'^(block|table|list-item)$',
'^(block|table|list-item)$',
'^(block|table|list-item)$',
'^(block|list-item)$',
'^(block|list-item)$',
'.*',
Expand All @@ -147,7 +147,7 @@
'.*',
'.*',
'.*',
'^(block|list-item)$',
'^(block|table|list-item)$',
'.*',
'.*',
'.*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<p:import href="make-anonymous-inline-boxes.xpl"/>
<p:import href="make-boxes.xpl"/>
<p:import href="make-pseudo-elements.xpl"/>
<p:import href="make-table-grid.xpl"/>
<p:import href="new-definition.xpl"/>
<p:import href="padding-to-margin.xpl"/>
<p:import href="parse-content.xpl"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@
The input is assumed to be a tree-of-boxes representation of a document where boxes are
represented by css:box elements. The document root must be a box or a css:_ element. The
parent of a box must be another box (or a css:_ element if it's the document
root). Inline boxes must not have descendant block boxes. All other nodes must have at
least one inline box ancestor.
root). Inline boxes must not have non-inline descendant boxes. Table-cell boxes must
have a parent table box and table boxes must have only table-cell child boxes. All other
nodes must have at least one inline box ancestor.
</p:documentation>
</p:input>

<p:output port="result">
<p:documentation>
Adjacent inline boxes with one or more sibling block boxes are grouped and wrapped in an
anonymous block box.
Adjacent inline boxes with one or more sibling block or table boxes are grouped and
wrapped in an anonymous block box.
</p:documentation>
</p:output>

<p:wrap match="css:box[@type='inline'][preceding-sibling::css:box[@type='block'] or
following-sibling::css:box[@type='block']]"
<p:wrap match="css:box[@type='inline'][preceding-sibling::css:box[@type=('block','table')] or
following-sibling::css:box[@type=('block','table')]]"
group-adjacent="true()"
wrapper="css:_box_"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

<p:output port="result">
<p:documentation>
Inline boxes that have descendant block boxes are either unwrapped, or if the element
has one or more css:* attributes or if it's the document element, renamed to css:_. For
such elements, the inherited properties (specified in the element's style attribute) are
moved to the next preserved descendant box, and 'inherit' values on the next preserved
descendant box are concretized. css:_ elements are retained. All adjacent nodes that are
not boxes or css:_ elements and that are not already contained in an inline box are
wrapped into an anonymous one.
Inline boxes that have descendant block, table or table-cell boxes are either unwrapped,
or if the element has one or more css:* attributes or if it's the document element,
renamed to css:_. For such elements, the inherited properties (specified in the
element's style attribute) are moved to the next preserved descendant box, and 'inherit'
values on the next preserved descendant box are concretized. css:_ elements are
retained. All adjacent nodes that are not boxes or css:_ elements and that are not
already contained in an inline box are wrapped into an anonymous one.
</p:documentation>
</p:output>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
</xsl:template>

<!--
unwrap inline boxes that contain block boxes
unwrap inline boxes that contain block/table/table-cell boxes
-->
<xsl:template match="css:box[not(@type='block')
and descendant::css:box[@type='block']]">
<xsl:template match="css:box[@type='inline'
and descendant::css:box[@type=('block','table','table-cell')]]">
<xsl:variable name="properties" as="element()*">
<xsl:call-template name="inherit-properties"/>
</xsl:variable>
Expand Down Expand Up @@ -54,7 +54,8 @@

<xsl:template name="apply-templates">
<xsl:param name="container" as="element()?" select="()" tunnel="yes"/>
<xsl:for-each-group select="*|text()" group-adjacent="boolean(descendant-or-self::css:box[@type='block'])">
<xsl:for-each-group select="*|text()"
group-adjacent="boolean(descendant-or-self::css:box[@type=('block','table','table-cell')])">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<xsl:for-each select="current-group()">
Expand Down
Loading

0 comments on commit 627830c

Please sign in to comment.