parent
c2b76d1850
commit
5fe4590063
|
@ -8,6 +8,7 @@
|
||||||
- Background colour is set fewer times when highlighting syntaxes
|
- Background colour is set fewer times when highlighting syntaxes
|
||||||
- Link checker will not try to validate email links anymore
|
- Link checker will not try to validate email links anymore
|
||||||
- Load table and footnote markdown extensions in `markdown` filter
|
- Load table and footnote markdown extensions in `markdown` filter
|
||||||
|
- `get_url` now defaults to not adding a trailing slash
|
||||||
|
|
||||||
## 0.4.2 (2018-09-03)
|
## 0.4.2 (2018-09-03)
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,8 @@ pub fn make_get_url(permalinks: HashMap<String, String>, config: Config) -> Glob
|
||||||
|
|
||||||
let trailing_slash = args
|
let trailing_slash = args
|
||||||
.get("trailing_slash")
|
.get("trailing_slash")
|
||||||
.map_or(true, |c| {
|
.map_or(false, |c| {
|
||||||
from_value::<bool>(c.clone()).unwrap_or(true)
|
from_value::<bool>(c.clone()).unwrap_or(false)
|
||||||
});
|
});
|
||||||
|
|
||||||
let path = required_arg!(
|
let path = required_arg!(
|
||||||
|
@ -260,37 +260,37 @@ mod tests {
|
||||||
let mut args = HashMap::new();
|
let mut args = HashMap::new();
|
||||||
args.insert("path".to_string(), to_value("app.css").unwrap());
|
args.insert("path".to_string(), to_value("app.css").unwrap());
|
||||||
args.insert("cachebust".to_string(), to_value(true).unwrap());
|
args.insert("cachebust".to_string(), to_value(true).unwrap());
|
||||||
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css/?t=1");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_remove_trailing_slashes() {
|
|
||||||
let config = Config::default();
|
|
||||||
let static_fn = make_get_url(HashMap::new(), config);
|
|
||||||
let mut args = HashMap::new();
|
|
||||||
args.insert("path".to_string(), to_value("app.css").unwrap());
|
|
||||||
args.insert("trailing_slash".to_string(), to_value(false).unwrap());
|
|
||||||
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_remove_slashes_and_cachebust() {
|
|
||||||
let config = Config::default();
|
|
||||||
let static_fn = make_get_url(HashMap::new(), config);
|
|
||||||
let mut args = HashMap::new();
|
|
||||||
args.insert("path".to_string(), to_value("app.css").unwrap());
|
|
||||||
args.insert("trailing_slash".to_string(), to_value(false).unwrap());
|
|
||||||
args.insert("cachebust".to_string(), to_value(true).unwrap());
|
|
||||||
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css?t=1");
|
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css?t=1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_add_trailing_slashes() {
|
||||||
|
let config = Config::default();
|
||||||
|
let static_fn = make_get_url(HashMap::new(), config);
|
||||||
|
let mut args = HashMap::new();
|
||||||
|
args.insert("path".to_string(), to_value("app.css").unwrap());
|
||||||
|
args.insert("trailing_slash".to_string(), to_value(true).unwrap());
|
||||||
|
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css/");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_add_slashes_and_cachebust() {
|
||||||
|
let config = Config::default();
|
||||||
|
let static_fn = make_get_url(HashMap::new(), config);
|
||||||
|
let mut args = HashMap::new();
|
||||||
|
args.insert("path".to_string(), to_value("app.css").unwrap());
|
||||||
|
args.insert("trailing_slash".to_string(), to_value(true).unwrap());
|
||||||
|
args.insert("cachebust".to_string(), to_value(true).unwrap());
|
||||||
|
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css/?t=1");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_link_to_some_static_file() {
|
fn can_link_to_some_static_file() {
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let static_fn = make_get_url(HashMap::new(), config);
|
let static_fn = make_get_url(HashMap::new(), config);
|
||||||
let mut args = HashMap::new();
|
let mut args = HashMap::new();
|
||||||
args.insert("path".to_string(), to_value("app.css").unwrap());
|
args.insert("path".to_string(), to_value("app.css").unwrap());
|
||||||
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css/");
|
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue