Small improvements
This commit is contained in:
@ -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)
|
||||
|
@ -44,13 +44,13 @@ The tool comes with a rather extensive help text, simply running with `-help`!
|
||||
specified.
|
||||
</td>
|
||||
<td>no</td>
|
||||
<td></td>
|
||||
<td>Java</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>-uri / -u</td>
|
||||
<td>Database URI for sources. If this is given, then you don't need to provide `-dir`.</td>
|
||||
<td>no</td>
|
||||
<td>plsql</td>
|
||||
<td>PLSQL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>-filelist</td>
|
||||
|
@ -42,7 +42,7 @@ The PMD command (`pmd.bat` or `run.sh pmd`) requires two options:
|
||||
sources.
|
||||
* `-R <path>`: 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
|
||||
|
Reference in New Issue
Block a user