Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docgen/xml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# XML docs rendering

## Heritage

- Unclear which version of `xs3p.xsl` was used as a base.
To be researched!!1
45 changes: 35 additions & 10 deletions docgen/xml/xs3p.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@

<xsl:param name="cycloneDxVersion">0.0</xsl:param>

<!-- After how many items shall an enum list have a break?
Only affects <pre> wrapped docs; non-pre may wrap automatically based on content-box.
Integer value. If set to <=0, then no breaks are done.
-->
<xsl:param name="breakEnumListAfterN">5</xsl:param>


<!-- ******** Constants ******** -->

Expand Down Expand Up @@ -432,6 +438,7 @@
obj.querySelectorAll('code,pre').forEach(function(block) {
block.innerHTML = block.textContent;
});
rawEl.className += ' docs-hidden';
});

// Sidebar scroll handling
Expand Down Expand Up @@ -699,7 +706,7 @@
-->
<xsl:template name="SectionFooter">
<!-- Link to top of page-->
<div style="text-align: right; clear: both;"><a href="#top" title="Go to top of page"><i class="bi bi-chevron-up"><xsl:text> </xsl:text></i></a></div>
<div style="text-align: right; clear: both;"><a href="#top" title="Go to top of page" aria-label="Go to top of page"><i class="bi bi-chevron-up" aria-hidden="true"></i></a></div>
<hr/>
</xsl:template>

