Skip to content

Commit

Permalink
Move custom classes to new attribute sets
Browse files Browse the repository at this point in the history
Per dita-ot/dita-ot#3090

Signed-off-by: Roger Sheen <roger@infotexture.net>
  • Loading branch information
infotexture committed Mar 4, 2019
1 parent 773cdf0 commit e19d89e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 56 deletions.
65 changes: 10 additions & 55 deletions xsl/html5-bootstrap.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -56,61 +56,16 @@
</body>
</xsl:template>

<!-- Override to add Bootstrap grid class -->
<!-- https://getbootstrap.com/docs/3.3/css/#grid -->
<xsl:template match="*" mode="addContentToHtmlBodyElement">
<!-- ↓ Add grid class -->
<main class="col-lg-9" role="main">
<!-- ↑ End customization -->
<article role="article">
<xsl:attribute name="aria-labelledby">
<xsl:apply-templates select="*[contains(@class,' topic/title ')] |
self::dita/*[1]/*[contains(@class,' topic/title ')]" mode="return-aria-label-id"/>
</xsl:attribute>
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
<xsl:apply-templates/> <!-- this will include all things within topic; therefore, -->
<!-- title content will appear here by fall-through -->
<!-- followed by prolog (but no fall-through is permitted for it) -->
<!-- followed by body content, again by fall-through in document order -->
<!-- followed by related links -->
<!-- followed by child topics by fall-through -->
<xsl:call-template name="gen-endnotes"/> <!-- include footnote-endnotes -->
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
</article>
</main>
</xsl:template>
<!-- Override to add Bootstrap large grid classes. -->
<!-- https://getbootstrap.com/docs/4.3/layout/grid -->
<xsl:attribute-set name="main">
<xsl:attribute name="class">col-lg-9</xsl:attribute>
<xsl:attribute name="role">main</xsl:attribute>
</xsl:attribute-set>

<!-- Override `nav.xsl` to add Bootstrap classes -->
<xsl:template match="*" mode="gen-user-sidetoc">
<xsl:if test="$nav-toc = ('partial', 'full')">
<!-- ↓ Add grid class to <nav>, wrap <ul> in small well <div> & add .bs-docs-sidenav class -->
<nav class="col-lg-3" role="toc">
<div class="well well-sm">
<ul class="bs-docs-sidenav">
<!-- ↑ End customization -->
<xsl:choose>
<xsl:when test="$nav-toc = 'partial'">
<xsl:apply-templates select="$current-topicref" mode="toc-pull">
<xsl:with-param name="pathFromMaplist" select="$PATH2PROJ" as="xs:string"/>
<xsl:with-param name="children" as="element()*">
<xsl:apply-templates select="$current-topicref/*[contains(@class, ' map/topicref ')]" mode="toc">
<xsl:with-param name="pathFromMaplist" select="$PATH2PROJ" as="xs:string"/>
</xsl:apply-templates>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$nav-toc = 'full'">
<xsl:apply-templates select="$input.map" mode="toc">
<xsl:with-param name="pathFromMaplist" select="$PATH2PROJ" as="xs:string"/>
</xsl:apply-templates>
</xsl:when>
</xsl:choose>
</ul>
<!-- ↓ Close Bootstrap divs -->
</div>
<!-- ↑ End customization -->
</nav>
</xsl:if>
</xsl:template>
<xsl:attribute-set name="toc">
<xsl:attribute name="class">col-lg-3</xsl:attribute>
<xsl:attribute name="role">toc</xsl:attribute>
</xsl:attribute-set>

</xsl:stylesheet>
2 changes: 1 addition & 1 deletion xsl/map2html5-cover.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<xsl:if test="descendant::*[contains(@class, ' map/topicref ')]
[not(@toc = 'no')]
[not(@processing-role = 'resource-only')]">
<nav class="col-lg-3" role="toc">
<nav xsl:use-attribute-sets="toc">
<div class="well well-sm">
<ul>
<xsl:call-template name="commonattributes">
Expand Down

0 comments on commit e19d89e

Please sign in to comment.