[doc] Use the rule names for the search index, include language
This provides better user experience for the search box on the documentation page. The search results show now the rule name, the language and the ruleset name.
This commit is contained in:
parent
427a6e041e
commit
955ab11922
@ -7,6 +7,20 @@ search: exclude
|
||||
[
|
||||
{% for page in site.pages %}
|
||||
{% unless page.search == "exclude" %}
|
||||
|
||||
{% if page.permalink contains "pmd_rules_" and page.keywords %}
|
||||
{% assign rules = page.keywords | split: ", " %}
|
||||
{% for rule in rules %}
|
||||
{
|
||||
"title": "{{ rule | escape }} ({{page.language}}, {{page.title}})",
|
||||
"tags": "{{ page.tags }}",
|
||||
"keywords": "{{rule}}",
|
||||
"url": "{{ page.url | remove: "/"}}#{{ rule | downcase }}",
|
||||
"summary": "{{page.summary | strip }}"
|
||||
}
|
||||
{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{
|
||||
"title": "{{ page.title | escape }}",
|
||||
"tags": "{{ page.tags }}",
|
||||
@ -14,6 +28,9 @@ search: exclude
|
||||
"url": "{{ page.url | remove: "/"}}",
|
||||
"summary": "{{page.summary | strip }}"
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% unless forloop.last and site.posts.size < 1 %},{% endunless %}
|
||||
{% endunless %}
|
||||
{% endfor %}
|
||||
|
@ -314,7 +314,9 @@ public class RuleDocGenerator {
|
||||
*/
|
||||
private void generateRuleSetIndex(Map<Language, List<RuleSet>> rulesets) throws IOException {
|
||||
for (Map.Entry<Language, List<RuleSet>> entry : rulesets.entrySet()) {
|
||||
String languageTersename = entry.getKey().getTerseName();
|
||||
Language language = entry.getKey();
|
||||
String languageTersename = language.getTerseName();
|
||||
String languageName = language.getName();
|
||||
for (RuleSet ruleset : entry.getValue()) {
|
||||
String rulesetFilename = RuleSetUtils.getRuleSetFilename(ruleset);
|
||||
String filename = RULESET_INDEX_FILENAME_PATTERN
|
||||
@ -336,6 +338,7 @@ public class RuleDocGenerator {
|
||||
lines.add("sidebaractiveurl: /" + LANGUAGE_INDEX_PERMALINK_PATTERN.replace("${language.tersename}", languageTersename));
|
||||
lines.add("editmepath: ../" + getRuleSetSourceFilepath(ruleset));
|
||||
lines.add("keywords: " + getRuleSetKeywords(ruleset));
|
||||
lines.add("language: " + languageName);
|
||||
lines.add("---");
|
||||
|
||||
for (Rule rule : getSortedRules(ruleset)) {
|
||||
|
@ -6,6 +6,7 @@ folder: pmd/rules/java
|
||||
sidebaractiveurl: /pmd_rules_java.html
|
||||
editmepath: ../rulesets/ruledoctest/sample.xml
|
||||
keywords: Sample, OverrideBothEqualsAndHashcode, JumbledIncrementer, DeprecatedSample, RenamedRule, MovedRule
|
||||
language: Java
|
||||
---
|
||||
## DeprecatedSample
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user