Commit ebb7f1a3 authored by Philipp Zschumme's avatar Philipp Zschumme
Browse files

Merge branch 'param-ref' into 'master'

Implement functionality for <param-ref>

See merge request !6
parents 35f2c41a b4a457a1
Pipeline #3709 passed with stages
in 9 seconds
......@@ -108,6 +108,7 @@ function applySearchFilter(filter) {
<!-- Search through the table -->
let filter_strings = filter.split(" ");
let searchables = document.getElementsByClassName("tc-searchable");
let searchables_with_matched_parent = [];
for (let i = 0; i < searchables.length; i++) {
let searchable = searchables[i];
if (sectionNameMatches(searchable, filter_strings)
......@@ -115,12 +116,22 @@ function applySearchFilter(filter) {
|| programNameMatches(searchable, filter_strings)
|| tableEntriesMatch(searchable, filter_strings)) {
searchables[i].style.display = "";
for (const subsearchable of searchables[i].getElementsByClassName("tc-searchable")) {
searchables_with_matched_parent.push(subsearchable);
}
} else {
searchables[i].style.display = "none";
}
}
// make searchables visible when their parent matched the filter (to show all categories in full, if they match)
for (const subsearchable of searchables_with_matched_parent) {
subsearchable.style.display = "";
}
// make all sections visible that contain at least one visible searchable
let categories = document.getElementsByClassName("tc-section");
let categories = document.querySelectorAll(".tc-section, .tc-program"); // tc-program can also have subsections since <param-ref> was introduced
for (let i = 0; i < categories.length; i++) {
let searchables = categories[i].getElementsByClassName("tc-searchable");
let k = 0;
......
......@@ -124,12 +124,22 @@
<xsl:template name="programInternal">
<xsl:param name="description" />
<xsl:param name="father" />
<xsl:param name="override-name" />
<div class="tc-searchable tc-program">
<button class="tc-accordion">
<a id="{@name}" class="tc-program-name" href="#{@name}" name="{@name}">
<xsl:value-of select="@name"/>
</a>
<xsl:choose>
<xsl:when test="$override-name">
<a id="{$override-name}" class="tc-program-name" href="#{$override-name}" name="{$override-name}">
<xsl:value-of select="$override-name"/>
</a>
</xsl:when>
<xsl:otherwise>
<a id="{@name}" class="tc-program-name" href="#{@name}" name="{@name}">
<xsl:value-of select="@name"/>
</a>
</xsl:otherwise>
</xsl:choose>
</button>
<div class="tc-panel" style="overflow-x:auto;">
<center>
......@@ -157,14 +167,33 @@
<xsl:with-param name="father" select="$father"/>
</xsl:apply-templates>
</table>
<xsl:apply-templates select="param-ref">
<xsl:with-param name="father" select="$father"/>
</xsl:apply-templates>
</center>
</div>
</div>
</xsl:template>
<xsl:template match="param-ref">
<xsl:param name="father" />
<!-- resolve the reference -->
<xsl:variable name="struct_ref_name" select="@name" />
<xsl:variable name="struct_ref_father_name" select="$father" />
<xsl:variable name="struct_description" select="description" />
<xsl:apply-templates select="/programs/struct-ref[@name=$struct_ref_name]">
<xsl:with-param name="father_name" select="$struct_ref_father_name" />
<xsl:with-param name="description" select="$struct_description" />
<xsl:with-param name="override-name" select="@as-param" /> <!-- to override with which name the struct-ref is shown -->
</xsl:apply-templates>
</xsl:template>
<xsl:template match="struct-ref">
<xsl:param name="father_name" />
<xsl:param name="description" />
<xsl:param name="override-name" />
<xsl:if test="parent::section">
<!-- resolve the reference -->
......@@ -176,6 +205,7 @@
<!-- call this template again to print the program -->
<xsl:with-param name="father_name" select="$struct_ref_father_name" />
<xsl:with-param name="description" select="$struct_description" />
<xsl:with-param name="override-name" select="$override-name" /> <!-- to override with which name the struct-ref is shown -->
</xsl:apply-templates>
</xsl:if>
<xsl:if test="parent::programs">
......@@ -184,6 +214,7 @@
<!-- copying the description of the <struct-ref> over to the <program> -->
<xsl:with-param name="description" select="$description" />
<xsl:with-param name="father" select="$father_name" />
<xsl:with-param name="override-name" select="$override-name" /> <!-- to override with which name the struct-ref is shown -->
</xsl:call-template>
</xsl:if>
</xsl:template>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment