Skip to content

Commit

Permalink
use @Class="compact" (with CSS) instead of @compact="yes" for XHTML/H…
Browse files Browse the repository at this point in the history
…TML5 outputs

Signed-off-by: chrispy <[email protected]>
  • Loading branch information
chrispy-snps committed Oct 14, 2023
1 parent 6755607 commit 5c72a13
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 47 deletions.
6 changes: 1 addition & 5 deletions src/main/plugins/org.dita.html5/sass/_lists.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ ul.simple {
margin-top: 1em;
}

*[compact="yes"] > li {
.compact > li {
margin-top: 0;
}

*[compact="no"] > li {
margin-top: 0.53em;
}

.liexpand {
margin-bottom: 1em;
margin-top: 1em;
Expand Down
39 changes: 20 additions & 19 deletions src/main/plugins/org.dita.html5/xsl/topic.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,11 @@ See the accompanying LICENSE file for applicable license.
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
<xsl:call-template name="setaname"/>
<ul>
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates select="@compact"/>
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class">
<xsl:value-of select="'compact'[current()/@compact = 'yes']"/>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="setid"/>
<xsl:apply-templates/>
</ul>
Expand All @@ -628,9 +631,12 @@ See the accompanying LICENSE file for applicable license.
<xsl:call-template name="setaname"/>
<ul>
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class" select="'simple'"/>
<xsl:with-param name="default-output-class">
<xsl:value-of select="'simple',
'compact'[current()/@compact = 'yes']"
separator=" "/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="@compact"/>
<xsl:call-template name="setid"/>
<xsl:apply-templates/>
</ul>
Expand All @@ -644,8 +650,11 @@ See the accompanying LICENSE file for applicable license.
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
<xsl:call-template name="setaname"/>
<ol>
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates select="@compact"/>
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class">
<xsl:value-of select="'compact'[current()/@compact = 'yes']"/>
</xsl:with-param>
</xsl:call-template>
<xsl:choose>
<xsl:when test="$olcount mod 3 = 1"/>
<xsl:when test="$olcount mod 3 = 2"><xsl:attribute name="type">a</xsl:attribute></xsl:when>
Expand Down Expand Up @@ -729,12 +738,11 @@ See the accompanying LICENSE file for applicable license.
<xsl:call-template name="setaname"/>
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
<dl>
<!-- handle DL compacting - default=yes -->
<xsl:if test="@compact = 'no'">
<xsl:attribute name="class">dlexpand</xsl:attribute>
</xsl:if>
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates select="@compact"/>
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class">
<xsl:value-of select="'compact'[current()/@compact = 'yes']"/>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="setid"/>
<xsl:apply-templates/>
</dl>
Expand Down Expand Up @@ -1936,13 +1944,6 @@ See the accompanying LICENSE file for applicable license.
<xsl:attribute name="dir" select="."/>
</xsl:template>

<!-- if the element has a compact=yes attribute, assert it in XHTML form -->
<xsl:template match="@compact">
<xsl:if test=". = 'yes'">
<xsl:attribute name="compact">compact</xsl:attribute><!-- assumes that no compaction is default -->
</xsl:if>
</xsl:template>

<xsl:template name="setscale">
<xsl:if test="@scale">
<!-- <xsl:attribute name="style">font-size: <xsl:value-of select="@scale"/>%;</xsl:attribute> -->
Expand Down
5 changes: 1 addition & 4 deletions src/main/plugins/org.dita.xhtml/resource/commonltr.css
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,9 @@ ul.simple {
font-weight: bold;
margin-top: 1em;
}
*[compact="yes"] > li {
.compact > li {
margin-top: 0;
}
*[compact="no"] > li {
margin-top: .53em;
}
.liexpand {
margin-top: 1em;
margin-bottom: 1em;
Expand Down
5 changes: 1 addition & 4 deletions src/main/plugins/org.dita.xhtml/resource/commonrtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,9 @@ ul.simple {
font-weight: bold;
margin-top: 1em;
}
*[compact="yes"] > li {
.compact > li {
margin-top: 0;
}
*[compact="no"] > li {
margin-top: .53em;
}
.liexpand {
margin-top: 1em;
margin-bottom: 1em;
Expand Down
35 changes: 20 additions & 15 deletions src/main/plugins/org.dita.xhtml/xsl/xslhtml/dita2htmlImpl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,11 @@ See the accompanying LICENSE file for applicable license.
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
<xsl:call-template name="setaname"/>
<ul>
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates select="@compact"/>
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class">
<xsl:value-of select="'compact'[current()/@compact = 'yes']"/>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="setid"/>
<xsl:apply-templates/>
</ul>
Expand All @@ -773,9 +776,12 @@ See the accompanying LICENSE file for applicable license.
<xsl:call-template name="setaname"/>
<ul>
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class" select="'simple'"/>
<xsl:with-param name="default-output-class">
<xsl:value-of select="'simple',
'compact'[current()/@compact = 'yes']"
separator=" "/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="@compact"/>
<xsl:call-template name="setid"/>
<xsl:apply-templates/>
</ul>
Expand All @@ -790,8 +796,11 @@ See the accompanying LICENSE file for applicable license.
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
<xsl:call-template name="setaname"/>
<ol>
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates select="@compact"/>
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class">
<xsl:value-of select="'compact'[current()/@compact = 'yes']"/>
</xsl:with-param>
</xsl:call-template>
<xsl:choose>
<xsl:when test="$olcount mod 3 = 1"/>
<xsl:when test="$olcount mod 3 = 2"><xsl:attribute name="type">a</xsl:attribute></xsl:when>
Expand Down Expand Up @@ -885,8 +894,11 @@ See the accompanying LICENSE file for applicable license.
<xsl:if test="@compact = 'no'">
<xsl:attribute name="class">dlexpand</xsl:attribute>
</xsl:if>
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates select="@compact"/>
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class">
<xsl:value-of select="'compact'[current()/@compact = 'yes']"/>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="setid"/>
<xsl:apply-templates/>
</dl>
Expand Down Expand Up @@ -2032,13 +2044,6 @@ See the accompanying LICENSE file for applicable license.
<xsl:attribute name="dir" select="."/>
</xsl:template>

<!-- if the element has a compact=yes attribute, assert it in XHTML form -->
<xsl:template match="@compact">
<xsl:if test=". = 'yes'">
<xsl:attribute name="compact">compact</xsl:attribute><!-- assumes that no compaction is default -->
</xsl:if>
</xsl:template>

<xsl:template name="setscale">
<xsl:if test="@scale">
<!-- <xsl:attribute name="style">font-size: <xsl:value-of select="@scale"/>%;</xsl:attribute> -->
Expand Down

0 comments on commit 5c72a13

Please sign in to comment.