Expand Down Expand Up @@ -933,6 +940,8 @@ pre {
.codehilite a {color: inherit !important; text-decoration: underline !important;}
.codehilite a:hover {opacity: 0.7 !important;}

.docs-hidden {display:none;}

@media (min-width: 992px) {
.xs3p-sidebar {
position: fixed;
Expand Down Expand Up @@ -2661,7 +2670,7 @@ pre {
<xsl:for-each select="$component/xsd:annotation/xsd:documentation">
<xsl:if test="position()!=1"><br/><br/></xsl:if>
<div class="annotation documentation" id="wdoc-{generate-id(.)}{$suffix}">
<div class="hidden" id="{generate-id(.)}{$suffix}-doc-raw">
<div id="{generate-id(.)}{$suffix}-doc-raw">
<xsl:value-of select="text()"/>
<xsl:if test="./@source">
Linked documentation: <xsl:value-of select="./@source"/>
Expand Down Expand Up @@ -3156,6 +3165,7 @@ pre {
<xsl:when test="xsd:simpleType">
<xsl:apply-templates select="xsd:simpleType" mode="sample">
<xsl:with-param name="schemaLoc" select="$schemaLoc"/>
<xsl:with-param name="margin" select="$margin"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
Expand Down Expand Up @@ -3959,11 +3969,13 @@ pre {
-->
<xsl:template match="xsd:simpleType" mode="sample">
<xsl:param name="schemaLoc">this</xsl:param>
<xsl:param name="margin">0</xsl:param>

<span class="constraint">
<xsl:call-template name="PrintSampleSimpleConstraints">
<xsl:with-param name="simpleContent" select="."/>
<xsl:with-param name="schemaLoc" select="$schemaLoc"/>
<xsl:with-param name="margin" select="$margin"/>
</xsl:call-template>
</span>
</xsl:template>
Expand Down Expand Up @@ -4104,7 +4116,7 @@ pre {
</xsl:variable>

<xsl:text> </xsl:text>
<button title="Show documentation for {$component/@name}" class="btn btn-link btn-doc" data-bs-toggle="modal" data-bs-target="#{$documentation}-popup"><i class="bi bi-info-circle"><xsl:text> </xsl:text></i></button>
<button title="Show documentation for {$component/@name}" aria-label="Show documentation for {$component/@name}" class="btn btn-link btn-doc" data-bs-toggle="modal" data-bs-target="#{$documentation}-popup"><i class="bi bi-info-circle" aria-hidden="true"></i></button>
</xsl:if>
</xsl:template>

Expand Down Expand Up @@ -4341,6 +4353,7 @@ pre {
<xsl:when test="$element/@name and $element/xsd:simpleType">
<xsl:apply-templates select="$element/xsd:simpleType" mode="sample">
<xsl:with-param name="schemaLoc" select="$schemaLoc"/>
<xsl:with-param name="margin" select="$margin"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
Expand Down Expand Up @@ -5314,6 +5327,7 @@ pre {
<xsl:param name="simpleContent"/>
<xsl:param name="schemaLoc">this</xsl:param>
<xsl:param name="typeList"/>
<xsl:param name="margin">0</xsl:param>

<xsl:choose>
<!-- Derivation by restriction -->
Expand All @@ -5322,6 +5336,7 @@ pre {
<xsl:with-param name="restriction" select="$simpleContent/xsd:restriction"/>
<xsl:with-param name="schemaLoc" select="$schemaLoc"/>
<xsl:with-param name="typeList" select="$typeList"/>
<xsl:with-param name="margin" select="$margin"/>
</xsl:call-template>
</xsl:when>
<!-- Derivation by list -->
Expand All @@ -5339,6 +5354,7 @@ pre {
<xsl:call-template name="PrintSampleSimpleConstraints">
<xsl:with-param name="simpleContent" select="$simpleContent/xsd:list/xsd:simpleType"/>
<xsl:with-param name="schemaLoc" select="$schemaLoc"/>
<xsl:with-param name="margin" select="$margin"/>
</xsl:call-template>
<xsl:text> ]</xsl:text>
</xsl:otherwise>
Expand Down Expand Up @@ -5369,6 +5385,7 @@ pre {
<xsl:call-template name="PrintSampleSimpleConstraints">
<xsl:with-param name="simpleContent" select="."/>
<xsl:with-param name="schemaLoc" select="$schemaLoc"/>
<xsl:with-param name="margin" select="$margin"/>
</xsl:call-template>
<xsl:text> ]</xsl:text>
</xsl:for-each>
Expand All @@ -5393,6 +5410,7 @@ pre {
<xsl:param name="restriction"/>
<xsl:param name="schemaLoc">this</xsl:param>
<xsl:param name="typeList"/>
<xsl:param name="margin">0</xsl:param>

<xsl:variable name="typeName" select="$restriction/parent::xsd:simpleType/@name"/>

Expand All @@ -5415,6 +5433,7 @@ pre {
<xsl:with-param name="simpleContent" select="$restriction/xsd:simpleType"/>
<xsl:with-param name="schemaLoc" select="$schemaLoc"/>
<xsl:with-param name="typeList" select="$typeList"/>
<xsl:with-param name="margin" select="$margin"/>
</xsl:call-template>
</xsl:when>
<!-- Base type reference -->
Expand Down Expand Up @@ -5462,6 +5481,7 @@ pre {
<xsl:text> (</xsl:text>
<xsl:call-template name="PrintEnumFacets">
<xsl:with-param name="simpleRestrict" select="$restriction"/>
<xsl:with-param name="margin" select="$margin"/>
</xsl:call-template>
<xsl:text>)</xsl:text>
</xsl:if>
Expand Down Expand Up @@ -7244,8 +7264,8 @@ pre {
</a>
<xsl:if test="$help != ''">
<span class="float-end xs3p-panel-help">
<button type="button" class="btn btn-doc" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="left" data-bs-html="true" data-bs-content="{$help}">
<i class="bi bi-question-circle"><xsl:text> </xsl:text></i>
<button type="button" class="btn btn-doc" aria-label="Help" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="left" data-bs-html="true" data-bs-content="{$help}">
<i class="bi bi-question-circle" aria-hidden="true"></i>
</button>
</span>
</xsl:if>
Expand Down Expand Up @@ -8201,18 +8221,23 @@ was not specified in the links file, <xsl:value-of select="$linksFile"/>.
-->
<xsl:template name="PrintEnumFacets">
<xsl:param name="simpleRestrict"/>
<xsl:param name="margin">0</xsl:param>

<xsl:if test="$simpleRestrict/xsd:enumeration">
<em>value</em>
<xsl:text> comes from list: {</xsl:text>

<xsl:for-each select="$simpleRestrict/xsd:enumeration">
<xsl:if test="position()!=1">
<xsl:text>|</xsl:text>
</xsl:if>
<xsl:if test="count($simpleRestrict/xsd:enumeration)>5">
<xsl:text>
</xsl:text>
<xsl:if test="$breakEnumListAfterN > 0
and (position() - 1) mod $breakEnumListAfterN = 0">
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="Repeat">
<xsl:with-param name="content"><xsl:text> </xsl:text></xsl:with-param>
<xsl:with-param name="count" select="number($margin) + number($ELEM_INDENT)"/>
</xsl:call-template>
</xsl:if>
<wbr/><xsl:text>|</xsl:text>
</xsl:if>
<xsl:text>'</xsl:text>
<xsl:value-of select="@value"/>
Expand Down