commit
6eb8d34644
|
@ -1,5 +1,12 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.10.1 (2020-03-12)
|
||||||
|
|
||||||
|
- Set user agent for HTTP requests
|
||||||
|
- Add nyx-bold highlight theme
|
||||||
|
- Add lyric and subtitles highlighting
|
||||||
|
- Enable strikethrough in markdown filter
|
||||||
|
|
||||||
## 0.10.0 (2020-02-17)
|
## 0.10.0 (2020-02-17)
|
||||||
|
|
||||||
### Breaking
|
### Breaking
|
||||||
|
|
954
Cargo.lock
generated
954
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zola"
|
name = "zola"
|
||||||
version = "0.10.0"
|
version = "0.10.1"
|
||||||
authors = ["Vincent Prouillet <hello@vincentprouillet.com>"]
|
authors = ["Vincent Prouillet <hello@vincentprouillet.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -58,7 +58,10 @@ pub fn check_url(url: &str, config: &LinkChecker) -> LinkResult {
|
||||||
headers.insert(ACCEPT, "text/html".parse().unwrap());
|
headers.insert(ACCEPT, "text/html".parse().unwrap());
|
||||||
headers.append(ACCEPT, "*/*".parse().unwrap());
|
headers.append(ACCEPT, "*/*".parse().unwrap());
|
||||||
|
|
||||||
let client = Client::new();
|
let client = Client::builder()
|
||||||
|
.user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")))
|
||||||
|
.build()
|
||||||
|
.expect("reqwest client build");
|
||||||
|
|
||||||
let check_anchor = !config.skip_anchor_prefixes.iter().any(|prefix| url.starts_with(prefix));
|
let check_anchor = !config.skip_anchor_prefixes.iter().any(|prefix| url.starts_with(prefix));
|
||||||
|
|
||||||
|
@ -185,6 +188,22 @@ mod tests {
|
||||||
assert!(res.error.is_none());
|
assert!(res.error.is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn set_default_user_agent() {
|
||||||
|
let user_agent = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
||||||
|
let _m1 = mock("GET", "/C4Szbfnvj6M0LoPk")
|
||||||
|
.match_header("User-Agent", user_agent)
|
||||||
|
.with_status(200)
|
||||||
|
.with_body("Test")
|
||||||
|
.create();
|
||||||
|
|
||||||
|
let url = format!("{}{}", mockito::server_url(), "/C4Szbfnvj6M0LoPk");
|
||||||
|
let res = check_url(&url, &LinkChecker::default());
|
||||||
|
assert!(res.is_valid());
|
||||||
|
assert!(res.code.is_some());
|
||||||
|
assert!(res.error.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_fail_301_to_404_links() {
|
fn can_fail_301_to_404_links() {
|
||||||
let _m1 = mock("GET", "/cav9vibhsc")
|
let _m1 = mock("GET", "/cav9vibhsc")
|
||||||
|
|
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tera = "1"
|
tera = "1"
|
||||||
base64 = "0.11"
|
base64 = "0.12"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
pulldown-cmark = "0.7"
|
pulldown-cmark = "0.7"
|
||||||
toml = "0.5"
|
toml = "0.5"
|
||||||
|
|
|
@ -18,6 +18,7 @@ pub fn markdown<S: BuildHasher>(
|
||||||
let mut opts = cmark::Options::empty();
|
let mut opts = cmark::Options::empty();
|
||||||
opts.insert(cmark::Options::ENABLE_TABLES);
|
opts.insert(cmark::Options::ENABLE_TABLES);
|
||||||
opts.insert(cmark::Options::ENABLE_FOOTNOTES);
|
opts.insert(cmark::Options::ENABLE_FOOTNOTES);
|
||||||
|
opts.insert(cmark::Options::ENABLE_STRIKETHROUGH);
|
||||||
|
|
||||||
let mut html = String::new();
|
let mut html = String::new();
|
||||||
let parser = cmark::Parser::new_ext(&s, opts);
|
let parser = cmark::Parser::new_ext(&s, opts);
|
||||||
|
|
|
@ -178,7 +178,12 @@ pub struct LoadData {
|
||||||
}
|
}
|
||||||
impl LoadData {
|
impl LoadData {
|
||||||
pub fn new(base_path: PathBuf) -> Self {
|
pub fn new(base_path: PathBuf) -> Self {
|
||||||
let client = Arc::new(Mutex::new(Client::builder().build().expect("reqwest client build")));
|
let client = Arc::new(Mutex::new(
|
||||||
|
Client::builder()
|
||||||
|
.user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")))
|
||||||
|
.build()
|
||||||
|
.expect("reqwest client build"),
|
||||||
|
));
|
||||||
let result_cache = Arc::new(Mutex::new(HashMap::new()));
|
let result_cache = Arc::new(Mutex::new(HashMap::new()));
|
||||||
Self { base_path, client, result_cache }
|
Self { base_path, client, result_cache }
|
||||||
}
|
}
|
||||||
|
@ -443,6 +448,31 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn set_default_user_agent() {
|
||||||
|
let user_agent = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
||||||
|
let _m = mock("GET", "/chu8aizahBiy")
|
||||||
|
.match_header("User-Agent", user_agent)
|
||||||
|
.with_header("content-type", "application/json")
|
||||||
|
.with_body(
|
||||||
|
r#"{
|
||||||
|
"test": {
|
||||||
|
"foo": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.create();
|
||||||
|
|
||||||
|
let url = format!("{}{}", mockito::server_url(), "/chu8aizahBiy");
|
||||||
|
let static_fn = LoadData::new(PathBuf::new());
|
||||||
|
let mut args = HashMap::new();
|
||||||
|
args.insert("url".to_string(), to_value(&url).unwrap());
|
||||||
|
args.insert("format".to_string(), to_value("json").unwrap());
|
||||||
|
let result = static_fn.call(&args).unwrap();
|
||||||
|
assert_eq!(result.get("test").unwrap().get("foo").unwrap(), &to_value("bar").unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_load_toml() {
|
fn can_load_toml() {
|
||||||
let static_fn = LoadData::new(PathBuf::from("../utils/test-files"));
|
let static_fn = LoadData::new(PathBuf::from("../utils/test-files"));
|
||||||
|
|
|
@ -80,6 +80,7 @@ Here is a full list of supported languages and their short names:
|
||||||
- Lisp -> ["cl", "clisp", "el", "fasl", "l", "lisp", "lsp", "mud", "scm", "ss"]
|
- Lisp -> ["cl", "clisp", "el", "fasl", "l", "lisp", "lsp", "mud", "scm", "ss"]
|
||||||
- Literate Haskell -> ["lhs"]
|
- Literate Haskell -> ["lhs"]
|
||||||
- Lua -> ["lua"]
|
- Lua -> ["lua"]
|
||||||
|
- Lyric -> ["lyric", "lrc"]
|
||||||
- Makefile -> ["GNUmakefile", "Makefile", "Makefile.am", "Makefile.in", "OCamlMakefile", "mak", "make", "makefile", "makefile.am", "makefile.in", "mk"]
|
- Makefile -> ["GNUmakefile", "Makefile", "Makefile.am", "Makefile.in", "OCamlMakefile", "mak", "make", "makefile", "makefile.am", "makefile.in", "mk"]
|
||||||
- Markdown -> ["markdn", "markdown", "md", "mdown"]
|
- Markdown -> ["markdn", "markdown", "md", "mdown"]
|
||||||
- MATLAB -> ["matlab"]
|
- MATLAB -> ["matlab"]
|
||||||
|
@ -110,6 +111,7 @@ Here is a full list of supported languages and their short names:
|
||||||
- Scala -> ["sbt", "scala"]
|
- Scala -> ["sbt", "scala"]
|
||||||
- SQL -> ["ddl", "dml", "sql"]
|
- SQL -> ["ddl", "dml", "sql"]
|
||||||
- SQL (Rails) -> ["erbsql", "sql.erb"]
|
- SQL (Rails) -> ["erbsql", "sql.erb"]
|
||||||
|
- Subtitle -> ["srt", "subrip"]
|
||||||
- SWI-Prolog -> ["pro"]
|
- SWI-Prolog -> ["pro"]
|
||||||
- Swift -> ["swift"]
|
- Swift -> ["swift"]
|
||||||
- Tcl -> ["tcl"]
|
- Tcl -> ["tcl"]
|
||||||
|
|
|
@ -132,6 +132,9 @@ Zola currently has the following highlight themes available:
|
||||||
- [agola-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Agola%20Dark)
|
- [agola-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Agola%20Dark)
|
||||||
- [ascetic-white](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Ascetic%20White)
|
- [ascetic-white](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Ascetic%20White)
|
||||||
- [axar](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Axar)
|
- [axar](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Axar)
|
||||||
|
- [ayu-dark](https://github.com/dempfi/ayu)
|
||||||
|
- [ayu-light](https://github.com/dempfi/ayu)
|
||||||
|
- [ayu-mirage](https://github.com/dempfi/ayu)
|
||||||
- [base16-ocean-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Base16%20Ocean%20Dark)
|
- [base16-ocean-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Base16%20Ocean%20Dark)
|
||||||
- [base16-ocean-light](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Base16%20Ocean%20Light)
|
- [base16-ocean-light](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Base16%20Ocean%20Light)
|
||||||
- [bbedit](https://tmtheme-editor.herokuapp.com/#!/editor/theme/BBEdit)
|
- [bbedit](https://tmtheme-editor.herokuapp.com/#!/editor/theme/BBEdit)
|
||||||
|
@ -152,16 +155,14 @@ Zola currently has the following highlight themes available:
|
||||||
- [material-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Material%20Dark)
|
- [material-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Material%20Dark)
|
||||||
- [material-light](https://github.com/morhetz/gruvbox)
|
- [material-light](https://github.com/morhetz/gruvbox)
|
||||||
- [monokai](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Monokai)
|
- [monokai](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Monokai)
|
||||||
|
- [nyx-bold](https://github.com/GalAster/vscode-theme-nyx)
|
||||||
|
- [one-dark](https://github.com/andresmichel/one-dark-theme)
|
||||||
- [solarized-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Solarized%20(dark))
|
- [solarized-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Solarized%20(dark))
|
||||||
- [solarized-light](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Solarized%20(light))
|
- [solarized-light](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Solarized%20(light))
|
||||||
- [subway-madrid](https://github.com/idleberg/Subway.tmTheme)
|
- [subway-madrid](https://github.com/idleberg/Subway.tmTheme)
|
||||||
- [subway-moscow](https://github.com/idleberg/Subway.tmTheme)
|
- [subway-moscow](https://github.com/idleberg/Subway.tmTheme)
|
||||||
- [visual-studio-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Visual%20Studio%20Dark)
|
|
||||||
- [ayu-light](https://github.com/dempfi/ayu)
|
|
||||||
- [ayu-dark](https://github.com/dempfi/ayu)
|
|
||||||
- [ayu-mirage](https://github.com/dempfi/ayu)
|
|
||||||
- [Tomorrow](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Tomorrow)
|
- [Tomorrow](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Tomorrow)
|
||||||
- [one-dark](https://github.com/andresmichel/one-dark-theme)
|
- [visual-studio-dark](https://tmtheme-editor.herokuapp.com/#!/editor/theme/Visual%20Studio%20Dark)
|
||||||
- [zenburn](https://github.com/colinta/zenburn)
|
- [zenburn](https://github.com/colinta/zenburn)
|
||||||
|
|
||||||
Zola uses the Sublime Text themes, making it very easy to add more.
|
Zola uses the Sublime Text themes, making it very easy to add more.
|
||||||
|
@ -181,4 +182,4 @@ is space being replaced by `_` since a space is not valid in an anchor.
|
||||||
|
|
||||||
Note that if you are using a strategy other than the default, you will have to manually escape whitespace and Markdown
|
Note that if you are using a strategy other than the default, you will have to manually escape whitespace and Markdown
|
||||||
tokens to be able to link to your pages. For example an internal link to a file named `some space.md` will need to be
|
tokens to be able to link to your pages. For example an internal link to a file named `some space.md` will need to be
|
||||||
written like `some%20space.md` in your Markdown files.
|
written like `some%20space.md` in your Markdown files.
|
||||||
|
|
27
sublime_syntaxes/lrc.sublime-syntax
Normal file
27
sublime_syntaxes/lrc.sublime-syntax
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
scope: source.lyric
|
||||||
|
file_extensions:
|
||||||
|
- lrc
|
||||||
|
- lyric
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: '\[([0-5][0-9]:[0-5][0-9]\.[0-9][0-9])\]'
|
||||||
|
captures:
|
||||||
|
1: constant.other.time.lyric
|
||||||
|
push:
|
||||||
|
- match: '(.*)[\n\r]+'
|
||||||
|
captures:
|
||||||
|
1: string.literal.lyric
|
||||||
|
pop: true
|
||||||
|
- match: '(\[)([a-zA-Z].*)(:)(.*)(\])'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.meta.lyric
|
||||||
|
2: entity.name.function.lyric
|
||||||
|
3: punctuation.definition.split.lyric
|
||||||
|
4: meta.object-literal.key.lyric
|
||||||
|
5: punctuation.definition.meta.lyric
|
||||||
|
- match: (.*)
|
||||||
|
captures:
|
||||||
|
1: invalid.illegal.lyric
|
35
sublime_syntaxes/srt.sublime-syntax
Normal file
35
sublime_syntaxes/srt.sublime-syntax
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
scope: source.subrip
|
||||||
|
file_extensions:
|
||||||
|
- srt
|
||||||
|
- subrip
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: "^([1-9][0-9]*)$"
|
||||||
|
scope: variable.other.readwrite.subrip
|
||||||
|
- match: '^(\d{2}:[0-5][0-9]:[0-5][0-9],\d{3}) (-->) (\d{2}:[0-5][0-9]:[0-5][0-9],\d{3})$'
|
||||||
|
captures:
|
||||||
|
1: constant.other.time.subrip
|
||||||
|
2: keyword.operator.assignment.subrip
|
||||||
|
3: constant.other.time.subrip
|
||||||
|
- match: .+
|
||||||
|
push:
|
||||||
|
- meta_scope: string.literal.subrip
|
||||||
|
- match: (\n\r|\n)
|
||||||
|
pop: true
|
||||||
|
- match: (\</?)((?i:b|i|u|font)\b)
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.tag.begin.html
|
||||||
|
2: entity.name.tag.inline.any.html
|
||||||
|
push:
|
||||||
|
- match: '((?: ?/)?\>)'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.tag.end.html
|
||||||
|
pop: true
|
||||||
|
- match: (<b>)(.*)(<\/b>)
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.tag.begin.html
|
||||||
|
2: entity.name.tag.inline.any.html
|
||||||
|
3: punctuation.definition.tag.end.html
|
2201
sublime_themes/nyx-bold.tmTheme
Normal file
2201
sublime_themes/nyx-bold.tmTheme
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue