Skip to content

Commit

Permalink
HDITA example WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Jarno Elovirta <jarno@elovirta.com>
  • Loading branch information
jelovirt committed Jun 11, 2023
1 parent 65ff750 commit 0d343db
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/resources/hdita2dita-common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,18 @@
</div>
</xsl:template>

<xsl:template match="div[@data-class = 'example']">
<example>
<xsl:apply-templates select="." mode="class"/>
<xsl:apply-templates select="@* | node()"/>
</example>
</xsl:template>
<xsl:template match="div[@data-class = 'example']" mode="class">
<xsl:attribute name="class">
<xsl:text>- topic/example </xsl:text>
</xsl:attribute>
</xsl:template>

<xsl:template match="ol">
<ol>
<xsl:apply-templates select="." mode="class"/>
Expand Down Expand Up @@ -777,6 +789,7 @@
</xsl:template>

<xsl:template match="@data-hd-class" priority="10"/>
<xsl:template match="@data-class" priority="10"/>

<xsl:template match="@data-keyref">
<xsl:attribute name="keyref" select="."/>
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/elovirta/dita/html/HDitaReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public String getExp() {
"dl.html",
"entity.html",
"escape.html",
"example.html",
"hdita.html",
"html.html",
"image-size.html",
Expand Down
14 changes: 14 additions & 0 deletions src/test/resources/hdita/example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>Example</title>
<article>
<h1>Example</h1>
<p>Shortdesc.</p>
<div data-class="example">
<h2>Example section</h2>
<p>Example content.</p>
</div>
<div data-class="example">
<h2>Example section</h2>
<p>Example content.</p>
</div>
</article>

0 comments on commit 0d343db

Please sign in to comment.