Correctly handle a few more mis-identified locales
This commit is contained in:
parent
c6f53fb0fb
commit
d19c56f285
2 changed files with 18 additions and 3 deletions
|
|
@ -32,10 +32,15 @@ pub fn parse_path(path: &str) -> Option<(&str, &str, &str)> {
|
|||
}
|
||||
|
||||
let cap = match RE.captures(path) { Some(x) => x, None => return None };
|
||||
let locale = cap.get(1).map(|e| e.as_str()).unwrap_or("");
|
||||
let mut locale = cap.get(1).map(|e| e.as_str()).unwrap_or("");
|
||||
let name = cap.get(2).unwrap().as_str();
|
||||
let section = cap.get(3).unwrap().as_str();
|
||||
|
||||
// Some weird directories that happen to match the locale
|
||||
if locale.contains("openmpi") || locale.contains("mpich") || locale.contains("mvapich") {
|
||||
locale = "";
|
||||
}
|
||||
|
||||
// Not everything matching the regex is necessarily a man page, exclude some special cases.
|
||||
match (name, section, locale) {
|
||||
// Files that totally aren't man pages
|
||||
|
|
@ -47,9 +52,10 @@ pub fn parse_path(path: &str) -> Option<(&str, &str, &str)> {
|
|||
(_, "bz2", _) |
|
||||
(_, "xz", _) |
|
||||
(_, "html", _) => None,
|
||||
// Some weird directories that happen to match the locale
|
||||
// Some more weird directories that happen to match the locale
|
||||
(n, s, "5man") |
|
||||
(n, s, "c") |
|
||||
(n, s, "man") |
|
||||
(n, s, "man1") |
|
||||
(n, s, "man2") |
|
||||
(n, s, "man3") |
|
||||
|
|
@ -59,7 +65,8 @@ pub fn parse_path(path: &str) -> Option<(&str, &str, &str)> {
|
|||
(n, s, "man7") |
|
||||
(n, s, "man8") |
|
||||
(n, s, "Man-Part1") |
|
||||
(n, s, "Man-Part2") => Some((n, s, "")),
|
||||
(n, s, "Man-Part2") |
|
||||
(n, s, "overrides") => Some((n, s, "")),
|
||||
// Nothing special!
|
||||
x => Some(x)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue