Skip to content

Commit

Permalink
Merge pull request dita-ot#4209 from chrispy-snps/feature/4207-add-ma…
Browse files Browse the repository at this point in the history
…rkers

add markers where named templates can be converted to moded templates
  • Loading branch information
jelovirt authored Jan 13, 2024
2 parents d475739 + c88e650 commit 2f2f943
Show file tree
Hide file tree
Showing 31 changed files with 260 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/main/plugins/org.dita.base/xsl/preprocess/mappullImpl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ Other modes can be found within the code, and may or may not prove useful for ov
<xsl:value-of select="normalize-space($grabbed-value)"/>
</xsl:when>
<xsl:otherwise>
<!-- TODO: Replace with mode="mappull:linktext-fallback" -->
<xsl:call-template name="linktext-fallback"/>
</xsl:otherwise>
</xsl:choose>
Expand All @@ -926,6 +927,7 @@ Other modes can be found within the code, and may or may not prove useful for ov
<xsl:value-of select="normalize-space($grabbed-value)"/>
</xsl:when>
<xsl:otherwise>
<!-- TODO: Replace with mode="mappull:linktext-fallback" -->
<xsl:call-template name="linktext-fallback"/>
</xsl:otherwise>
</xsl:choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,7 @@ mode="topicpull:figure-linktext" and mode="topicpull:table-linktext"
<xsl:param name="linkElement" as="element()" tunnel="yes"/>

<xsl:for-each select="$linkElement">
<!-- TODO: Replace with mode="ditamsg:crossref-unordered-listitem" -->
<xsl:call-template name="topicpull:referenced-invalid-list-item"/>
</xsl:for-each>
</xsl:template>
Expand Down
13 changes: 13 additions & 0 deletions src/main/plugins/org.dita.html5/xsl/cover.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,16 @@ See the accompanying LICENSE file for applicable license.
<xsl:apply-templates select="." mode="addAttributesToBody"/>
<xsl:call-template name="setidaname"/>
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
<!-- TODO: Replace with mode="generateBreadcrumbs" -->
<xsl:call-template name="generateBreadcrumbs"/>
<!-- TODO: Replace with mode="gen-user-header" -->
<xsl:call-template name="gen-user-header"/>
<!-- TODO: Replace with mode="processHDR" -->
<xsl:call-template name="processHDR"/>
<xsl:if test="$INDEXSHOW = 'yes'">
<xsl:apply-templates select="/*/*[contains(@class, ' map/topicmeta ')]/*[contains(@class, ' topic/keywords ')]/*[contains(@class, ' topic/indexterm ')]"/>
</xsl:if>
<!-- TODO: Replace with mode="gen-user-sidetoc" -->
<xsl:call-template name="gen-user-sidetoc"/>
<xsl:choose>
<xsl:when test="*[contains(@class, ' topic/title ')]">
Expand All @@ -156,29 +160,35 @@ See the accompanying LICENSE file for applicable license.
<xsl:apply-templates select="." mode="normalize-map"/>
</xsl:variable>
<xsl:apply-templates select="$map" mode="toc"/>
<!-- TODO: Replace with mode="gen-endnotes" -->
<xsl:call-template name="gen-endnotes"/>
<!-- TODO: Replace with mode="gen-user-footer" -->
<xsl:call-template name="gen-user-footer"/>
<!-- TODO: Replace with mode="processFTR" -->
<xsl:call-template name="processFTR"/>
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
</body>
</xsl:template>

<xsl:template match="*[contains(@class, ' map/map ')]/*[contains(@class, ' topic/title ')]">
<h1 class="title topictitle1">
<!-- TODO: Replace with mode="gen-user-panel-title-pfx" -->
<xsl:call-template name="gen-user-panel-title-pfx"/>
<xsl:apply-templates/>
</h1>
</xsl:template>

<xsl:template match="*[contains(@class, ' map/map ')]/@title">
<h1 class="title topictitle1">
<!-- TODO: Replace with mode="gen-user-panel-title-pfx" -->
<xsl:call-template name="gen-user-panel-title-pfx"/>
<xsl:value-of select="."/>
</h1>
</xsl:template>

