Skip to content

Commit b737eb0

Browse files
committed
show keyword or keyword search match counts
1 parent 14c8742 commit b737eb0

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/robot/htmldata/libdoc/libdoc.html

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ <h1>Opening library documentation failed</h1>
6464
renderTemplate('tags-shortcuts', libdoc);
6565
}
6666
scrollToHash();
67+
setTimeout(function() {
68+
document.getElementById("keyword-statistics-header").innerText = '' + libdoc.keywords.length;
69+
}, 0);
6770
});
6871

6972
function parseTemplates() {
@@ -136,9 +139,7 @@ <h1>Opening library documentation failed</h1>
136139
libdoc.selectedTag = include.tagsExact ? pattern : "";
137140
renderTemplate('tags-shortcuts', libdoc);
138141
}
139-
const ending = matchCount !== 1 ? 's.' : '.';
140-
$('#match-count').show().text(matchCount + ' matched keyword' + ending);
141-
$('#altogether-count').hide();
142+
document.getElementById("keyword-statistics-header").innerText = matchCount + ' / ' + result.keywords.length;
142143
if (matchCount === 0)
143144
$('#keywords-container').find('table').empty();
144145
}
@@ -198,8 +199,7 @@ <h1>Opening library documentation failed</h1>
198199
if (libdoc.contains_tags) {
199200
renderTemplate('tags', libdoc);
200201
}
201-
$('#match-count').hide();
202-
$('#altogether-count').show();
202+
document.getElementById("keyword-statistics-header").innerText = ''+libdoc.keywords.length;
203203
history.replaceState && history.replaceState(null, '', location.pathname);
204204
}
205205

@@ -303,7 +303,7 @@ <h4>Documentation</h4>
303303
<select id="tags-shortcuts-container" onchange="location = this.value;">
304304
</select>
305305
{{/if}}
306-
<h4>Keywords</h4>
306+
<h4>Keywords (<span id="keyword-statistics-header"></span>)</h4>
307307
<ul class="shortcuts" id="keyword-shortcuts-container">
308308
</ul>
309309
</div>
@@ -397,9 +397,6 @@ <h4>Documentation</h4>
397397

398398
<script type="text/x-jquery-tmpl" id="footer-template">
399399
<p class="footer">
400-
<span id="altogether-count">Altogether ${keywords.length} keywords.</span>
401-
<span id="match-count"></span>
402-
<br>
403400
Generated by <a href="http://robotframework.org/robotframework/#built-in-tools">Libdoc</a> on ${generated}.
404401
</p>
405402
</script>

0 commit comments

Comments
 (0)