From eb21f3189dcedbc55cd347fb66abbdd2867b9464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 24 May 2018 17:58:54 +0200 Subject: [PATCH] Small improvements --- docs/_plugins/custom_filters.rb | 36 ++++++++++++------------ docs/pages/pmd/userdocs/cli_reference.md | 4 +-- docs/pages/pmd/userdocs/installation.md | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/_plugins/custom_filters.rb b/docs/_plugins/custom_filters.rb index 2d0ff09d68..6013d57f86 100644 --- a/docs/_plugins/custom_filters.rb +++ b/docs/_plugins/custom_filters.rb @@ -28,6 +28,24 @@ module CustomFilters any end + # sorts an array using the order defined by the given sidebar + def sort_using(xs, sidebar) + # caching is possible but doesn't improve significantly the build times + + rank_lookup = rank_lookup_from_sidebar(sidebar) + + xs.sort {|x, y| + # The default rank is very high so that pages that don't appear in the sidebar are put at the end + rx = rank_lookup[x.url] || 10000 + ry = rank_lookup[y.url] || 10000 + + rx <=> ry + } + + end + + private + def flatten_rec(seq) seq.map {|h| if (subs = h["folderitems"] || h["subfolderitems"] || h["subfolders"]) @@ -50,24 +68,6 @@ module CustomFilters end - - - # sorts an array using the order defined by the given sidebar - def sort_using(xs, sidebar) - # caching is possible but doesn't improve significantly the build times - - rank_lookup = rank_lookup_from_sidebar(sidebar) - - xs.sort {|x, y| - # The default rank is very high so that pages that don't appear in the sidebar are put at the end - rx = rank_lookup[x.url] || 10000 - ry = rank_lookup[y.url] || 10000 - - rx <=> ry - } - - end - end Liquid::Template.register_filter(CustomFilters) diff --git a/docs/pages/pmd/userdocs/cli_reference.md b/docs/pages/pmd/userdocs/cli_reference.md index 835520641a..0ea31bd17c 100644 --- a/docs/pages/pmd/userdocs/cli_reference.md +++ b/docs/pages/pmd/userdocs/cli_reference.md @@ -44,13 +44,13 @@ The tool comes with a rather extensive help text, simply running with `-help`! specified. no - + Java -uri / -u Database URI for sources. If this is given, then you don't need to provide `-dir`. no - plsql + PLSQL -filelist diff --git a/docs/pages/pmd/userdocs/installation.md b/docs/pages/pmd/userdocs/installation.md index 66dee4c962..57dd6659dd 100644 --- a/docs/pages/pmd/userdocs/installation.md +++ b/docs/pages/pmd/userdocs/installation.md @@ -42,7 +42,7 @@ The PMD command (`pmd.bat` or `run.sh pmd`) requires two options: sources. * `-R `: the ruleset file you want to use. PMD uses xml configuration files, called *rulesets*, which specify which rules to execute on your sources. You can also run a single rule by referencing it using its *category* and -name (more details [here](pmd_userdocs_making_rulesets.html#referencing-rules)). For example, you can check for unnecessary +name (more details [here](pmd_userdocs_making_rulesets.html#referencing-a-single-rule)). For example, you can check for unnecessary modifiers on Java sources with `-R category/java/codestyle.xml/UnnecessaryModifier`. {% include note.html