<xsl:template match="*[contains(@class,' bookmap/bookmap ')]/*[contains(@class,' bookmap/booktitle ')]" priority="10">
<h1 class="title topictitle1">
<!-- TODO: Replace with mode="gen-user-panel-title-pfx" -->
<xsl:call-template name="gen-user-panel-title-pfx"/>
<xsl:apply-templates select="*[contains(@class, ' bookmap/mainbooktitle ')]/node()"/>
</h1>
Expand All @@ -188,14 +198,17 @@ See the accompanying LICENSE file for applicable license.
<title>
<xsl:choose>
<xsl:when test="/*[contains(@class,' bookmap/bookmap ')]/*[contains(@class,' bookmap/booktitle ')]/*[contains(@class, ' bookmap/mainbooktitle ')]">
<!-- TODO: Replace with mode="gen-user-panel-title-pfx" -->
<xsl:call-template name="gen-user-panel-title-pfx"/>
<xsl:value-of select="/*[contains(@class,' bookmap/bookmap ')]/*[contains(@class,' bookmap/booktitle ')]/*[contains(@class, ' bookmap/mainbooktitle ')]"/>
</xsl:when>
<xsl:when test="/*[contains(@class,' map/map ')]/*[contains(@class,' topic/title ')]">
<!-- TODO: Replace with mode="gen-user-panel-title-pfx" -->
<xsl:call-template name="gen-user-panel-title-pfx"/>
<xsl:value-of select="/*[contains(@class,' map/map ')]/*[contains(@class,' topic/title ')]"/>
</xsl:when>
<xsl:when test="/*[contains(@class,' map/map ')]/@title">
<!-- TODO: Replace with mode="gen-user-panel-title-pfx" -->
<xsl:call-template name="gen-user-panel-title-pfx"/>
<xsl:value-of select="/*[contains(@class,' map/map ')]/@title"/>
</xsl:when>
Expand Down
6 changes: 6 additions & 0 deletions src/main/plugins/org.dita.html5/xsl/rel-links.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ See the accompanying LICENSE file for applicable license.
<!--use xref content-->
</xsl:when>
<xsl:otherwise>
<!-- TODO: Replace with mode="determine-final-href" -->
<xsl:call-template name="href"/><!--use href text-->
</xsl:otherwise>
</xsl:choose>
Expand All @@ -81,6 +82,7 @@ See the accompanying LICENSE file for applicable license.
<xsl:value-of select="replace(@href, '^mailto:', '')"/><!--remove mailto: prefix from href text-->
</xsl:when>
<xsl:otherwise>
<!-- TODO: Replace with mode="determine-final-href" -->
<xsl:call-template name="href"/><!--use href text-->
</xsl:otherwise>
</xsl:choose>
Expand Down Expand Up @@ -461,6 +463,7 @@ Each child is indented, the linktext is bold, and the shortdesc appears in norma
</xsl:when>
<xsl:otherwise>
<!--use href-->
<!-- TODO: Replace with mode="determine-final-href" -->
<xsl:call-template name="href"/>
</xsl:otherwise>
</xsl:choose>
Expand Down Expand Up @@ -496,6 +499,7 @@ Each child is indented, the linktext is bold, and the shortdesc appears in norma
</xsl:when>
<xsl:otherwise>
<!--use href-->
<!-- TODO: Replace with mode="determine-final-href" -->
<xsl:call-template name="href"/>
</xsl:otherwise>
</xsl:choose>
Expand Down Expand Up @@ -570,6 +574,7 @@ Each child is indented, the linktext is bold, and the shortdesc appears in norma
</xsl:when>
<xsl:otherwise>
<!--use href-->
<!-- TODO: Replace with mode="determine-final-href" -->
<xsl:call-template name="href"/>
</xsl:otherwise>
</xsl:choose>
Expand Down Expand Up @@ -712,6 +717,7 @@ Each child is indented, the linktext is bold, and the shortdesc appears in norma
<xsl:value-of select="normalize-space(*[contains(@class, ' topic/linktext ')])"/>
</xsl:when>
<xsl:otherwise>
<!-- TODO: Replace with mode="determine-final-href" -->
<xsl:call-template name="href"/>
</xsl:otherwise>
</xsl:choose>
Expand Down
24 changes: 23 additions & 1 deletion src/main/plugins/org.dita.html5/xsl/topic.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ See the accompanying LICENSE file for applicable license.
<xsl:when test="@href">
<br/><div><a>
<xsl:attribute name="href">
<!-- TODO: Replace with mode="determine-final-href" -->
<xsl:call-template name="href"/>
</xsl:attribute>
<xsl:choose>
Expand Down Expand Up @@ -2328,9 +2329,12 @@ See the accompanying LICENSE file for applicable license.

<xsl:template name="chapter-setup">
<html>
<!-- TODO: Replace with mode="setTopicLanguage" -->
<xsl:call-template name="setTopicLanguage"/>
<!-- TODO: Replace with mode="chapterHead" -->
<xsl:call-template name="chapterHead"/>
<xsl:call-template name="chapterBody"/>
<!-- TODO: Replace with mode="chapterBody" -->
<xsl:call-template name="chapterBody"/>
</html>
</xsl:template>

Expand All @@ -2357,16 +2361,25 @@ See the accompanying LICENSE file for applicable license.
<xsl:template match="*" mode="chapterHead">
<head>
<!-- initial meta information -->
<!-- TODO: Replace with mode="generateCharset" -->
<xsl:call-template name="generateCharset"/> <!-- Set the character set to UTF-8 -->
<xsl:apply-templates select="." mode="generateDefaultCopyright"/> <!-- Generate a default copyright, if needed -->
<!-- TODO: Replace with mode="generateDefaultMeta" -->
<xsl:call-template name="generateDefaultMeta"/> <!-- Standard meta for security, robots, etc -->
<xsl:apply-templates select="." mode="getMeta"/> <!-- Process metadata from topic prolog -->
<!-- TODO: Replace with mode="copyright" -->
<xsl:call-template name="copyright"/> <!-- Generate copyright, if specified manually -->
<!-- TODO: Replace with mode="generateChapterTitle" -->
<xsl:call-template name="generateChapterTitle"/> <!-- Generate the <title> element -->
<!-- TODO: Replace with mode="gen-user-head" -->
<xsl:call-template name="gen-user-head" /> <!-- include user's XSL HEAD processing here -->
<!-- TODO: Replace with mode="gen-user-scripts" -->
<xsl:call-template name="gen-user-scripts" /> <!-- include user's XSL javascripts here -->
<!-- TODO: Replace with mode="gen-user-styles" -->
<xsl:call-template name="gen-user-styles" /> <!-- include user's XSL style element and content here -->
<!-- TODO: Replace with mode="processHDF" -->
<xsl:call-template name="processHDF"/> <!-- Add user HDF file, if specified -->
<!-- TODO: Replace with mode="generateCssLinks" -->
<xsl:call-template name="generateCssLinks"/> <!-- Generate links to CSS files -->
</head>
</xsl:template>
Expand Down Expand Up @@ -2468,6 +2481,7 @@ See the accompanying LICENSE file for applicable license.
<xsl:template match="/ | @* | node()" mode="generateChapterTitle">
<!-- Title processing - special handling for short descriptions -->
<title>
<!-- TODO: Replace with mode="gen-user-panel-title-pfx" -->
<xsl:call-template name="gen-user-panel-title-pfx"/> <!-- hook for a user-XSL title prefix -->
<xsl:variable name="maintitle"><xsl:apply-templates select="/*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/title ')]" mode="text-only"/></xsl:variable>
<xsl:variable name="ditamaintitle"><xsl:apply-templates select="/dita/*[contains(@class, ' topic/topic ')][1]/*[contains(@class, ' topic/title ')]" mode="text-only"/></xsl:variable>
Expand Down Expand Up @@ -2502,6 +2516,7 @@ See the accompanying LICENSE file for applicable license.
<xsl:apply-templates select="." mode="addHeaderToHtmlBodyElement"/>

<!-- Include a user's XSL call here to generate a toc based on what's a child of topic -->
<!-- TODO: Replace with mode="gen-user-sidetoc" -->
<xsl:call-template name="gen-user-sidetoc"/>

<xsl:apply-templates select="." mode="addContentToHtmlBodyElement"/>
Expand Down Expand Up @@ -2539,8 +2554,12 @@ See the accompanying LICENSE file for applicable license.
<!-- Process <body> content that is appropriate for HTML5 header section. -->
<xsl:template match="*" mode="addHeaderToHtmlBodyElement">
<xsl:variable name="header-content" as="node()*">
<!-- TODO: Replace with mode="generateBreadcrumbs" -->
<xsl:call-template name="generateBreadcrumbs"/>
<!-- include user's XSL running header here -->
<!-- TODO: Replace with mode="gen-user-header" -->
<xsl:call-template name="gen-user-header"/> <!-- include user's XSL running header here -->
<!-- TODO: Replace with mode="processHDR" -->
<xsl:call-template name="processHDR"/>
<xsl:if test="$INDEXSHOW = 'yes'">
<xsl:apply-templates select="/*/*[contains(@class, ' topic/prolog ')]/*[contains(@class, ' topic/metadata ')]/*[contains(@class, ' topic/keywords ')]/*[contains(@class, ' topic/indexterm ')] |
Expand Down Expand Up @@ -2578,6 +2597,7 @@ See the accompanying LICENSE file for applicable license.
<!-- followed by body content, again by fall-through in document order -->
<!-- followed by related links -->
<!-- followed by child topics by fall-through -->
<!-- TODO: Replace with mode="gen-endnotes" -->
<xsl:call-template name="gen-endnotes"/> <!-- include footnote-endnotes -->
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
</article>
Expand All @@ -2591,7 +2611,9 @@ See the accompanying LICENSE file for applicable license.

<xsl:template match="*" mode="addFooterToHtmlBodyElement">
<xsl:variable name="footer-content" as="node()*">
<!-- TODO: Replace with mode="gen-user-footer" -->
<xsl:call-template name="gen-user-footer"/> <!-- include user's XSL running footer here -->
<!-- TODO: Replace with mode="processFTR" -->
<xsl:call-template name="processFTR"/> <!-- Include XHTML footer, if specified -->
</xsl:variable>
<xsl:if test="exists($footer-content)">
Expand Down
1 change: 1 addition & 0 deletions src/main/plugins/org.dita.html5/xsl/ut-d.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ See the accompanying LICENSE file for applicable license.

<!-- In the context of XREF - call it's HREF processor -->
<xsl:template match="*[contains(@class, ' topic/xref ')]" mode="imagemap-xref">
<!-- TODO: Replace with mode="determine-final-href" -->
<xsl:attribute name="href"><xsl:call-template name="href"/></xsl:attribute>
<xsl:if test="@scope='external' or @type='external' or ((@format='PDF' or @format='pdf') and not(@scope='local'))">
<xsl:apply-templates select="." mode="external-link"/>
Expand Down
1 change: 1 addition & 0 deletions src/main/plugins/org.dita.pdf2.fop/xsl/fo/tables_fop.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ See the accompanying LICENSE file for applicable license.

<xsl:template match="*[contains(@class, ' topic/dt ')]">
<fo:block xsl:use-attribute-sets="dlentry.dt__content">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:if test="not(preceding-sibling::*[contains(@class,' topic/dt ')])">
<xsl:apply-templates select="../@id" mode="dlentry-id-for-fop"/>
Expand Down
6 changes: 6 additions & 0 deletions src/main/plugins/org.dita.pdf2/xsl/fo/commons.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ See the accompanying LICENSE file for applicable license.
</xsl:template>
<xsl:template match="*" mode="processTopicChapterInsideFlow">
<fo:block xsl:use-attribute-sets="topic">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:variable name="level" as="xs:integer">
<xsl:apply-templates select="." mode="get-topic-level"/>
Expand Down Expand Up @@ -329,6 +330,7 @@ See the accompanying LICENSE file for applicable license.
</xsl:template>
<xsl:template match="*" mode="processTopicAppendixInsideFlow">
<fo:block xsl:use-attribute-sets="topic">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:variable name="level" as="xs:integer">
<xsl:apply-templates select="." mode="get-topic-level"/>
Expand Down Expand Up @@ -406,6 +408,7 @@ See the accompanying LICENSE file for applicable license.
</xsl:template>
<xsl:template match="*" mode="processTopicAppendicesInsideFlow">
<fo:block xsl:use-attribute-sets="topic">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:if test="empty(ancestor::*[contains(@class, ' topic/topic ')])">
<fo:marker marker-class-name="current-topic-number">
Expand Down Expand Up @@ -488,6 +491,7 @@ See the accompanying LICENSE file for applicable license.
</xsl:template>
<xsl:template match="*" mode="processTopicPartInsideFlow">
<fo:block xsl:use-attribute-sets="topic">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:if test="empty(ancestor::*[contains(@class, ' topic/topic ')])">
<fo:marker marker-class-name="current-topic-number">
Expand Down Expand Up @@ -557,6 +561,7 @@ See the accompanying LICENSE file for applicable license.
<xsl:call-template name="insertPrefaceStaticContents"/>
<fo:flow flow-name="xsl-region-body">
<fo:block xsl:use-attribute-sets="topic">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:if test="empty(ancestor::*[contains(@class, ' topic/topic ')])">
<fo:marker marker-class-name="current-topic-number">
Expand Down Expand Up @@ -628,6 +633,7 @@ See the accompanying LICENSE file for applicable license.
</xsl:template>
<xsl:template match="*" mode="processTopicFrontMatterInsideFlow">
<fo:block xsl:use-attribute-sets="topic">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:if test="not(ancestor::*[contains(@class, ' topic/topic ')])">
<fo:marker marker-class-name="current-topic-number">
Expand Down
3 changes: 3 additions & 0 deletions src/main/plugins/org.dita.pdf2/xsl/fo/concept.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,21 @@ See the accompanying LICENSE file for applicable license.
<xsl:when test="not(node())"/>
<xsl:when test="$level = 1">
<fo:block xsl:use-attribute-sets="body__toplevel conbody">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:block>
</xsl:when>
<xsl:when test="$level = 2">
<fo:block xsl:use-attribute-sets="body__secondLevel conbody">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:block xsl:use-attribute-sets="conbody">
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:block>
Expand Down
1 change: 1 addition & 0 deletions src/main/plugins/org.dita.pdf2/xsl/fo/glossary.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ See the accompanying LICENSE file for applicable license.

<xsl:template match="ot-placeholder:glossarylist//*[contains(@class, ' glossentry/glossentry ')]">
<fo:block>
<!-- TODO: Replace with mode="commonattributes" -->
<xsl:call-template name="commonattributes"/>
<fo:block>
<xsl:attribute name="id">
Expand Down
Loading

0 comments on commit 2f2f943

Please sign in to comment.