diff --git a/.gitmodules b/.gitmodules index e7ce67bb..9f291304 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,9 +7,6 @@ [submodule "sublime_syntaxes/LESS-sublime"] path = sublime_syntaxes/LESS-sublime url = https://github.com/danro/LESS-sublime.git -[submodule "sublime_syntaxes/TypeScript-Sublime-Plugin"] - path = sublime_syntaxes/TypeScript-Sublime-Plugin - url = https://github.com/Microsoft/TypeScript-Sublime-Plugin.git [submodule "sublime_syntaxes/Handlebars"] path = sublime_syntaxes/Handlebars url = https://github.com/daaain/Handlebars.git @@ -31,3 +28,6 @@ [submodule "sublime_syntaxes/Sublime-VimL"] path = sublime_syntaxes/Sublime-VimL url = https://github.com/SalGnt/Sublime-VimL.git +[submodule "sublime_syntaxes/TypeScript-TmLanguage"] + path = sublime_syntaxes/TypeScript-TmLanguage + url = https://github.com/Microsoft/TypeScript-TmLanguage diff --git a/.travis.yml b/.travis.yml index 6c576787..6b61378e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ dist: trusty language: rust services: docker -sudo: required env: global: @@ -20,6 +19,9 @@ matrix: rust: beta - env: TARGET=x86_64-unknown-linux-gnu rust: nightly + # The earliest stable Rust version that works + - env: TARGET=x86_64-unknown-linux-gnu + rust: 1.23.0 before_install: set -e diff --git a/CHANGELOG.md b/CHANGELOG.md index 493f23d6..a05cc3d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 0.3.0 (2017-01-25) + +### Breaking +- Change names of individual taxonomies to be plural (ie `tags/my-tag` instead of `tag/my-tag`) +- Front matter now uses TOML dates rather strings: remove quotes from your date value to fix it. +For example: `date = "2001-10-10"` becomes `date = 2001-10-10` +- `language_code` has been renamed `default_language` in preparations of i18n support + +### Others +- Add `get_taxonomy_url` to retrieve the permalink of a tag/category +- Fix bug when generating permalinks for taxonomies +- Update to Tera 0.11 +- Better UX on first `serve` thanks to some default templates. +- Add `output-dir` to `build` and `serve` to generate the site in a folder other than `public` +- Add Prolog syntax highlighting and update all current syntaxes +- Live reloading now works on shortcode template changes +- `gutenberg serve` now reloads site on `config.toml` changes: you will need to F5 to see any changes though +- Add a `trans` global function that will get return the translation of the given key for the given lang, defaulting +to `config.default_language` if not given +- `gutenberg serve` cleans after itself and deletes the output directory on CTRL+C + ## 0.2.2 (2017-11-01) - Fix shortcodes without arguments being ignored diff --git a/Cargo.lock b/Cargo.lock index c51c858c..1e9e4423 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,39 +1,36 @@ [[package]] name = "aho-corasick" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ansi_term" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "atty" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -41,8 +38,8 @@ name = "backtrace-sys" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -50,27 +47,35 @@ name = "base64" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "base64" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bincode" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -95,7 +100,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -105,16 +110,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bytes" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -127,18 +132,18 @@ name = "chrono" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clap" -version = "2.27.1" +version = "2.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -147,10 +152,10 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.27" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -158,18 +163,10 @@ name = "coco" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "either 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "conduit-mime-types" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "config" version = "0.1.0" @@ -177,8 +174,8 @@ dependencies = [ "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "errors 0.1.0", "highlighting 0.1.0", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -189,22 +186,24 @@ dependencies = [ "config 0.1.0", "errors 0.1.0", "front_matter 0.1.0", - "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rendering 0.1.0", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] [[package]] -name = "dbghelp-sys" -version = "0.2.0" +name = "ctrlc" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -213,52 +212,54 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "either" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "error" -version = "0.1.9" +name = "duct" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "os_pipe 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "shared_child 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "either" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "error-chain" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "errors" version = "0.1.0" dependencies = [ - "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "filetime" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "flate2" -version = "0.2.20" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -273,11 +274,11 @@ version = "0.1.0" dependencies = [ "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "errors 0.1.0", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -288,7 +289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -296,24 +297,22 @@ name = "fsevent-sys" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fuchsia-zircon" -version = "0.2.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fuchsia-zircon-sys" -version = "0.2.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "gcc" @@ -322,7 +321,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "getopts" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -332,18 +331,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "gutenberg" -version = "0.2.2" +version = "0.3.0" dependencies = [ "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.2 (registry+https://github.com/rust-lang/crates.io-index)", "content 0.1.0", + "ctrlc 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "errors 0.1.0", "front_matter 0.1.0", - "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mount 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "notify 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "notify 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "site 0.1.0", - "staticfile 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "staticfile 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "term-painter 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -355,18 +355,18 @@ dependencies = [ name = "highlighting" version = "0.1.0" dependencies = [ - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syntect 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntect 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "httparse" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "humansize" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -375,12 +375,12 @@ version = "0.10.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -402,7 +402,7 @@ name = "inotify" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -410,22 +410,20 @@ name = "iovec" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "iron" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "conduit-mime-types 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "mime_guess 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -452,7 +450,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "0.2.10" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -460,15 +463,36 @@ name = "lazycell" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lazycell" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" -version = "0.2.33" +version = "0.2.36" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "linked-hash-map" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "matches" @@ -477,10 +501,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memchr" -version = "1.0.2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -488,7 +512,18 @@ name = "mime" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mime_guess" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -496,8 +531,8 @@ name = "miniz-sys" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -506,28 +541,28 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mio" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -563,11 +598,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "mount" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sequence_trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sequence_trie 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -577,7 +612,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -588,34 +623,45 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "notify" -version = "4.0.2" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "inotify 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -623,7 +669,7 @@ name = "num-integer" version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -632,43 +678,54 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.1.40" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num_cpus" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "onig" -version = "1.6.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "onig_sys 65.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "onig_sys 67.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "onig_sys" -version = "65.0.1" +version = "67.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cmake 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "duct 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "os_pipe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "pagination" version = "0.1.0" @@ -677,9 +734,9 @@ dependencies = [ "content 0.1.0", "errors 0.1.0", "front_matter 0.1.0", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] @@ -690,9 +747,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pest" -version = "0.4.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "pest_derive" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pest 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_codegen" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_generator" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_shared" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "pkg-config" version = "0.3.9" @@ -700,14 +802,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "plist" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "xml-rs 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -724,7 +826,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -734,18 +836,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rand" -version = "0.3.18" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon" -version = "0.8.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -755,15 +858,15 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" -version = "0.1.31" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -771,24 +874,24 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -798,15 +901,15 @@ dependencies = [ "errors 0.1.0", "front_matter 0.1.0", "highlighting 0.1.0", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syntect 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syntect 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "templates 0.1.0", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] @@ -815,11 +918,6 @@ name = "rustc-demangle" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "safemem" version = "0.2.0" @@ -827,38 +925,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "same-file" -version = "0.1.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "same-file" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sass-rs" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "sass-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "sass-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sass-sys" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -869,27 +957,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sequence_trie" -version = "0.2.1" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.20" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.20" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive_internals 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive_internals" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -898,13 +986,13 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -912,6 +1000,21 @@ name = "sha1" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "shared_child" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "siphasher" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "site" version = "0.1.0" @@ -922,14 +1025,14 @@ dependencies = [ "front_matter 0.1.0", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "pagination 0.1.0", - "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sass-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sass-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "taxonomies 0.1.0", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "templates 0.1.0", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", "walkdir 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -954,12 +1057,12 @@ dependencies = [ [[package]] name = "staticfile" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mount 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -988,22 +1091,22 @@ dependencies = [ [[package]] name = "syntect" -version = "1.8.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "onig 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "plist 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "onig 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plist 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1014,10 +1117,10 @@ dependencies = [ "content 0.1.0", "errors 0.1.0", "front_matter 0.1.0", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] @@ -1026,37 +1129,39 @@ name = "tempdir" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "templates" version = "0.1.0" dependencies = [ - "base64 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.1.0", "content 0.1.0", "errors 0.1.0", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "taxonomies 0.1.0", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] [[package]] name = "tera" -version = "0.10.10" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "humansize 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "pest 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pest 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pest_derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1083,8 +1188,8 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1098,22 +1203,21 @@ dependencies = [ [[package]] name = "thread_local" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.38" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1121,7 +1225,7 @@ name = "toml" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1215,7 +1319,7 @@ version = "0.1.0" dependencies = [ "errors 0.1.0", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1233,31 +1337,12 @@ name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "walkdir" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "walkdir" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "walkdir" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "same-file 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1265,22 +1350,41 @@ name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ws" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1297,133 +1401,148 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "yaml-rust" -version = "0.3.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [metadata] -"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" -"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" -"checksum atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21e50800ec991574876040fff8ee46b136a53e985286fbe6a3bdfe6421b78860" -"checksum backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99f2ce94e22b8e664d95c57fff45b98a966c2252b60691d0b7aeeccd88d70983" +"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" +"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455" +"checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859" +"checksum backtrace 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbbf59b1c43eefa8c3ede390fcc36820b4999f7914104015be25025e0d62af2" "checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661" "checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" -"checksum base64 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5032d51da2741729bfdaeb2664d9b8c6d9fd1e2b90715c660b6def36628499c2" -"checksum bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e" +"checksum base64 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c4a342b450b268e1be8036311e2c613d7f8a7ed31214dff1cc3b60852a3168d" +"checksum base64 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "229d032f1a99302697f10b27167ae6d03d49d032e6a8e2550e8d3fc13356d2b4" +"checksum bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9a6301db0b49fb63551bc15b5ae348147101cdf323242b93ec7546d5002ff1af" "checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" -"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" +"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" "checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" -"checksum bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d828f97b58cc5de3e40c421d0cf2132d6b2da4ee0e11b8632fa838f0f9333ad6" -"checksum cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b13a57efd6b30ecd6598ebdb302cca617930b5470647570468a65d12ef9719" +"checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9" +"checksum cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9" -"checksum clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b8c532887f1a292d17de05ae858a8fe50a301e196f9ef0ddb7ccd0d1d00f180" -"checksum cmake 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)" = "9b0ec063cbc2034e27f7166d04aa7aa1b9ed85b6c7c2414fb68aff20d1ebf604" +"checksum clap 2.29.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4151c5790817c7d21bbdc6c3530811f798172915f93258244948b93ba19604a6" +"checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb" "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" -"checksum conduit-mime-types 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "95ca30253581af809925ef68c2641cc140d6183f43e12e0af4992d53768bd7b8" -"checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" +"checksum ctrlc 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "653abc99aa905f693d89df4797fadc08085baee379db92be9f2496cefe8a6f2c" "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" -"checksum either 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e311a7479512fbdf858fb54d91ec59f3b9f85bc0113659f46bba12b199d273ce" -"checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc" -"checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" -"checksum filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "aa75ec8f7927063335a9583e7fa87b0110bb888cf766dc01b54c0ff70d760c8e" -"checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423" +"checksum duct 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8c553d79f40e74f7f611e49bf3429b6760cff79596b61818291c27cc0b18549d" +"checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3" +"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" +"checksum filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "714653f3e34871534de23771ac7b26e999651a0a228f47beb324dfdf1dd4b10f" +"checksum flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "c4bbbf71584aeed076100b5665ac14e3d85eeb31fdbb45fbd41ef9a682b5ec05" "checksum fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a772d36c338d07a032d5375a36f15f9a7043bf0cb8ce7cee658e037c6032874" -"checksum fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c0581a4e363262e52b87f59ee2afe3415361c6ec35e665924eb08afe8ff159" -"checksum fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43f3795b4bae048dc6123a6b972cadde2e676f9ded08aef6bb77f5f157684a82" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" -"checksum getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "65922871abd2f101a2eb0eaebadc66668e54a87ad9c3dd82520b5f86ede5eff9" +"checksum getopts 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "53adb5b6e45d9dc2179219b30571a848b5681faea989f43e4fb5a2e4cda29f7f" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07" -"checksum humansize 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "92d211e6e70b05749dce515b47684f29a3c8c38bbbb21c50b30aff9eca1b0bd3" +"checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37" +"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e" "checksum hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)" = "368cb56b2740ebf4230520e2b90ebb0461e69034d85d1945febd9b3971426db2" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum inotify 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887fcc180136e77a85e6a6128579a719027b1bab9b1c38ea4444244fe262c20c" "checksum iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6e8b9c2247fcf6c6a1151f1156932be5606c9fd6f55a2d7f9fc1cb29386b2f7" -"checksum iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2440ae846e7a8c7f9b401db8f6e31b4ea5e7d3688b91761337da7e054520c75b" +"checksum iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8e17268922834707e1c29e8badbf9c712c9c43378e1b6a3388946baff10be2" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lazy_static 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "236eb37a62591d4a41a89b7763d7de3e06ca02d5ab2815446a8bae5d2f8c2d57" +"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" +"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" "checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b" -"checksum libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba3df4dcb460b9dfbd070d41c94c19209620c191b0340b929ce748a2bcd42d2" -"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" +"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" +"checksum libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "1e5d97d6708edaa407429faa671b942dc0f2727222fb6b6539bf1db936e4b121" +"checksum linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2aab0478615bb586559b0114d94dd8eca4fdbb73b443adcb0d00b61692b4bf" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" +"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" +"checksum mime_guess 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dc7e82a15629bb4ecd9e72365bf33d1382be91e030f820edb8e2a21c02430da8" "checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" "checksum mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a637d1ca14eacae06296a008fa7ad955347e34efcb5891cfd8ba05491a37907e" -"checksum mio 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0e8411968194c7b139e9105bc4ae7db0bae232af087147e72f0616ebf5fdb9cb" +"checksum mio 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "75f72a93f046f1517e3cfddc0a096eb756a2ba727d36edc8227dee769a50a9b0" "checksum miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3e690c5df6b2f60acd45d56378981e827ff8295562fc8d34f573deb267a59cd1" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" -"checksum mount 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32245731923cd096899502fc4c4317cfd09f121e80e73f7f576cf3777a824256" +"checksum mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e25c06012941aaf8c75f2eaf7ec5c48cf69f9fc489ab3eb3589edc107e386f0b" "checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09" "checksum nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfb3ddedaa14746434a02041940495bf11325c22f6d36125d3bdd56090d50a79" -"checksum notify 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "745bdfd0d0764c71525e880c6d7662b721cb5658ddb2feaa71c3193ec359aef8" -"checksum num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "a311b77ebdc5dd4cf6449d81e4135d9f0e3b153839ac90e648a8ef538f923525" +"checksum nix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2c5afeb0198ec7be8569d666644b574345aad2e95a53baf3a532da3e0f3fb32" +"checksum notify 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5c3812da3098f210a0bb440f9c008471a031aa4c1de07a264fdd75456c95a4eb" +"checksum num 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4083e14b542ea3eb9b5f33ff48bd373a92d78687e74f4cc0a30caeb754f0ca" "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba" "checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01" -"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" -"checksum num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d" -"checksum onig 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1271a3f93197303deda8aedcd96ed2dbb908f61c0954ae70bf7a42f536dc35d7" -"checksum onig_sys 65.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fbdee58fb75f5b7749ebc8f601f570961eed595dfe4c2bb9a542e2f7ae20b946" +"checksum num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "9936036cc70fe4a8b2d338ab665900323290efb03983c86cbe235ae800ad8017" +"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum onig 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1db8e49613c25f97a62330de07fdafe23c27a242bb68738b4dadf6df767d93f6" +"checksum onig_sys 67.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e49311d8357c2173fe429cd6a592a2578ec69d59c7508efb4516634ada85bbb8" +"checksum os_pipe 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f547689aea1f11fac90333d573854a8e3e52a9160df1c42aefa8cd16734a3c0" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" -"checksum pest 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2e823a5967bb4cdc6d3e46f47baaf4ecfeae44413a642b74ad44e59e49c7f6" +"checksum pest 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f3db16272e194d43f5cf2be1a4fa9866b3582821f410a00c094951d6b97ff6eb" +"checksum pest_derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e2abeb78379aa216ce65ae83f16c44e3fee1d8c417dadddc8fae972baba9429" +"checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc" +"checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f" +"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03" +"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" -"checksum plist 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "142aa1116debeb8ebeae592cf956d53165ffb0ec4c41f894208cff78a9e3ffe2" +"checksum plist 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c61ac2afed2856590ae79d6f358a24b85ece246d2aa134741a66d589519b7503" "checksum plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" "checksum pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a656fdb8b6848f896df5e478a0eb9083681663e37dcb77dd16981ff65329fe8b" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6475140dfd8655aeb72e1fd4b7a1cc1c202be65d71669476e392fe62532b9edd" -"checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" +"checksum rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "512870020642bb8c221bf68baa1b2573da814f6ccfe5c9699b1c303047abe9b1" +"checksum rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed02d09394c94ffbdfdc755ad62a132e94c3224a8354e78a1200ced34df12edf" "checksum rayon-core 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e64b609139d83da75902f88fd6c01820046840a18471e4dfcd5ac7c0f46bea53" -"checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509" +"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" -"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" +"checksum regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "744554e01ccbd98fff8c457c3b092cd67af62a555a43bfe97ae8a0451f7799fa" +"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" "checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" -"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7" -"checksum same-file 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70a18720d745fb9ca6a041b37cb36d0b21066006b6cff8b5b360142d4b81fb60" -"checksum sass-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "22498eeceeef42b0bfbf44c27bf49bc37043beddc7eac73ae9f4d17e08967e2e" -"checksum sass-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e0fff442cd16b0a680a055a5a2d5e858421f5ec5bf37dcfb136e0ed9a19bf0a4" +"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" +"checksum sass-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90f8cf6e645aa843ffffcbdc1e8752b1f221dfa314c81895aeb229a77aea7e05" +"checksum sass-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8bc8cb11c6906ced0e62751f93fa1f30216612a182d4e9a7d8ace302834b1742" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum sequence_trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c915714ca833b1d4d6b8f6a9d72a3ff632fe45b40a8d184ef79c81bec6327eed" -"checksum serde 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "5a2b181dd2b4a6353e828e44807269a761d3ecbc388a1f5ed3998ea69a516d9c" -"checksum serde_derive 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "31ce3c16ec18abb97d977f75880986549213b0c18f2695eda8b31eadc96eda4a" -"checksum serde_derive_internals 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32f1926285523b2db55df263d2aa4eb69ddcfa7a7eade6430323637866b513ab" -"checksum serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e4586746d1974a030c48919731ecffd0ed28d0c40749d0d18d43b3a7d6c9b20e" +"checksum sequence_trie 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "32157204e5c9d3c04007bd7e56e96e987635ce0e8e23c085b1e403861b76c351" +"checksum serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "db99f3919e20faa51bb2996057f5031d8685019b5a06139b1ce761da671b8526" +"checksum serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0" +"checksum serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5" +"checksum serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9db7266c7d63a4c4b7fe8719656ccdd51acf1bed6124b174f933b009fb10bcb" "checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" +"checksum shared_child 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bcd5e483b3475af9bc2a35311c2f3bbf0bd98fde91410ab15a0d4ba3c3127b4e" +"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" "checksum slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d807fd58c4181bbabed77cb3b891ba9748241a552bcc5be698faaebefc54f46e" "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" "checksum slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f5ff4b43cb07b86c5f9236c92714a22cdf9e5a27a7d85e398e2c9403328cb8" -"checksum staticfile 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31493480e073d52522a94cdf56269dd8eb05f99549effd1826b0271690608878" +"checksum staticfile 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "babd3fa68bb7e3994ce181c5f21ff3ff5fffef7b18b8a10163b45e4dafc6fb86" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum syntect 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ff5898205c88327ab1c99dfd25337e9f29e547e0596a5b098a6780a43801e3c5" +"checksum syntect 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db9fffcb25a761118df53811bd1cfcd54cf57fcbc51e1ea3167ae263477129ad" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" -"checksum tera 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d706c3bec8103f346fc7b8a3887a2ff4195cf704bdbc6307069f32ea8a2b3af5" +"checksum tera 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "252b2c4afceb919fe37dc9d7c3afd69accdc211613a3f3d54085c12f008a0b31" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum term-painter 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "dcaa948f0e3e38470cd8dc8dcfe561a75c9e43f28075bb183845be2b9b3c08cf" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" -"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" -"checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520" +"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963" +"checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098" "checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" @@ -1441,12 +1560,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c" "checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780" -"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" "checksum walkdir 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b6d201f4f8998a837196b6de9c73e35af14c992cbb92c4ab641d2c2dce52de" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum ws 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "89c48c53bf9dee34411a08993c10b879c36e105d609b46e25673befe3a5c1320" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -"checksum xml-rs 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1945e12e16b951721d7976520b0832496ef79c31602c7a29d950de79ba74621" -"checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" +"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" +"checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628" diff --git a/Cargo.toml b/Cargo.toml index 51c6931e..899f573b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "gutenberg" -version = "0.2.2" -authors = ["Vincent Prouillet "] +version = "0.3.0" +authors = ["Vincent Prouillet "] license = "MIT" readme = "README.md" -description = "Static site generator" +description = "A static site generator with everything built-in" homepage = "https://github.com/Keats/gutenberg" repository = "https://github.com/Keats/gutenberg" keywords = ["static", "site", "generator", "blog"] @@ -24,11 +24,12 @@ term-painter = "0.2" # Used in init to ensure the url given as base_url is a valid one url = "1.5" # Below is for the serve cmd -staticfile = "0.4" -iron = "0.5" -mount = "0.3" +staticfile = "0.5" +iron = "0.6" +mount = "0.4" notify = "4" ws = "0.7" +ctrlc = "3" site = { path = "components/site" } errors = { path = "components/errors" } diff --git a/build.rs b/build.rs index bc9dc8f5..5e9624fd 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,7 @@ #[macro_use] extern crate clap; -use clap::Shell; +// use clap::Shell; include!("src/cli.rs"); diff --git a/completions/_gutenberg b/completions/_gutenberg index a4977e30..99c99097 100644 --- a/completions/_gutenberg +++ b/completions/_gutenberg @@ -32,6 +32,8 @@ _arguments -s -S -C \ _arguments -s -S -C \ '-u+[Force the base URL to be that value (default to the one in config.toml)]' \ '--base-url+[Force the base URL to be that value (default to the one in config.toml)]' \ +'-o+[Outputs the generated site in the given path]' \ +'--output-dir+[Outputs the generated site in the given path]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ @@ -44,6 +46,8 @@ _arguments -s -S -C \ '--interface+[Interface to bind on]' \ '-p+[Which port to use]' \ '--port+[Which port to use]' \ +'-o+[Outputs the generated site in the given path]' \ +'--output-dir+[Outputs the generated site in the given path]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ diff --git a/completions/_gutenberg.ps1 b/completions/_gutenberg.ps1 index 1bb1bdae..49159b83 100644 --- a/completions/_gutenberg.ps1 +++ b/completions/_gutenberg.ps1 @@ -53,11 +53,11 @@ } '_gutenberg_build' { - $completions = @('-h', '-V', '-u', '--help', '--version', '--base-url') + $completions = @('-h', '-V', '-u', '-o', '--help', '--version', '--base-url', '--output-dir') } '_gutenberg_serve' { - $completions = @('-h', '-V', '-i', '-p', '--help', '--version', '--interface', '--port') + $completions = @('-h', '-V', '-i', '-p', '-o', '--help', '--version', '--interface', '--port', '--output-dir') } '_gutenberg_help' { diff --git a/completions/gutenberg.bash b/completions/gutenberg.bash new file mode 100644 index 00000000..3fed15c6 --- /dev/null +++ b/completions/gutenberg.bash @@ -0,0 +1,153 @@ +_gutenberg() { + local i cur prev opts cmds + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + cmd="" + opts="" + + for i in ${COMP_WORDS[@]} + do + case "${i}" in + gutenberg) + cmd="gutenberg" + ;; + + build) + cmd+="__build" + ;; + help) + cmd+="__help" + ;; + init) + cmd+="__init" + ;; + serve) + cmd+="__serve" + ;; + *) + ;; + esac + done + + case "${cmd}" in + gutenberg) + opts=" -c -h -V --config --help --version init build serve help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + case "${prev}" in + + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + gutenberg__build) + opts=" -h -V -u -o --help --version --base-url --output-dir " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + case "${prev}" in + + --base-url) + COMPREPLY=("") + return 0 + ;; + -u) + COMPREPLY=("") + return 0 + ;; + --output-dir) + COMPREPLY=("") + return 0 + ;; + -o) + COMPREPLY=("") + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + gutenberg__help) + opts=" -h -V --help --version " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + case "${prev}" in + + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + gutenberg__init) + opts=" -h -V --help --version " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + case "${prev}" in + + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + gutenberg__serve) + opts=" -h -V -i -p -o --help --version --interface --port --output-dir " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + case "${prev}" in + + --interface) + COMPREPLY=("") + return 0 + ;; + -i) + COMPREPLY=("") + return 0 + ;; + --port) + COMPREPLY=("") + return 0 + ;; + -p) + COMPREPLY=("") + return 0 + ;; + --output-dir) + COMPREPLY=("") + return 0 + ;; + -o) + COMPREPLY=("") + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + esac +} + +complete -F _gutenberg -o bashdefault -o default gutenberg diff --git a/completions/gutenberg.fish b/completions/gutenberg.fish index ce23d5d3..f7befb22 100644 --- a/completions/gutenberg.fish +++ b/completions/gutenberg.fish @@ -21,10 +21,12 @@ complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "help" -d 'Print complete -c gutenberg -n "__fish_using_command gutenberg init" -s h -l help -d 'Prints help information' complete -c gutenberg -n "__fish_using_command gutenberg init" -s V -l version -d 'Prints version information' complete -c gutenberg -n "__fish_using_command gutenberg build" -s u -l base-url -d 'Force the base URL to be that value (default to the one in config.toml)' +complete -c gutenberg -n "__fish_using_command gutenberg build" -s o -l output-dir -d 'Outputs the generated site in the given path' complete -c gutenberg -n "__fish_using_command gutenberg build" -s h -l help -d 'Prints help information' complete -c gutenberg -n "__fish_using_command gutenberg build" -s V -l version -d 'Prints version information' complete -c gutenberg -n "__fish_using_command gutenberg serve" -s i -l interface -d 'Interface to bind on' complete -c gutenberg -n "__fish_using_command gutenberg serve" -s p -l port -d 'Which port to use' +complete -c gutenberg -n "__fish_using_command gutenberg serve" -s o -l output-dir -d 'Outputs the generated site in the given path' complete -c gutenberg -n "__fish_using_command gutenberg serve" -s h -l help -d 'Prints help information' complete -c gutenberg -n "__fish_using_command gutenberg serve" -s V -l version -d 'Prints version information' complete -c gutenberg -n "__fish_using_command gutenberg help" -s h -l help -d 'Prints help information' diff --git a/components/config/src/lib.rs b/components/config/src/lib.rs index 528a5f9c..f1a07624 100644 --- a/components/config/src/lib.rs +++ b/components/config/src/lib.rs @@ -38,7 +38,7 @@ pub struct Config { /// Description of the site pub description: Option, /// The language used in the site. Defaults to "en" - pub language_code: Option, + pub default_language: Option, /// Whether to generate RSS. Defaults to false pub generate_rss: Option, /// The number of articles to include in the RSS feed. Defaults to unlimited @@ -50,6 +50,9 @@ pub struct Config { /// Whether to compile the `sass` directory and output the css files into the static folder pub compile_sass: Option, + /// Languages list and translated strings + pub translations: Option>, + /// All user params set in [extra] in the config pub extra: Option>, @@ -74,13 +77,14 @@ impl Config { Err(e) => bail!(e) }; - set_default!(config.language_code, "en".to_string()); + set_default!(config.default_language, "en".to_string()); set_default!(config.highlight_code, false); set_default!(config.generate_rss, false); set_default!(config.rss_limit, 20); set_default!(config.generate_tags_pages, false); set_default!(config.generate_categories_pages, false); set_default!(config.compile_sass, false); + set_default!(config.translations, HashMap::new()); set_default!(config.extra, HashMap::new()); match config.highlight_theme { @@ -120,6 +124,8 @@ impl Config { format!("{}{}{}", self.base_url, &path[1..], trailing_bit) } else if self.base_url.ends_with('/') { format!("{}{}{}", self.base_url, path, trailing_bit) + } else if path.starts_with('/') { + format!("{}{}{}", self.base_url, path, trailing_bit) } else { format!("{}/{}{}", self.base_url, path, trailing_bit) } @@ -164,12 +170,13 @@ impl Default for Config { highlight_code: Some(true), highlight_theme: Some("base16-ocean-dark".to_string()), description: None, - language_code: Some("en".to_string()), + default_language: Some("en".to_string()), generate_rss: Some(false), rss_limit: Some(10_000), generate_tags_pages: Some(true), generate_categories_pages: Some(true), compile_sass: Some(false), + translations: None, extra: None, build_timestamp: Some(1), } @@ -272,6 +279,13 @@ hello = "world" assert_eq!(config.make_permalink("/hello"), "http://vincent.is/hello/"); } + #[test] + fn can_make_url_with_localhost() { + let mut config = Config::default(); + config.base_url = "http://127.0.0.1:1111".to_string(); + assert_eq!(config.make_permalink("/tags/rust"), "http://127.0.0.1:1111/tags/rust/"); + } + #[test] fn can_merge_with_theme_data_and_preserve_config_value() { let config_str = r#" @@ -293,4 +307,27 @@ a_value = 10 assert_eq!(extra["hello"].as_str().unwrap(), "world".to_string()); assert_eq!(extra["a_value"].as_integer().unwrap(), 10); } + + #[test] + fn can_use_language_configuration() { + let config = r#" +base_url = "https://remplace-par-ton-url.fr" +default_language = "fr" + +[translations] +[translations.fr] +title = "Un titre" + +[translations.en] +title = "A title" + + "#; + + let config = Config::parse(config); + assert!(config.is_ok()); + let translations = config.unwrap().translations.unwrap(); + assert_eq!(translations["fr"]["title"].as_str().unwrap(), "Un titre"); + assert_eq!(translations["en"]["title"].as_str().unwrap(), "A title"); + } + } diff --git a/components/content/Cargo.toml b/components/content/Cargo.toml index b0bf664e..2c02291c 100644 --- a/components/content/Cargo.toml +++ b/components/content/Cargo.toml @@ -4,10 +4,10 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -tera = "0.10" +tera = "0.11.0" serde = "1.0" slug = "0.1" -rayon = "0.8" +rayon = "0.9" errors = { path = "../errors" } config = { path = "../config" } @@ -17,3 +17,4 @@ front_matter = { path = "../front_matter" } [dev-dependencies] tempdir = "0.3" +toml = "0.4" diff --git a/components/content/src/file_info.rs b/components/content/src/file_info.rs index 9a2816d6..d3666652 100644 --- a/components/content/src/file_info.rs +++ b/components/content/src/file_info.rs @@ -8,7 +8,7 @@ pub fn find_content_components>(path: P) -> Vec { let mut components = vec![]; for section in path.parent().unwrap().components() { - let component = section.as_ref().to_string_lossy(); + let component = section.as_os_str().to_string_lossy(); if is_in_content { components.push(component.to_string()); diff --git a/components/content/src/lib.rs b/components/content/src/lib.rs index 91970669..3552fbc6 100644 --- a/components/content/src/lib.rs +++ b/components/content/src/lib.rs @@ -11,6 +11,8 @@ extern crate utils; #[cfg(test)] extern crate tempdir; +#[cfg(test)] +extern crate toml; mod file_info; mod page; diff --git a/components/content/src/page.rs b/components/content/src/page.rs index aa385c15..41ad47fa 100644 --- a/components/content/src/page.rs +++ b/components/content/src/page.rs @@ -103,7 +103,6 @@ impl Page { if let Some(ref p) = page.meta.path { page.path = p.trim().trim_left_matches('/').to_string(); - } else { page.path = if page.file.components.is_empty() { page.slug.clone() @@ -207,7 +206,12 @@ impl ser::Serialize for Page { state.serialize_field("content", &self.content)?; state.serialize_field("title", &self.meta.title)?; state.serialize_field("description", &self.meta.description)?; - state.serialize_field("date", &self.meta.date)?; + // From a TOML datetime to a String first + let date = match self.meta.date { + Some(ref d) => Some(d.to_string()), + None => None, + }; + state.serialize_field("date", &date)?; state.serialize_field("slug", &self.slug)?; state.serialize_field("path", &self.path)?; state.serialize_field("components", &self.components)?; diff --git a/components/content/src/sorting.rs b/components/content/src/sorting.rs index 6bb88700..eec12044 100644 --- a/components/content/src/sorting.rs +++ b/components/content/src/sorting.rs @@ -98,13 +98,16 @@ pub fn populate_previous_and_next_pages(input: &[Page]) -> Vec { #[cfg(test)] mod tests { + use std::str::FromStr; + use toml::value::Datetime; + use front_matter::{PageFrontMatter, SortBy}; use page::Page; use super::{sort_pages, populate_previous_and_next_pages}; fn create_page_with_date(date: &str) -> Page { let mut front_matter = PageFrontMatter::default(); - front_matter.date = Some(date.to_string()); + front_matter.date = Some(Datetime::from_str(date).unwrap()); Page::new("content/hello.md", front_matter) } @@ -136,9 +139,9 @@ mod tests { ]; let (pages, _) = sort_pages(input, SortBy::Date); // Should be sorted by date - assert_eq!(pages[0].clone().meta.date.unwrap(), "2019-01-01"); - assert_eq!(pages[1].clone().meta.date.unwrap(), "2018-01-01"); - assert_eq!(pages[2].clone().meta.date.unwrap(), "2017-01-01"); + assert_eq!(pages[0].clone().meta.date.unwrap().to_string(), "2019-01-01"); + assert_eq!(pages[1].clone().meta.date.unwrap().to_string(), "2018-01-01"); + assert_eq!(pages[2].clone().meta.date.unwrap().to_string(), "2017-01-01"); } #[test] diff --git a/components/errors/Cargo.toml b/components/errors/Cargo.toml index 1237f946..ed4106c9 100644 --- a/components/errors/Cargo.toml +++ b/components/errors/Cargo.toml @@ -4,6 +4,6 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -error-chain = "0.10" -tera = "0.10" +error-chain = "0.11" +tera = "0.11.0" toml = "0.4" diff --git a/components/front_matter/Cargo.toml b/components/front_matter/Cargo.toml index d7ba69a1..6fcd69cf 100644 --- a/components/front_matter/Cargo.toml +++ b/components/front_matter/Cargo.toml @@ -4,13 +4,13 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -tera = "0.10" +tera = "0.11.0" chrono = "0.4" serde = "1.0" serde_derive = "1.0" toml = "0.4" regex = "0.2" -lazy_static = "0.2" +lazy_static = "1" errors = { path = "../errors" } diff --git a/components/front_matter/src/lib.rs b/components/front_matter/src/lib.rs index 4340e5d4..6cf79f0c 100644 --- a/components/front_matter/src/lib.rs +++ b/components/front_matter/src/lib.rs @@ -92,7 +92,7 @@ mod tests { +++ title = "Title" description = "hey there" -date = "2002/10/12" +date = 2002-10-12 +++ Hello "#; @@ -120,7 +120,7 @@ Hello +++ title = "Title" description = "hey there" -date = "2002/10/12" +date = 2002-10-12 +++"#; let (front_matter, content) = split_page_content(Path::new(""), content).unwrap(); assert_eq!(content, ""); @@ -133,7 +133,7 @@ date = "2002/10/12" +++ title = "Title" description = "hey there" -date = "2002-10-02T15:00:00Z" +date = 2002-10-02T15:00:00Z +++ +++"#; let (front_matter, content) = split_page_content(Path::new(""), content).unwrap(); @@ -147,7 +147,7 @@ date = "2002-10-02T15:00:00Z" +++ title = "Title" description = "hey there" -date = "2002/10/12""#; +date = 2002-10-12"#; let res = split_page_content(Path::new(""), content); assert!(res.is_err()); } diff --git a/components/front_matter/src/page.rs b/components/front_matter/src/page.rs index 6f20b588..26b0d4a9 100644 --- a/components/front_matter/src/page.rs +++ b/components/front_matter/src/page.rs @@ -6,6 +6,7 @@ use toml; use errors::Result; + /// The front matter of every page #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct PageFrontMatter { @@ -14,7 +15,7 @@ pub struct PageFrontMatter { /// Description in that appears when linked, e.g. on twitter pub description: Option, /// Date if we want to order pages (ie blog post) - pub date: Option, + pub date: Option, /// Whether this page is a draft and should be ignored for pagination etc pub draft: Option, /// The page slug. Will be used instead of the filename if present @@ -71,17 +72,17 @@ impl PageFrontMatter { Ok(f) } - /// Converts the date in the front matter, which can be in 2 formats, into a NaiveDateTime + /// Converts the TOML datetime to a Chrono naive datetime pub fn date(&self) -> Option { - match self.date { - Some(ref d) => { - if d.contains('T') { - DateTime::parse_from_rfc3339(d).ok().and_then(|s| Some(s.naive_local())) - } else { - NaiveDate::parse_from_str(d, "%Y-%m-%d").ok().and_then(|s| Some(s.and_hms(0,0,0))) - } - }, - None => None, + if let Some(ref d) = self.date { + let d2 = d.to_string(); + if d2.contains('T') { + DateTime::parse_from_rfc3339(&d2).ok().and_then(|s| Some(s.naive_local())) + } else { + NaiveDate::parse_from_str(&d2, "%Y-%m-%d").ok().and_then(|s| Some(s.and_hms(0, 0, 0))) + } + } else { + None } } @@ -121,6 +122,7 @@ impl Default for PageFrontMatter { } } + #[cfg(test)] mod tests { use super::PageFrontMatter; @@ -203,9 +205,10 @@ mod tests { let content = r#" title = "Hello" description = "hey there" - date = "2016-10-10""#; + date = 2016-10-10 + "#; let res = PageFrontMatter::parse(content).unwrap(); - assert!(res.date().is_some()); + assert!(res.date.is_some()); } #[test] @@ -213,9 +216,10 @@ mod tests { let content = r#" title = "Hello" description = "hey there" - date = "2002-10-02T15:00:00Z""#; + date = 2002-10-02T15:00:00Z + "#; let res = PageFrontMatter::parse(content).unwrap(); - assert!(res.date().is_some()); + assert!(res.date.is_some()); } #[test] @@ -223,9 +227,28 @@ mod tests { let content = r#" title = "Hello" description = "hey there" - date = "2002/10/12""#; - let res = PageFrontMatter::parse(content).unwrap(); - assert!(res.date().is_none()); + date = 2002/10/12"#; + let res = PageFrontMatter::parse(content); + assert!(res.is_err()); } + #[test] + fn cannot_parse_invalid_date_format() { + let content = r#" + title = "Hello" + description = "hey there" + date = 2002-14-01"#; + let res = PageFrontMatter::parse(content); + assert!(res.is_err()); + } + + #[test] + fn cannot_parse_date_as_string() { + let content = r#" + title = "Hello" + description = "hey there" + date = "2002-14-01""#; + let res = PageFrontMatter::parse(content); + assert!(res.is_err()); + } } diff --git a/components/highlighting/Cargo.toml b/components/highlighting/Cargo.toml index 018caa1a..0f45a8eb 100644 --- a/components/highlighting/Cargo.toml +++ b/components/highlighting/Cargo.toml @@ -4,5 +4,5 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -lazy_static = "0.2" -syntect = { version = "1", features = ["static-onig"] } +lazy_static = "1" +syntect = "2" diff --git a/components/pagination/Cargo.toml b/components/pagination/Cargo.toml index e0e0e9a1..8264d794 100644 --- a/components/pagination/Cargo.toml +++ b/components/pagination/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -tera = "0.10" +tera = "0.11.0" serde = "1.0" serde_derive = "1.0" diff --git a/components/rendering/Cargo.toml b/components/rendering/Cargo.toml index 66d6fb50..5589b966 100644 --- a/components/rendering/Cargo.toml +++ b/components/rendering/Cargo.toml @@ -4,10 +4,10 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -tera = "0.10" +tera = "0.11.0" regex = "0.2" -lazy_static = "0.2" -syntect = { version = "1", features = ["static-onig"] } +lazy_static = "1" +syntect = "2" pulldown-cmark = "0" slug = "0.1" serde = "1.0" diff --git a/components/rendering/tests/markdown.rs b/components/rendering/tests/markdown.rs index 599e5d5d..d4ef797c 100644 --- a/components/rendering/tests/markdown.rs +++ b/components/rendering/tests/markdown.rs @@ -54,7 +54,7 @@ fn can_highlight_code_block_with_lang() { let res = markdown_to_html("```python\nlist.append(1)\n```", &context).unwrap(); assert_eq!( res.0, - "
\nlist.append(1)\n
" + "
\nlist.append(1)\n
" ); } diff --git a/components/site/Cargo.toml b/components/site/Cargo.toml index a09ca05a..21b79ee7 100644 --- a/components/site/Cargo.toml +++ b/components/site/Cargo.toml @@ -4,14 +4,13 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -tera = "0.10" +tera = "0.11.0" glob = "0.2" walkdir = "2" -rayon = "0.8" +rayon = "0.9" serde = "1.0" serde_derive = "1.0" sass-rs = "0.2" -#sass-rs = { git = "https://github.com/compass-rs/sass-rs.git" } errors = { path = "../errors" } config = { path = "../config" } diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index da5a0b0b..ff069491 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -151,8 +151,6 @@ impl Site { orphans } - /// Used by tests to change the output path to a tmp dir - #[doc(hidden)] pub fn set_output_path>(&mut self, path: P) { self.output_path = path.as_ref().to_path_buf(); } @@ -219,27 +217,7 @@ impl Site { self.add_page(p, false)?; } - { - // Another silly thing needed to not borrow &self in parallel and - // make the borrow checker happy - let permalinks = &self.permalinks; - let tera = &self.tera; - let config = &self.config; - - self.pages.par_iter_mut() - .map(|(_, page)| { - let insert_anchor = pages_insert_anchors[&page.file.path]; - page.render_markdown(permalinks, tera, config, insert_anchor) - }) - .fold(|| Ok(()), Result::and) - .reduce(|| Ok(()), Result::and)?; - - self.sections.par_iter_mut() - .map(|(_, section)| section.render_markdown(permalinks, tera, config)) - .fold(|| Ok(()), Result::and) - .reduce(|| Ok(()), Result::and)?; - } - + self.render_markdown()?; self.populate_sections(); self.populate_tags_and_categories(); @@ -248,9 +226,46 @@ impl Site { Ok(()) } + /// Render the markdown of all pages/sections + /// Used in a build and in `serve` if a shortcode has changed + pub fn render_markdown(&mut self) -> Result<()> { + // Another silly thing needed to not borrow &self in parallel and + // make the borrow checker happy + let permalinks = &self.permalinks; + let tera = &self.tera; + let config = &self.config; + + // TODO: avoid the duplication with function above for that part + // This is needed in the first place because of silly borrow checker + let mut pages_insert_anchors = HashMap::new(); + for (_, p) in &self.pages { + pages_insert_anchors.insert(p.file.path.clone(), self.find_parent_section_insert_anchor(&p.file.parent.clone())); + } + + self.pages.par_iter_mut() + .map(|(_, page)| { + let insert_anchor = pages_insert_anchors[&page.file.path]; + page.render_markdown(permalinks, tera, config, insert_anchor) + }) + .fold(|| Ok(()), Result::and) + .reduce(|| Ok(()), Result::and)?; + + self.sections.par_iter_mut() + .map(|(_, section)| section.render_markdown(permalinks, tera, config)) + .fold(|| Ok(()), Result::and) + .reduce(|| Ok(()), Result::and)?; + + Ok(()) + } + pub fn register_tera_global_fns(&mut self) { + self.tera.register_global_function("trans", global_fns::make_trans(self.config.clone())); self.tera.register_global_function("get_page", global_fns::make_get_page(&self.pages)); self.tera.register_global_function("get_section", global_fns::make_get_section(&self.sections)); + self.tera.register_global_function( + "get_taxonomy_url", + global_fns::make_get_taxonomy_url(self.tags.clone(), self.categories.clone()) + ); self.tera.register_global_function( "get_url", global_fns::make_get_url(self.permalinks.clone(), self.config.clone()) @@ -318,6 +333,8 @@ impl Site { section.ignored_pages = vec![]; } + // TODO: use references instead of cloning to avoid having to call populate_section on + // content change for page in self.pages.values() { let parent_section_path = page.file.parent.join("_index.md"); if self.sections.contains_key(&parent_section_path) { @@ -443,7 +460,7 @@ impl Site { pub fn clean(&self) -> Result<()> { if self.output_path.exists() { // Delete current `public` directory so we can start fresh - remove_dir_all(&self.output_path).chain_err(|| "Couldn't delete `public` directory")?; + remove_dir_all(&self.output_path).chain_err(|| "Couldn't delete output directory")?; } Ok(()) @@ -620,7 +637,13 @@ impl Site { &self.pages .values() .filter(|p| !p.is_draft()) - .map(|p| SitemapEntry::new(p.permalink.clone(), p.meta.date.clone())) + .map(|p| { + let date = match p.meta.date { + Some(ref d) => Some(d.to_string()), + None => None, + }; + SitemapEntry::new(p.permalink.clone(), date) + }) .collect::>() ); context.add( @@ -678,7 +701,7 @@ impl Site { } let (sorted_pages, _) = sort_pages(pages, SortBy::Date); - context.add("last_build_date", &sorted_pages[0].meta.date); + context.add("last_build_date", &sorted_pages[0].meta.date.clone().map(|d| d.to_string())); // limit to the last n elements) context.add("pages", &sorted_pages.iter().take(self.config.rss_limit.unwrap()).collect::>()); context.add("config", &self.config); diff --git a/components/site/test_site/content/posts/draft.md b/components/site/test_site/content/posts/draft.md index ba61214a..c66b8355 100644 --- a/components/site/test_site/content/posts/draft.md +++ b/components/site/test_site/content/posts/draft.md @@ -1,6 +1,6 @@ +++ title = "A draft" draft = true -date = "2016-03-01" +date = 2016-03-01 +++ diff --git a/components/site/test_site/content/posts/fixed-slug.md b/components/site/test_site/content/posts/fixed-slug.md index ccba64a7..ca932bde 100644 --- a/components/site/test_site/content/posts/fixed-slug.md +++ b/components/site/test_site/content/posts/fixed-slug.md @@ -2,7 +2,7 @@ title = "Fixed slug" description = "" slug = "something-else" -date = "2017-01-01" +date = 2017-01-01 aliases = ["/an-old-url/old-page"] +++ diff --git a/components/site/test_site/content/posts/fixed-url.md b/components/site/test_site/content/posts/fixed-url.md index 0718d52d..075e2c78 100644 --- a/components/site/test_site/content/posts/fixed-url.md +++ b/components/site/test_site/content/posts/fixed-url.md @@ -2,7 +2,7 @@ title = "Fixed URL" description = "" path = "a-fixed-url" -date = "2017-02-01" +date = 2017-02-01 +++ A simple page with fixed url diff --git a/components/site/test_site/content/posts/python.md b/components/site/test_site/content/posts/python.md index e8d0a24b..aa39b4e1 100644 --- a/components/site/test_site/content/posts/python.md +++ b/components/site/test_site/content/posts/python.md @@ -1,7 +1,7 @@ +++ title = "Python in posts" description = "" -date = "2017-03-01" +date = 2017-03-01 +++ Same filename but different path diff --git a/components/site/test_site/content/posts/simple.md b/components/site/test_site/content/posts/simple.md index 48fe505e..3593cecd 100644 --- a/components/site/test_site/content/posts/simple.md +++ b/components/site/test_site/content/posts/simple.md @@ -1,7 +1,7 @@ +++ title = "Simple article with shortcodes" description = "" -date = "2017-04-01" +date = 2017-04-01 +++ A simple page diff --git a/components/site/test_site/content/posts/tutorials/devops/docker.md b/components/site/test_site/content/posts/tutorials/devops/docker.md index 4135b4af..ad19af5c 100644 --- a/components/site/test_site/content/posts/tutorials/devops/docker.md +++ b/components/site/test_site/content/posts/tutorials/devops/docker.md @@ -1,7 +1,7 @@ +++ title = "Docker" order = 1 -date = "2017-01-01" +date = 2017-01-01 +++ A simple page diff --git a/components/site/test_site/content/posts/tutorials/devops/nix.md b/components/site/test_site/content/posts/tutorials/devops/nix.md index 4facb793..004ad58d 100644 --- a/components/site/test_site/content/posts/tutorials/devops/nix.md +++ b/components/site/test_site/content/posts/tutorials/devops/nix.md @@ -1,7 +1,7 @@ +++ title = "Nix" order = 2 -date = "2017-01-01" +date = 2017-01-01 +++ A simple page diff --git a/components/site/test_site/content/posts/tutorials/programming/python.md b/components/site/test_site/content/posts/tutorials/programming/python.md index 149042cc..d65d52fb 100644 --- a/components/site/test_site/content/posts/tutorials/programming/python.md +++ b/components/site/test_site/content/posts/tutorials/programming/python.md @@ -1,7 +1,7 @@ +++ title = "Python tutorial" order = 1 -date = "2017-01-01" +date = 2017-01-01 +++ A simple page diff --git a/components/site/test_site/content/posts/tutorials/programming/rust.md b/components/site/test_site/content/posts/tutorials/programming/rust.md index b2421368..3582c4bc 100644 --- a/components/site/test_site/content/posts/tutorials/programming/rust.md +++ b/components/site/test_site/content/posts/tutorials/programming/rust.md @@ -1,7 +1,7 @@ +++ title = "Rust" order = 2 -date = "2017-01-01" +date = 2017-01-01 +++ A simple page diff --git a/components/site/test_site/templates/index.html b/components/site/test_site/templates/index.html index bd9bca00..1e741a71 100644 --- a/components/site/test_site/templates/index.html +++ b/components/site/test_site/templates/index.html @@ -1,5 +1,5 @@ - + diff --git a/components/site/test_site/templates/index_paginated.html b/components/site/test_site/templates/index_paginated.html index 02aadcd8..096aaf52 100644 --- a/components/site/test_site/templates/index_paginated.html +++ b/components/site/test_site/templates/index_paginated.html @@ -1,5 +1,5 @@ - + diff --git a/components/taxonomies/Cargo.toml b/components/taxonomies/Cargo.toml index a3daecde..63148a42 100644 --- a/components/taxonomies/Cargo.toml +++ b/components/taxonomies/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -tera = "0.10" +tera = "0.11.0" slug = "0.1" serde = "1.0" serde_derive = "1.0" diff --git a/components/taxonomies/src/lib.rs b/components/taxonomies/src/lib.rs index d29ba346..e85eb6c1 100644 --- a/components/taxonomies/src/lib.rs +++ b/components/taxonomies/src/lib.rs @@ -44,7 +44,7 @@ impl TaxonomyItem { let (mut pages, ignored_pages) = sort_pages(pages, SortBy::Date); let slug = slugify(name); let permalink = { - let kind_path = if kind == TaxonomyKind::Tags { "tag" } else { "category" }; + let kind_path = if kind == TaxonomyKind::Tags { "tags" } else { "categories" }; config.make_permalink(&format!("/{}/{}", kind_path, slug)) }; @@ -188,27 +188,27 @@ mod tests { assert_eq!(tags.items[0].name, "db"); assert_eq!(tags.items[0].slug, "db"); - assert_eq!(tags.items[0].permalink, "http://a-website.com/tag/db/"); + assert_eq!(tags.items[0].permalink, "http://a-website.com/tags/db/"); assert_eq!(tags.items[0].pages.len(), 1); assert_eq!(tags.items[1].name, "js"); assert_eq!(tags.items[1].slug, "js"); - assert_eq!(tags.items[1].permalink, "http://a-website.com/tag/js/"); + assert_eq!(tags.items[1].permalink, "http://a-website.com/tags/js/"); assert_eq!(tags.items[1].pages.len(), 2); assert_eq!(tags.items[2].name, "rust"); assert_eq!(tags.items[2].slug, "rust"); - assert_eq!(tags.items[2].permalink, "http://a-website.com/tag/rust/"); + assert_eq!(tags.items[2].permalink, "http://a-website.com/tags/rust/"); assert_eq!(tags.items[2].pages.len(), 2); assert_eq!(categories.items[0].name, "Other"); assert_eq!(categories.items[0].slug, "other"); - assert_eq!(categories.items[0].permalink, "http://a-website.com/category/other/"); + assert_eq!(categories.items[0].permalink, "http://a-website.com/categories/other/"); assert_eq!(categories.items[0].pages.len(), 1); assert_eq!(categories.items[1].name, "Programming tutorials"); assert_eq!(categories.items[1].slug, "programming-tutorials"); - assert_eq!(categories.items[1].permalink, "http://a-website.com/category/programming-tutorials/"); + assert_eq!(categories.items[1].permalink, "http://a-website.com/categories/programming-tutorials/"); assert_eq!(categories.items[1].pages.len(), 1); } } diff --git a/components/templates/Cargo.toml b/components/templates/Cargo.toml index 5800af0f..b1556576 100644 --- a/components/templates/Cargo.toml +++ b/components/templates/Cargo.toml @@ -4,12 +4,13 @@ version = "0.1.0" authors = ["Vincent Prouillet "] [dependencies] -tera = "0.10" -base64 = "0.7" -lazy_static = "0.2" +tera = "0.11.0" +base64 = "0.9" +lazy_static = "1" pulldown-cmark = "0" errors = { path = "../errors" } utils = { path = "../utils" } content = { path = "../content" } config = { path = "../config" } +taxonomies = { path = "../taxonomies" } diff --git a/components/templates/src/builtins/rss.xml b/components/templates/src/builtins/rss.xml index ace8dbf5..35b7fbcd 100644 --- a/components/templates/src/builtins/rss.xml +++ b/components/templates/src/builtins/rss.xml @@ -4,7 +4,7 @@ {{ config.base_url }} {{ config.description }} Gutenberg - {{ config.language_code }} + {{ config.default_language }} {{ last_build_date | date(format="%a, %d %b %Y %H:%M:%S %z") }} {% for page in pages %} diff --git a/components/templates/src/global_fns.rs b/components/templates/src/global_fns.rs index 438369f0..a0c76726 100644 --- a/components/templates/src/global_fns.rs +++ b/components/templates/src/global_fns.rs @@ -6,6 +6,34 @@ use tera::{GlobalFn, Value, from_value, to_value, Result}; use content::{Page, Section}; use config::Config; use utils::site::resolve_internal_link; +use taxonomies::Taxonomy; + + +macro_rules! required_string_arg { + ($e: expr, $err: expr) => { + match $e { + Some(v) => match from_value::(v.clone()) { + Ok(u) => u, + Err(_) => return Err($err.into()) + }, + None => return Err($err.into()) + }; + }; +} + + +pub fn make_trans(config: Config) -> GlobalFn { + let translations_config = config.translations.unwrap(); + let default_lang = to_value(config.default_language.unwrap()).unwrap(); + + Box::new(move |args| -> Result { + let key = required_string_arg!(args.get("key"), "`trans` requires a `key` argument."); + let lang_arg = args.get("lang").unwrap_or(&default_lang).clone(); + let lang = from_value::(lang_arg).unwrap(); + let translations = &translations_config[lang.as_str()]; + Ok(to_value(&translations[key.as_str()]).unwrap()) + }) +} pub fn make_get_page(all_pages: &HashMap) -> GlobalFn { @@ -15,17 +43,10 @@ pub fn make_get_page(all_pages: &HashMap) -> GlobalFn { } Box::new(move |args| -> Result { - match args.get("path") { - Some(val) => match from_value::(val.clone()) { - Ok(v) => { - match pages.get(&v) { - Some(p) => Ok(to_value(p).unwrap()), - None => Err(format!("Page `{}` not found.", v).into()) - } - }, - Err(_) => Err(format!("`get_page` received path={:?} but it requires a string", val).into()), - }, - None => Err("`get_page` requires a `path` argument.".into()), + let path = required_string_arg!(args.get("path"), "`get_page` requires a `path` argument with a string value"); + match pages.get(&path) { + Some(p) => Ok(to_value(p).unwrap()), + None => Err(format!("Page `{}` not found.", path).into()) } }) } @@ -37,17 +58,10 @@ pub fn make_get_section(all_sections: &HashMap) -> GlobalFn { } Box::new(move |args| -> Result { - match args.get("path") { - Some(val) => match from_value::(val.clone()) { - Ok(v) => { - match sections.get(&v) { - Some(p) => Ok(to_value(p).unwrap()), - None => Err(format!("Section `{}` not found.", v).into()) - } - }, - Err(_) => Err(format!("`get_section` received path={:?} but it requires a string", val).into()), - }, - None => Err("`get_section` requires a `path` argument.".into()), + let path = required_string_arg!(args.get("path"), "`get_section` requires a `path` argument with a string value"); + match sections.get(&path) { + Some(p) => Ok(to_value(p).unwrap()), + None => Err(format!("Section `{}` not found.", path).into()) } }) } @@ -60,40 +74,66 @@ pub fn make_get_url(permalinks: HashMap, config: Config) -> Glob from_value::(c.clone()).unwrap_or(false) }); - match args.get("path") { - Some(val) => match from_value::(val.clone()) { - Ok(v) => { - // Internal link - if v.starts_with("./") { - match resolve_internal_link(&v, &permalinks) { - Ok(url) => Ok(to_value(url).unwrap()), - Err(_) => Err(format!("Could not resolve URL for link `{}` not found.", v).into()) - } - } else { - // anything else - let mut permalink = config.make_permalink(&v); - if cachebust { - permalink = format!("{}?t={}", permalink, config.build_timestamp.unwrap()); - } - Ok(to_value(permalink).unwrap()) - } - }, - Err(_) => Err(format!("`get_url` received path={:?} but it requires a string", val).into()), - }, - None => Err("`get_url` requires a `path` argument.".into()), + let trailing_slash = args + .get("trailing_slash") + .map_or(true, |c| { + from_value::(c.clone()).unwrap_or(true) + }); + + let path = required_string_arg!(args.get("path"), "`get_url` requires a `path` argument with a string value"); + if path.starts_with("./") { + match resolve_internal_link(&path, &permalinks) { + Ok(url) => Ok(to_value(url).unwrap()), + Err(_) => Err(format!("Could not resolve URL for link `{}` not found.", path).into()) + } + } else { + // anything else + let mut permalink = config.make_permalink(&path); + if !trailing_slash && permalink.ends_with("/") { + permalink.pop(); // Removes the slash + } + + if cachebust { + permalink = format!("{}?t={}", permalink, config.build_timestamp.unwrap()); + } + Ok(to_value(permalink).unwrap()) + } + }) +} + +pub fn make_get_taxonomy_url(tags: Option, categories: Option) -> GlobalFn { + Box::new(move |args| -> Result { + let kind = required_string_arg!(args.get("kind"), "`get_taxonomy_url` requires a `kind` argument with a string value"); + let name = required_string_arg!(args.get("name"), "`get_taxonomy_url` requires a `name` argument with a string value"); + let container = match kind.as_ref() { + "tag" => &tags, + "category" => &categories, + _ => return Err("`get_taxonomy_url` can only get `tag` or `category` for the `kind` argument".into()), + }; + + if let Some(ref c) = *container { + for item in &c.items { + if item.name == name { + return Ok(to_value(item.permalink.clone()).unwrap()); + } + } + bail!("`get_taxonomy_url`: couldn't find `{}` in `{}` taxonomy", name, kind); + } else { + bail!("`get_taxonomy_url` tried to get a taxonomy of kind `{}` but there isn't any", kind); } }) } #[cfg(test)] mod tests { - use super::make_get_url; + use super::{make_get_url, make_get_taxonomy_url, make_trans}; use std::collections::HashMap; use tera::to_value; use config::Config; + use taxonomies::{Taxonomy, TaxonomyKind, TaxonomyItem}; #[test] @@ -106,6 +146,27 @@ mod tests { 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"); + } + #[test] fn can_link_to_some_static_file() { let config = Config::default(); @@ -114,4 +175,59 @@ mod tests { args.insert("path".to_string(), to_value("app.css").unwrap()); assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css/"); } + + #[test] + fn can_get_tag_url() { + let tag = TaxonomyItem::new( + "Prog amming", + TaxonomyKind::Tags, + &Config::default(), + vec![], + ); + let tags = Taxonomy { + kind: TaxonomyKind::Tags, + items: vec![tag], + }; + + let static_fn = make_get_taxonomy_url(Some(tags), None); + // can find it correctly + let mut args = HashMap::new(); + args.insert("kind".to_string(), to_value("tag").unwrap()); + args.insert("name".to_string(), to_value("Prog amming").unwrap()); + assert_eq!(static_fn(args).unwrap(), "http://a-website.com/tags/prog-amming/"); + // and errors if it can't find it + let mut args = HashMap::new(); + args.insert("kind".to_string(), to_value("tag").unwrap()); + args.insert("name".to_string(), to_value("random").unwrap()); + assert!(static_fn(args).is_err()); + } + + #[test] + fn can_translate_a_string() { + let trans_config = r#" +base_url = "https://remplace-par-ton-url.fr" +default_language = "fr" + +[translations] +[translations.fr] +title = "Un titre" + +[translations.en] +title = "A title" + + "#; + + let config = Config::parse(trans_config).unwrap(); + let static_fn = make_trans(config); + let mut args = HashMap::new(); + + args.insert("key".to_string(), to_value("title").unwrap()); + assert_eq!(static_fn(args.clone()).unwrap(), "Un titre"); + + args.insert("lang".to_string(), to_value("en").unwrap()); + assert_eq!(static_fn(args.clone()).unwrap(), "A title"); + + args.insert("lang".to_string(), to_value("fr").unwrap()); + assert_eq!(static_fn(args.clone()).unwrap(), "Un titre"); + } } diff --git a/components/templates/src/lib.rs b/components/templates/src/lib.rs index c0d0fe17..2e70f890 100644 --- a/components/templates/src/lib.rs +++ b/components/templates/src/lib.rs @@ -5,10 +5,12 @@ extern crate tera; extern crate base64; extern crate pulldown_cmark; +#[macro_use] extern crate errors; extern crate utils; extern crate content; extern crate config; +extern crate taxonomies; pub mod filters; pub mod global_fns; diff --git a/components/utils/Cargo.toml b/components/utils/Cargo.toml index 24c3aeb4..8714e52a 100644 --- a/components/utils/Cargo.toml +++ b/components/utils/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Vincent Prouillet "] [dependencies] errors = { path = "../errors" } -tera = "0.10" +tera = "0.11.0" [dev-dependencies] diff --git a/components/utils/src/default_tpl.html b/components/utils/src/default_tpl.html new file mode 100644 index 00000000..5788358a --- /dev/null +++ b/components/utils/src/default_tpl.html @@ -0,0 +1,43 @@ + + + Gutenberg + + +
+

Welcome to Gutenberg!

+

+ You're seeing this page because we couldn't find a template to render. +

+

+ To modify this page, create a {{filename}} file in the templates directory or + install a theme. +
+ You can find what variables are available in this template in the documentation. +

+
+ + + + diff --git a/components/utils/src/templates.rs b/components/utils/src/templates.rs index 4e36c2a9..3d4b4dae 100644 --- a/components/utils/src/templates.rs +++ b/components/utils/src/templates.rs @@ -2,6 +2,20 @@ use tera::{Tera, Context}; use errors::Result; +static DEFAULT_TPL: &str = include_str!("default_tpl.html"); + + +macro_rules! render_default_tpl { + ($filename: expr, $url: expr) => { + { + let mut context = Context::new(); + context.add("filename", $filename); + context.add("url", $url); + Tera::one_off(DEFAULT_TPL, &context, true).map_err(|e| e.into()) + } + }; +} + /// Renders the given template with the given context, but also ensures that, if the default file /// is not found, it will look up for the equivalent template for the current theme if there is one. /// Lastly, if it's a default template (index, section or page), it will just return an empty string @@ -19,11 +33,19 @@ pub fn render_template(name: &str, tera: &Tera, context: &Context, theme: Option .map_err(|e| e.into()); } - if name == "index.html" || name == "section.html" || name == "page.html" { - return Ok(String::new()); + // maybe it's a default one? + match name { + "index.html" | "section.html" => { + render_default_tpl!(name, "https://www.getgutenberg.io/documentation/templates/pages-sections/#section-variables") + }, + "page.html" => { + render_default_tpl!(name, "https://www.getgutenberg.io/documentation/templates/pages-sections/#page-variables") + }, + "tag.html" | "tags.html" | "category.html" | "categories.html" => { + render_default_tpl!(name, "https://www.getgutenberg.io/documentation/templates/tags-categories/") + }, + _ => bail!("Tried to render `{}` but the template wasn't found", name) } - - bail!("Tried to render `{}` but the template wasn't found", name) } @@ -55,7 +77,7 @@ mod tests { #[test] fn can_rewrite_all_paths_of_theme() { - let mut tera = Tera::parse("templates/*.html").unwrap(); + let mut tera = Tera::parse("test-templates/*.html").unwrap(); rewrite_theme_paths(&mut tera, "hyde"); // special case to make the test work: we also rename the files to // match the imports diff --git a/components/utils/templates/child.html b/components/utils/test-templates/child.html similarity index 100% rename from components/utils/templates/child.html rename to components/utils/test-templates/child.html diff --git a/components/utils/templates/included.html b/components/utils/test-templates/included.html similarity index 100% rename from components/utils/templates/included.html rename to components/utils/test-templates/included.html diff --git a/components/utils/templates/index.html b/components/utils/test-templates/index.html similarity index 100% rename from components/utils/templates/index.html rename to components/utils/test-templates/index.html diff --git a/components/utils/templates/macros.html b/components/utils/test-templates/macros.html similarity index 100% rename from components/utils/templates/macros.html rename to components/utils/test-templates/macros.html diff --git a/components/utils/templates/using-macros.html b/components/utils/test-templates/using-macros.html similarity index 100% rename from components/utils/templates/using-macros.html rename to components/utils/test-templates/using-macros.html diff --git a/docs/content/documentation/content/page.md b/docs/content/documentation/content/page.md index 913fda32..14131a66 100644 --- a/docs/content/documentation/content/page.md +++ b/docs/content/documentation/content/page.md @@ -22,6 +22,7 @@ description = "" # The date of the post. # 2 formats are allowed: YYYY-MM-DD (2012-10-02) and RFC3339 (2002-10-02T15:00:00Z) +# Do not wrap dates in quotes, the line below only indicates that there is no default date date = "" # A draft page will not be present in prev/next pagination diff --git a/docs/content/documentation/content/syntax-highlighting.md b/docs/content/documentation/content/syntax-highlighting.md index cd8a92f0..9160bca7 100644 --- a/docs/content/documentation/content/syntax-highlighting.md +++ b/docs/content/documentation/content/syntax-highlighting.md @@ -32,7 +32,8 @@ Here is a full list of the supported languages and the short names you can use: - Jinja2 -> ["j2", "jinja2"] - Julia -> ["jl"] - Kotlin -> ["kt", "kts"] -- LESS -> ["less"] +- Less -> ["less", "css.less"] +- Nim -> ["nim", "nims"] - ASP -> ["asa"] - HTML (ASP) -> ["asp"] - ActionScript -> ["as"] @@ -57,12 +58,12 @@ Here is a full list of the supported languages and the short names you can use: - Java Server Page (JSP) -> ["jsp"] - Java -> ["java", "bsh"] - Java Properties -> ["properties"] -- JSON -> ["json", "sublime-settings", "sublime-menu", "sublime-keymap", "sublime-mousemap", "sublime-theme", "sublime-build", "sublime-project", "sublime-completions", "sublime-commands", "sublime-macro"] +- JSON -> ["json", "sublime-settings", "sublime-menu", "sublime-keymap", "sublime-mousemap", "sublime-theme", "sublime-build", "sublime-project", "sublime-completions", "sublime-commands", "sublime-macro", "sublime-color-scheme"] - JavaScript -> ["js", "htc"] - BibTeX -> ["bib"] - LaTeX -> ["tex", "ltx"] - TeX -> ["sty", "cls"] -- Lisp -> ["lisp", "cl", "l", "mud", "el", "scm", "ss", "lsp", "fasl"] +- Lisp -> ["lisp", "cl", "clisp", "l", "mud", "el", "scm", "ss", "lsp", "fasl"] - Lua -> ["lua"] - Makefile -> ["make", "GNUmakefile", "makefile", "Makefile", "OCamlMakefile", "mak", "mk"] - Markdown -> ["md", "mdown", "markdown", "markdn"] @@ -89,13 +90,14 @@ Here is a full list of the supported languages and the short names you can use: - Rust -> ["rs"] - SQL -> ["sql", "ddl", "dml"] - Scala -> ["scala", "sbt"] -- Bourne Again Shell (bash) -> ["sh", "bash", "zsh", "fish", ".bash_aliases", ".bash_functions", ".bash_login", ".bash_logout", ".bash_profile", ".bash_variables", ".bashrc", ".profile", ".textmate_init"] +- Bourne Again Shell (bash) -> ["sh", "bash", "zsh", "fish", ".bash_aliases", ".bash_completions", ".bash_functions", ".bash_login", ".bash_logout", ".bash_profile", ".bash_variables", ".bashrc", ".profile", ".textmate_init"] - HTML (Tcl) -> ["adp"] - Tcl -> ["tcl"] - Textile -> ["textile"] - XML -> ["xml", "xsd", "xslt", "tld", "dtml", "rss", "opml", "svg"] - YAML -> ["yaml", "yml", "sublime-syntax"] -- Generic Config -> ["cfg", "conf", "config", "ini", "pro"] +- SWI-Prolog -> ["pro"] +- Generic Config -> ["cfg", "conf", "config", "ini", "pro", "mak", "mk", "Doxyfile", "inputrc", ".inputrc", "dircolors", ".dircolors", "gitmodules", ".gitmodules", "gitignore", ".gitignore", "gitattributes", ".gitattributes"] - Linker Script -> ["ld"] - TOML -> ["toml", "tml"] - TypeScript -> ["ts"] diff --git a/docs/content/documentation/content/tags-categories.md b/docs/content/documentation/content/tags-categories.md index 43ecaddf..20eae9e8 100644 --- a/docs/content/documentation/content/tags-categories.md +++ b/docs/content/documentation/content/tags-categories.md @@ -15,9 +15,9 @@ are available at the following paths: ```plain $BASE_URL/tags/ -$BASE_URL/tag/$TAG_SLUG +$BASE_URL/tags/$TAG_SLUG $BASE_URL/categories/ -$BASE_URL/category/$CATEGORY_SLUG +$BASE_URL/categories/$CATEGORY_SLUG ``` It is currently not possible to change those paths or to create custom taxonomies. diff --git a/docs/content/documentation/getting-started/cli-usage.md b/docs/content/documentation/getting-started/cli-usage.md index 7e0022c6..44b0c410 100644 --- a/docs/content/documentation/getting-started/cli-usage.md +++ b/docs/content/documentation/getting-started/cli-usage.md @@ -36,6 +36,11 @@ $ gutenberg build --base-url $DEPLOY_URL This is useful for example when you want to deploy previews of a site to a dynamic URL, such as Netlify deploy previews. ++You can override the default output directory 'public' by passing a other value to the `output-dir` flag. +```bash +$ gutenberg build --output-dir $DOCUMENT_ROOT +``` + ## serve This will build and serve the site using a local server. You can also specify @@ -46,6 +51,7 @@ $ gutenberg serve $ gutenberg serve --port 2000 $ gutenberg serve --interface 0.0.0.0 $ gutenberg serve --interface 0.0.0.0 --port 2000 +$ gutenberg serve --interface 0.0.0.0 --port 2000 --output-dir www/public ``` The serve command will watch all your content and will provide live reload, without diff --git a/docs/content/documentation/getting-started/configuration.md b/docs/content/documentation/getting-started/configuration.md index 1fafebbe..f7966d51 100644 --- a/docs/content/documentation/getting-started/configuration.md +++ b/docs/content/documentation/getting-started/configuration.md @@ -21,7 +21,8 @@ base_url = "mywebsite.com" # Used in RSS by default title = "" description = "" -language_code = "en" +# the default language, used in RSS and coming i18n +default_language = "en" # Theme name to use theme = "" @@ -50,6 +51,9 @@ generate_categories_pages = false # Whether to compile the Sass files found in the `sass` directory compile_sass = false +# Optional translation object. The key if present should be a language code +[translations] + # You can put any kind of data in there and it # will be accessible in all templates [extra] diff --git a/docs/content/documentation/templates/overview.md b/docs/content/documentation/templates/overview.md index c69ad73e..03f77ecf 100644 --- a/docs/content/documentation/templates/overview.md +++ b/docs/content/documentation/templates/overview.md @@ -70,5 +70,31 @@ we want to link to the file that is located at `static/css/app.css`: {{ get_url(path="css/app.css") }} ``` +For assets it is reccommended that you pass `trailing_slash=false` to the `get_url` function. This prevents errors +when dealing with certain hosting providers. An example is: + +```jinja2 +{{ get_url(path="css/app.css", trailing_slash=false) }} +``` + In the case of non-internal links, you can also add a cachebust of the format `?t=1290192` at the end of a URL by passing `cachebust=true` to the `get_url` function. + + +### `get_taxonomy_url` +Gets the permalink for the tag or category given. + +```jinja2 +{% set url = get_taxonomy_url(kind="category", name=page.category) %} +``` + +The `name` will almost come from a variable but in case you want to do it manually, +the value should be the same as the one in the front-matter, not the slugified version. + +### `trans` +Gets the translation of the given `key`, for the `default_language` or the `language given + +```jinja2 +{{ trans(key="title") }} +{{ trans(key="title", lang="fr") }} +``` diff --git a/docs/content/documentation/themes/creating-a-theme.md b/docs/content/documentation/themes/creating-a-theme.md index 93da0fbd..6b1d2f3f 100644 --- a/docs/content/documentation/themes/creating-a-theme.md +++ b/docs/content/documentation/themes/creating-a-theme.md @@ -57,3 +57,8 @@ To be featured on this site, the theme will require two more things: of importance A simple theme you can use as example is [Hyde](https://github.com/Keats/hyde). + +# Caveat + +Please note that [include paths](https://tera.netlify.com/docs/templates/#include) can only be used in used in normal templates. Theme templates should use [macro's](https://tera.netlify.com/docs/templates/#macros) instead. + diff --git a/docs/templates/index.html b/docs/templates/index.html index 88b041eb..c366dbb9 100644 --- a/docs/templates/index.html +++ b/docs/templates/index.html @@ -7,8 +7,8 @@ {% block title %}{{ config.title }}{% endblock title %} - - + + diff --git a/src/cli.rs b/src/cli.rs index e42fe75d..b433f8e8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -28,6 +28,12 @@ pub fn build_cli() -> App<'static, 'static> { .long("base-url") .takes_value(true) .help("Force the base URL to be that value (default to the one in config.toml)"), + Arg::with_name("output_dir") + .short("o") + .long("output-dir") + .default_value("public") + .takes_value(true) + .help("Outputs the generated site in the given path"), ]), SubCommand::with_name("serve") .about("Serve the site. Rebuild and reload on change automatically") @@ -42,6 +48,12 @@ pub fn build_cli() -> App<'static, 'static> { .long("port") .default_value("1111") .help("Which port to use"), + Arg::with_name("output_dir") + .short("o") + .long("output-dir") + .default_value("public") + .takes_value(true) + .help("Outputs the generated site in the given path"), ]), ]) } diff --git a/src/cmd/build.rs b/src/cmd/build.rs index c2654f5a..6c509fce 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -5,8 +5,9 @@ use site::Site; use console; -pub fn build(config_file: &str, base_url: Option<&str>) -> Result<()> { +pub fn build(config_file: &str, base_url: Option<&str>, output_dir: &str) -> Result<()> { let mut site = Site::new(env::current_dir().unwrap(), config_file)?; + site.set_output_path(output_dir); if let Some(b) = base_url { site.config.base_url = b.to_string(); } diff --git a/src/cmd/init.rs b/src/cmd/init.rs index 3545e899..5afd75e0 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -57,8 +57,7 @@ pub fn create_new_project(name: &str) -> Result<()> { println!(); console::success(&format!("Done! Your site was created in {:?}", canonicalize(path).unwrap())); println!(); - console::info("Get started by using the built-in server: `gutenberg serve`"); - println!("There is no built-in theme so you will see a white page."); - println!("Visit https://github.com/Keats/gutenberg for the full documentation."); + console::info("Get started by moving into the directory and using the built-in server: `gutenberg serve`"); + println!("Visit https://www.getgutenberg.io for the full documentation."); Ok(()) } diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index 16e02b3b..88bbb9eb 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -22,6 +22,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. use std::env; +use std::fs::remove_dir_all; use std::path::Path; use std::sync::mpsc::channel; use std::time::{Instant, Duration}; @@ -33,6 +34,8 @@ use mount::Mount; use staticfile::Static; use notify::{Watcher, RecursiveMode, watcher}; use ws::{WebSocket, Sender, Message}; +use ctrlc; + use site::Site; use errors::{Result, ResultExt}; @@ -45,6 +48,7 @@ enum ChangeKind { Templates, StaticFiles, Sass, + Config, } // Uglified using uglifyjs @@ -77,8 +81,7 @@ fn rebuild_done_handling(broadcaster: &Sender, res: Result<()>, reload_path: &st } } -pub fn serve(interface: &str, port: &str, config_file: &str) -> Result<()> { - let start = Instant::now(); +fn create_new_site(interface: &str, port: &str, output_dir: &str, config_file: &str) -> Result<(Site, String)> { let mut site = Site::new(env::current_dir().unwrap(), config_file)?; let address = format!("{}:{}", interface, port); @@ -88,22 +91,30 @@ pub fn serve(interface: &str, port: &str, config_file: &str) -> Result<()> { } else { format!("http://{}", address) }; - + site.set_output_path(output_dir); site.load()?; site.enable_live_reload(); console::notify_site_size(&site); console::warn_about_ignored_pages(&site); site.build()?; + Ok((site, address)) +} + +pub fn serve(interface: &str, port: &str, output_dir: &str, config_file: &str) -> Result<()> { + let start = Instant::now(); + let (mut site, address) = create_new_site(interface, port, output_dir, config_file)?; console::report_elapsed_time(start); - let mut watching_static = false; // Setup watchers + let mut watching_static = false; let (tx, rx) = channel(); let mut watcher = watcher(tx, Duration::from_secs(2)).unwrap(); watcher.watch("content/", RecursiveMode::Recursive) .chain_err(|| "Can't watch the `content` folder. Does it exist?")?; watcher.watch("templates/", RecursiveMode::Recursive) .chain_err(|| "Can't watch the `templates` folder. Does it exist?")?; + watcher.watch("config.toml", RecursiveMode::Recursive) + .chain_err(|| "Can't watch the `config.toml` file. Does it exist?")?; if Path::new("static").exists() { watching_static = true; @@ -116,9 +127,9 @@ pub fn serve(interface: &str, port: &str, config_file: &str) -> Result<()> { let ws_address = format!("{}:{}", interface, "1112"); - // Start a webserver that serves the `public` directory + // Start a webserver that serves the `output_dir` directory let mut mount = Mount::new(); - mount.mount("/", Static::new(Path::new("public/"))); + mount.mount("/", Static::new(Path::new(output_dir))); mount.mount("/livereload.js", livereload_handler); // Starts with a _ to not trigger the unused lint // we need to assign to a variable otherwise it will block @@ -147,7 +158,7 @@ pub fn serve(interface: &str, port: &str, config_file: &str) -> Result<()> { let pwd = format!("{}", env::current_dir().unwrap().display()); - let mut watchers = vec!["content", "templates"]; + let mut watchers = vec!["content", "templates", "config.toml"]; if watching_static { watchers.push("static"); } @@ -158,6 +169,12 @@ pub fn serve(interface: &str, port: &str, config_file: &str) -> Result<()> { println!("Listening for changes in {}/{{{}}}", pwd, watchers.join(", ")); println!("Web server is available at http://{}", address); println!("Press Ctrl+C to stop\n"); + // Delete the output folder on ctrl+C + let output_path = Path::new(output_dir).to_path_buf(); + ctrlc::set_handler(move || { + remove_dir_all(&output_path).expect("Failed to delete output directory"); + ::std::process::exit(0); + }).expect("Error setting Ctrl-C handler"); use notify::DebouncedEvent::*; @@ -196,6 +213,10 @@ pub fn serve(interface: &str, port: &str, config_file: &str) -> Result<()> { console::info(&format!("-> Sass file changed {}", path.display())); rebuild_done_handling(&broadcaster, site.compile_sass(&site.base_path), &p); }, + (ChangeKind::Config, _) => { + console::info(&format!("-> Config changed. The whole site will be reloaded. The browser needs to be refreshed to make the changes visible.")); + site = create_new_site(interface, port, output_dir, config_file).unwrap().0; + } }; console::report_elapsed_time(start); } @@ -249,6 +270,8 @@ fn detect_change_kind(pwd: &str, path: &Path) -> (ChangeKind, String) { ChangeKind::StaticFiles } else if path_str.starts_with("/sass") { ChangeKind::Sass + } else if path_str == "/config.toml" { + ChangeKind::Config } else { unreachable!("Got a change in an unexpected path: {}", path_str) }; @@ -299,7 +322,11 @@ mod tests { ( (ChangeKind::Sass, "/sass/print.scss".to_string()), "/home/vincent/site", Path::new("/home/vincent/site/sass/print.scss") - ) + ), + ( + (ChangeKind::Config, "/config.toml".to_string()), + "/home/vincent/site", Path::new("/home/vincent/site/config.toml") + ), ]; for (expected, pwd, path) in test_cases { diff --git a/src/main.rs b/src/main.rs index adefc3e2..253561d8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,7 @@ extern crate mount; extern crate notify; extern crate url; extern crate ws; +extern crate ctrlc; extern crate site; #[macro_use] @@ -43,7 +44,8 @@ fn main() { ("build", Some(matches)) => { console::info("Building site..."); let start = Instant::now(); - match cmd::build(config_file, matches.value_of("base_url")) { + let output_dir = matches.value_of("output_dir").unwrap(); + match cmd::build(config_file, matches.value_of("base_url"), output_dir) { Ok(()) => console::report_elapsed_time(start), Err(e) => { console::unravel_errors("Failed to build the site", &e); @@ -54,8 +56,9 @@ fn main() { ("serve", Some(matches)) => { let interface = matches.value_of("interface").unwrap_or("127.0.0.1"); let port = matches.value_of("port").unwrap_or("1111"); + let output_dir = matches.value_of("output_dir").unwrap(); console::info("Building site..."); - match cmd::serve(interface, port, config_file) { + match cmd::serve(interface, port, output_dir, config_file) { Ok(()) => (), Err(e) => { console::unravel_errors("", &e); diff --git a/src/rebuild.rs b/src/rebuild.rs index 112f40e7..dea923cf 100644 --- a/src/rebuild.rs +++ b/src/rebuild.rs @@ -1,4 +1,4 @@ -use std::path::Path; +use std::path::{Path, Component}; use errors::Result; use site::Site; @@ -231,8 +231,9 @@ pub fn after_content_change(site: &mut Site, path: &Path) -> Result<()> { /// What happens when a template is changed pub fn after_template_change(site: &mut Site, path: &Path) -> Result<()> { site.tera.full_reload()?; + let filename = path.file_name().unwrap().to_str().unwrap(); - match path.file_name().unwrap().to_str().unwrap() { + match filename { "sitemap.xml" => site.render_sitemap(), "rss.xml" => site.render_rss_feed(), "robots.txt" => site.render_robots(), @@ -247,6 +248,14 @@ pub fn after_template_change(site: &mut Site, path: &Path) -> Result<()> { // We can't really know what this change affects so rebuild all // the things _ => { + // If we are updating a shortcode, re-render the markdown of all pages/site + // because we have no clue which one needs rebuilding + // TODO: look if there the shortcode is used in the markdown instead of re-rendering + // everything + if path.components().collect::>().contains(&Component::Normal("shortcodes".as_ref())) { + site.render_markdown()?; + } + site.populate_sections(); site.render_sections()?; site.render_orphan_pages()?; site.render_categories()?; diff --git a/sublime_syntaxes/Elixir.sublime-syntax b/sublime_syntaxes/Elixir.sublime-syntax index e2aa9711..2a3437e2 100644 --- a/sublime_syntaxes/Elixir.sublime-syntax +++ b/sublime_syntaxes/Elixir.sublime-syntax @@ -25,7 +25,7 @@ contexts: captures: 1: keyword.operator.other.elixir 2: keyword.control.elixir - 3: punctuation.definition.parameters.elixir + 3: punctuation.section.function.elixir pop: true - include: core_syntax - include: core_syntax @@ -37,7 +37,7 @@ contexts: captures: 1: keyword.operator.other.elixir 2: keyword.control.elixir - 3: punctuation.definition.parameters.elixir + 3: punctuation.section.function.elixir pop: true - include: core_syntax core_syntax: @@ -78,7 +78,7 @@ contexts: captures: 1: keyword.control.module.elixir 2: entity.name.function.public.elixir - 4: punctuation.definition.parameters.elixir + 4: punctuation.section.function.elixir push: - meta_scope: meta.function.public.elixir - match: (\bdo:)|(\bdo\b)|(?=\s+(def|defmacro)\b) @@ -100,7 +100,7 @@ contexts: captures: 1: keyword.control.module.elixir 2: entity.name.function.private.elixir - 4: punctuation.definition.parameters.elixir + 4: punctuation.section.function.elixir push: - meta_scope: meta.function.private.elixir - match: (\bdo:)|(\bdo\b)|(?=\s+(defp|defmacrop)\b) @@ -157,18 +157,6 @@ contexts: pop: true - include: interpolated_elixir - include: escaped_char - - match: (::) - captures: - 0: punctuation.binary.elixir - push: - - match: (,|>>|$) - captures: - 0: punctuation.binary.elixir - pop: true - - match: '\b[a-z]\w*\b' - scope: support.type.binary.elixir - - match: '\b(0x[0-9A-Fa-f](?>_?[0-9A-Fa-f])*|\d(?>_?\d)*(\.(?![^[:space:][:digit:]])(?>_?\d)*)?([eE][-+]?\d(?>_?\d)*)?|0b[01]+|0o[0-7]+)\b' - scope: constant.numeric.elixir - match: '(? + scope: keyword.operator.concatenation.elixir + - match: \|\>|<~>|<>|<<<|>>>|~>>|<<~|~>|<~|<\|> + scope: keyword.operator.sigils_1.elixir + - match: "&&&|&&" + scope: keyword.operator.sigils_2.elixir + - match: <\-|\\\\ + scope: keyword.operator.sigils_3.elixir - match: "===?|!==?|<=?|>=?" scope: keyword.operator.comparison.elixir - match: (\|\|\||&&&|^^^|<<<|>>>|~~~) diff --git a/sublime_syntaxes/Elm.sublime-syntax b/sublime_syntaxes/Elm.sublime-syntax deleted file mode 100644 index 9e9eb663..00000000 --- a/sublime_syntaxes/Elm.sublime-syntax +++ /dev/null @@ -1,200 +0,0 @@ -%YAML 1.2 ---- -# http://www.sublimetext.com/docs/3/syntax.html -name: Elm -file_extensions: - - elm -scope: source.elm -contexts: - main: - - match: "(`)[a-zA-Z_']*?(`)" - scope: keyword.operator.function.infix.elm - captures: - 1: punctuation.definition.entity.elm - 2: punctuation.definition.entity.elm - - match: \(\) - scope: constant.language.unit.elm - - match: ^\b((effect|port)\s+)?(module)\s+ - captures: - 1: keyword.other.elm - 3: keyword.other.elm - push: - - meta_scope: meta.declaration.module.elm - - match: $|; - captures: - 1: keyword.other.elm - pop: true - - include: module_name - - match: '(where)\s*\{' - captures: - 1: keyword.other.elm - push: - - match: '\}' - pop: true - - include: type_signature - - match: (exposing) - scope: keyword.other.elm - - include: module_exports - - match: (where) - scope: keyword.other.elm - - match: "[a-z]+" - scope: invalid - - match: ^\b(import)\s+((open)\s+)? - captures: - 1: keyword.other.elm - 3: invalid - push: - - meta_scope: meta.import.elm - - match: ($|;) - pop: true - - match: (as|exposing) - scope: keyword.import.elm - - include: module_name - - include: module_exports - - match: '(\[)(glsl)(\|)' - captures: - 1: keyword.other.elm - 2: support.function.prelude.elm - 3: keyword.other.elm - push: - - meta_scope: entity.glsl.elm - - match: '(\|\])' - captures: - 1: keyword.other.elm - pop: true - - include: scope:source.glsl - - match: \b(type alias|type|case|of|let|in|as)\s+ - scope: keyword.other.elm - - match: \b(if|then|else)\s+ - scope: keyword.control.elm - - match: '\b([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\b' - comment: Floats are always decimal - scope: constant.numeric.float.elm - - match: '\b([0-9]+)\b' - scope: constant.numeric.elm - - match: '"""' - captures: - 0: punctuation.definition.string.begin.elm - push: - - meta_scope: string.quoted.double.elm - - match: '"""' - captures: - 0: punctuation.definition.string.end.elm - pop: true - - match: '\\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\''\&])' - scope: constant.character.escape.elm - - match: '\^[A-Z@\[\]\\\^_]' - scope: constant.character.escape.control.elm - - match: '"' - captures: - 0: punctuation.definition.string.begin.elm - push: - - meta_scope: string.quoted.double.elm - - match: '"' - captures: - 0: punctuation.definition.string.end.elm - pop: true - - match: '\\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\"''\&])' - scope: constant.character.escape.elm - - match: '\^[A-Z@\[\]\\\^_]' - scope: constant.character.escape.control.elm - - match: |- - (?x) - (') - (?: - [\ -\[\]-~] # Basic Char - | (\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE - |DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS - |US|SP|DEL|[abfnrtv\\\"'\&])) # Escapes - | (\^[A-Z@\[\]\\\^_]) # Control Chars - ) - (') - scope: string.quoted.single.elm - captures: - 1: punctuation.definition.string.begin.elm - 2: constant.character.escape.elm - 3: punctuation.definition.string.end.elm - - match: '^(port\s+)?([a-z_][a-zA-Z0-9_'']*|\([|!%$+\-.,=]+\))\s*((:)([:]+)?)' - captures: - 1: keyword.other.port.elm - 2: entity.name.function.elm - 4: keyword.other.colon.elm - 5: invalid - push: - - meta_scope: meta.function.type-declaration.elm - - match: $\n? - pop: true - - include: type_signature - - match: \bport\s+ - scope: keyword.other.port.elm - - match: '\b[A-Z]\w*\b' - scope: constant.other.elm - - include: comments - - match: '^[a-z][A-Za-z0-9_'']*\s+' - scope: entity.name.function.elm - - include: infix_op - - match: '[|!%$?~+:\-.=&\\*^]+' - scope: keyword.operator.elm - - match: '([\[\]\{\},])' - scope: constant.language.delimiter.elm - captures: - 1: support.function.delimiter.elm - - match: '([\(\)])' - scope: keyword.other.parenthesis.elm - block_comment: - - match: '\{-(?!#)' - captures: - 0: punctuation.definition.comment.elm - push: - - meta_scope: comment.block.elm - - include: block_comment - - match: '-\}' - captures: - 0: punctuation.definition.comment.elm - pop: true - comments: - - match: (--).*$\n? - scope: comment.line.double-dash.elm - captures: - 1: punctuation.definition.comment.elm - - include: block_comment - infix_op: - - match: '(\([|!%$+:\-.=]+\)|\(,+\))' - scope: entity.name.function.infix.elm - module_exports: - - match: \( - push: - - meta_scope: meta.declaration.exports.elm - - match: \) - pop: true - - match: '\b[a-z][a-zA-Z_''0-9]*' - scope: entity.name.function.elm - - match: '\b[A-Z][A-Za-z_''0-9]*' - scope: storage.type.elm - - match: "," - scope: punctuation.separator.comma.elm - - include: infix_op - - match: \(.*?\) - comment: So named because I don't know what to call this. - scope: meta.other.unknown.elm - module_name: - - match: "[A-Z][A-Za-z._']*" - scope: support.other.module.elm - type_signature: - - match: '\(\s*([A-Z][A-Za-z]*)\s+([a-z][A-Za-z_'']*)\)\s*(=>)' - scope: meta.class-constraint.elm - captures: - 1: entity.other.inherited-class.elm - 2: variable.other.generic-type.elm - 3: keyword.other.big-arrow.elm - - match: "->" - scope: keyword.other.arrow.elm - - match: "=>" - scope: keyword.other.big-arrow.elm - - match: '\b[a-z][a-zA-Z0-9_'']*\b' - scope: variable.other.generic-type.elm - - match: '\b[A-Z][a-zA-Z0-9_'']*\b' - scope: storage.type.elm - - match: \(\) - scope: support.constant.unit.elm - - include: comments diff --git a/sublime_syntaxes/Elm.tmLanguage b/sublime_syntaxes/Elm.tmLanguage index 581b9e6f..6f2e5360 160000 --- a/sublime_syntaxes/Elm.tmLanguage +++ b/sublime_syntaxes/Elm.tmLanguage @@ -1 +1 @@ -Subproject commit 581b9e6f5bfdf55e506ac5a2b18422296c375ca2 +Subproject commit 6f2e53603a62663463f95079b308a1c9adbabeec diff --git a/sublime_syntaxes/Julia-sublime b/sublime_syntaxes/Julia-sublime index 3cf94d55..581805e4 160000 --- a/sublime_syntaxes/Julia-sublime +++ b/sublime_syntaxes/Julia-sublime @@ -1 +1 @@ -Subproject commit 3cf94d55b2eafd41461c45570d982eef1d65778c +Subproject commit 581805e47c7af5ab0a880aaef5b27f8c1ccc29aa diff --git a/sublime_syntaxes/LESS-sublime b/sublime_syntaxes/LESS-sublime index ebd4a2f0..df5a2752 160000 --- a/sublime_syntaxes/LESS-sublime +++ b/sublime_syntaxes/LESS-sublime @@ -1 +1 @@ -Subproject commit ebd4a2f049fb61686664a68c8d0f34d83292e07e +Subproject commit df5a27523dd37ebe67ba4c7d36ea162dae95b2c3 diff --git a/sublime_syntaxes/LESS.sublime-syntax b/sublime_syntaxes/LESS.sublime-syntax deleted file mode 100644 index 38cfd307..00000000 --- a/sublime_syntaxes/LESS.sublime-syntax +++ /dev/null @@ -1,326 +0,0 @@ -%YAML 1.2 ---- -# http://www.sublimetext.com/docs/3/syntax.html -name: LESS -comment: LESS -file_extensions: - - less -scope: source.less -contexts: - main: - - include: comment-block - - include: comment-line - - include: less-at-rules - - include: less-declarations - - include: less-variables - - include: less-functions - - include: string-double - - include: string-single - - include: selector - - include: rule-list - - include: less-operators - - include: less-parameters - - include: numeric-values - color-values: - - match: \b(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)\b - comment: http://www.w3.org/TR/CSS21/syndata.html#value-def-color - scope: support.constant.color.w3c-standard-color-name.css - - match: \b(aliceblue|antiquewhite|aquamarine|azure|beige|bisque|blanchedalmond|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|gainsboro|ghostwhite|gold|goldenrod|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|limegreen|linen|magenta|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|oldlace|olivedrab|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|thistle|tomato|turquoise|violet|wheat|whitesmoke|yellowgreen)\b - comment: "These colours are mostly recognised but will not validate. ref: http://www.w3schools.com/css/css_colornames.asp" - scope: support.constant.color.non-standard - - match: (hsla?|rgba?)\s*(\() - captures: - 1: support.function.misc.css - 2: punctuation.section.function.css - push: - - match: (\)) - captures: - 1: punctuation.section.function.css - pop: true - - match: '(?x)\b(0*((1?[0-9]{1,2})|(2([0-4][0-9]|5[0-5])))\s*,\s*){2}(0*((1?[0-9]{1,2})|(2([0-4][0-9]|5[0-5])))\b)(\s*,\s*((0?\.[0-9]+)|[0-1]))?' - scope: constant.other.color.rgb-value.css - - match: '\b([0-9]{1,2}|100)\s*%,\s*([0-9]{1,2}|100)\s*%,\s*([0-9]{1,2}|100)\s*%' - scope: constant.other.color.rgb-percentage.css - - include: numeric-values - comment-block: - - match: /\* - captures: - 0: punctuation.definition.comment.css - push: - - meta_scope: comment.block.css - - match: \*/ - captures: - 0: punctuation.definition.comment.css - pop: true - comment-line: - - match: // - captures: - 0: punctuation.definition.comment.css - push: - - meta_scope: comment.line.double-slash.less - - match: $\n? - captures: - 0: punctuation.definition.comment.css - pop: true - less-at-rules: - - match: ^\s*((@)(?:-(?:webkit|moz|o)-)?(charset|import|namespace|media|page|font-face|keyframes|supports|document)\b) - scope: meta.at-rule.css - captures: - 1: keyword.control.at-rule.css - 2: punctuation.definition.keyword.css - less-data-uri: - - match: (url)(\()(data:) - captures: - 1: support.function.misc.css - 2: punctuation.section.function.css - 3: parameter.less.data-uri comment markup.raw - push: - - meta_content_scope: parameter.less.data-uri comment markup.raw - - match: (\)) - captures: - 1: punctuation.section.function.css - pop: true - - match: (url)(\()("data:) - captures: - 1: support.function.misc.css - 2: punctuation.section.function.css - 3: parameter.less.data-uri comment markup.raw - push: - - meta_content_scope: parameter.less.data-uri comment markup.raw - - match: (?<=")(\)) - captures: - 1: punctuation.section.function.css - pop: true - - match: (url)(\()('data:) - captures: - 1: support.function.misc.css - 2: punctuation.section.function.css - 3: parameter.less.data-uri comment markup.raw - push: - - meta_content_scope: parameter.less.data-uri comment markup.raw - - match: (?<=\')(\)) - captures: - 1: punctuation.section.function.css - pop: true - less-declarations: - - match: '(?>@[a-zA-Z0-9_-][\w-]*+)(?!:)' - scope: variable.other.less - - match: '@[a-zA-Z0-9_-][\w-]*' - scope: variable.declaration.less - less-functions: - - match: '([%a-zA-Z\-\_\d]*)(?=\()' - scope: support.function.less - - match: '([\.#](?![0-9])[a-zA-Z0-9_-]+(?=\())' - captures: - 1: entity.other.attribute-name.class.css entity.other.less.mixin - less-operators: - - match: /|!important|$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|(?([''"])(?:[^\\]|\\.)*?(\6)))))?\s*(\])' - scope: meta.attribute-selector.css - captures: - 1: punctuation.definition.entity.css - 2: entity.other.attribute-name.attribute.css - 3: punctuation.separator.operator.css - 4: string.unquoted.attribute-value.css - 5: string.quoted.double.attribute-value.css - 6: punctuation.definition.string.begin.css - 7: punctuation.definition.string.end.css - string-double: - - match: '"' - captures: - 0: punctuation.definition.string.begin.css - push: - - meta_scope: string.quoted.double.css - - match: '"' - captures: - 0: punctuation.definition.string.end.css - pop: true - - match: \\. - scope: constant.character.escape.css - string-single: - - match: "'" - captures: - 0: punctuation.definition.string.begin.css - push: - - meta_scope: string.quoted.single.css - - match: "'" - captures: - 0: punctuation.definition.string.end.css - pop: true - - match: \\. - scope: constant.character.escape.css diff --git a/sublime_syntaxes/Packages b/sublime_syntaxes/Packages index 928a7a61..ce7af4d6 160000 --- a/sublime_syntaxes/Packages +++ b/sublime_syntaxes/Packages @@ -1 +1 @@ -Subproject commit 928a7a618d99631ea424c45e74fb01d1fb6f6853 +Subproject commit ce7af4d6177d0340230893e49742070ae4143246 diff --git a/sublime_syntaxes/Prolog.sublime-syntax b/sublime_syntaxes/Prolog.sublime-syntax new file mode 100644 index 00000000..06aa619c --- /dev/null +++ b/sublime_syntaxes/Prolog.sublime-syntax @@ -0,0 +1,135 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: SWI-Prolog +comment: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +file_extensions: + - pro +scope: source.prolog +contexts: + main: + - include: comments + - match: (?<=:-)\s* + push: + - meta_scope: meta.clause.body.prolog + - match: (\.) + captures: + 1: keyword.control.clause.bodyend.prolog + pop: true + - include: comments + - include: builtin + - include: controlandkeywords + - include: atom + - include: variable + - include: constants + - match: . + scope: meta.clause.body.prolog + - match: '^\s*([a-z][a-zA-Z0-9_]*)(\(?)(?=.*:-.*)' + captures: + 1: entity.name.function.clause.prolog + 2: punctuation.definition.parameters.begin + push: + - meta_scope: meta.clause.head.prolog + - match: ((\)?))\s*(:-) + captures: + 1: punctuation.definition.parameters.end + 3: keyword.control.clause.bodybegin.prolog + pop: true + - include: atom + - include: variable + - include: constants + - match: '^\s*([a-z][a-zA-Z0-9_]*)(\(?)(?=.*-->.*)' + captures: + 1: entity.name.function.dcg.prolog + 2: punctuation.definition.parameters.begin + push: + - meta_scope: meta.dcg.head.prolog + - match: ((\)?))\s*(-->) + captures: + 1: punctuation.definition.parameters.end + 3: keyword.control.dcg.bodybegin.prolog + pop: true + - include: atom + - include: variable + - include: constants + - match: (?<=-->)\s* + push: + - meta_scope: meta.dcg.body.prolog + - match: (\.) + captures: + 1: keyword.control.dcg.bodyend.prolog + pop: true + - include: comments + - include: controlandkeywords + - include: atom + - include: variable + - include: constants + - match: . + scope: meta.dcg.body.prolog + - match: '^\s*([a-zA-Z][a-zA-Z0-9_]*)(\(?)(?!.*(:-|-->).*)' + captures: + 1: entity.name.function.fact.prolog + 2: punctuation.definition.parameters.begin + push: + - meta_scope: meta.fact.prolog + - match: ((\)?))\s*(\.)(?!\d+) + captures: + 1: punctuation.definition.parameters.end + 3: keyword.control.fact.end.prolog + pop: true + - include: atom + - include: variable + - include: constants + atom: + - match: '(?) + captures: + 1: keyword.control.if.prolog + push: + - meta_scope: meta.if.prolog + - match: (;) + captures: + 1: keyword.control.else.prolog + pop: true + - include: main + - include: builtin + - include: comments + - include: atom + - include: variable + - match: . + scope: meta.if.body.prolog + - match: "!" + scope: keyword.control.cut.prolog + - match: (\s(is)\s)|=:=|=?\\?=|\\\+|@?>|@?=?<|\+|\*|\- + scope: keyword.operator.prolog + variable: + - match: "(?)' + - match: '(?:(?)' scope: meta.arrow.ts captures: 1: storage.modifier.async.ts 2: variable.parameter.ts - match: |- (?x) (?: - (? is on new line - ( - [(]\s* - ( - ([)]\s*:) | # (): - ([_$[:alpha:]][_$[:alnum:]]*\s*:) | # [(]param: - (\.\.\.) # [(]... - ) - ) | - ( - [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends - ) | - # arrow function possible to detect only with => on same line - ( - (<([^<>]|\<[^<>]+\>)+>\s*)? # typeparameters - \(([^()]|\([^()]*\))*\) # parameteres - (\s*:\s*(.)*)? # return type - \s*=> # arrow operator - ) + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) ) ) captures: 1: storage.modifier.async.ts push: - meta_scope: meta.arrow.ts - - match: '(?==>|\{)' + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' pop: true - include: comment - include: type-parameters @@ -131,7 +130,7 @@ contexts: 0: storage.type.function.arrow.ts push: - meta_scope: meta.arrow.ts - - match: '(?<=\})|((?!\{)(?=\S))' + - match: '(?<=\}|\S)(?)|((?!\{)(?=\S))' pop: true - include: decl-block - include: expression @@ -141,18 +140,13 @@ contexts: 1: keyword.operator.type.annotation.ts push: - meta_scope: meta.return.type.arrow.ts - - match: '(?==>|\{)' + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' pop: true - - match: '(?<=:)\s*(\{)' - captures: - 1: punctuation.definition.block.ts + - match: '(?<=[:])(?=\s*\{)' push: - - meta_scope: meta.object.type.ts - - match: '\}' - captures: - 0: punctuation.definition.block.ts + - match: '(?<=\})' pop: true - - include: type-object-members + - include: type-object - include: type-predicate-operator - include: type binding-element: @@ -162,32 +156,70 @@ contexts: - include: destructuring-variable-rest - include: variable-initializer boolean-literal: - - match: (?*]))\s*(<)(?!*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?! + - match: (\>)\s* captures: - 0: meta.brace.angle.ts + 1: meta.brace.angle.ts pop: true - include: type + - match: '(?:(?<=^))\s*(<)(?=[_$[:alpha:]][_$[:alnum:]]*\s*>)' + captures: + 1: meta.brace.angle.ts + push: + - meta_scope: cast.expr.ts + - match: (\>)\s* + captures: + 1: meta.brace.angle.ts + pop: true + - include: type + class-declaration: + - match: '(?\s*$)' + - match: '^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|name)\s*=\s*((\''([^\''\\]|\\\''|\\)*\'')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/>\s*$)' captures: 1: punctuation.definition.comment.ts push: - meta_scope: comment.line.triple-slash.directive.ts - - match: (?=$) + - match: (?=^) pop: true - match: (<)(reference|amd-dependency|amd-module) captures: @@ -374,270 +389,251 @@ contexts: - include: string docblock: - match: |- - (?x)(?*/] + (?:[^@<>*/]|\*[^/])* + ) (?: - { - ( - @ - (?: link # Name of tag - | linkcode - | linkplain - | tutorial - ) - ) - - \s+ - - ([^\s|}]+) # Namepath or URL - - (?: # Optional link text following link target - [\s|] # Bar or space separating target and text - [^}]* # Actual text - )? - } - ) - scope: other.meta.jsdoc + \s* + (<) + ([^>\s]+) + (>) + )? captures: - 0: entity.name.type.instance.jsdoc - 1: constant.other.description.jsdoc - 2: storage.type.class.jsdoc - 3: variable.other.description.jsdoc + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + 4: punctuation.definition.bracket.angle.begin.jsdoc + 5: constant.other.email.link.underline.jsdoc + 6: punctuation.definition.bracket.angle.end.jsdoc - match: |- (?x) - - (?:(?<=@param)|(?<=@arg)|(?<=@argument)|(?<=@type)|(?<=@property)|(?<=@prop)) - + ((@)borrows) \s+ + ((?:[^@\s*/]|\*[^/])+) # + \s+ (as) \s+ # as + ((?:[^@\s*/]|\*[^/])+) # + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + 4: keyword.operator.control.jsdoc + 5: entity.name.type.instance.jsdoc + - match: ((@)example)\s+ + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - meta_scope: meta.example.jsdoc + - match: (?=@|\*/) + pop: true + - match: ^\s\*\s+ + - match: \G(<)caption(>) + captures: + 0: entity.name.tag.inline.jsdoc + 1: punctuation.definition.bracket.angle.begin.jsdoc + 2: punctuation.definition.bracket.angle.end.jsdoc + push: + - meta_content_scope: constant.other.description.jsdoc + - match: ()|(?=\*/) + captures: + 0: entity.name.tag.inline.jsdoc + 1: punctuation.definition.bracket.angle.begin.jsdoc + 2: punctuation.definition.bracket.angle.end.jsdoc + pop: true + - match: '[^\s@*](?:[^*]|\*[^/])*' + captures: + 0: source.embedded.ts + - match: (?x) ((@)kind) \s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \b + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: constant.language.symbol-type.jsdoc + - match: |- + (?x) + ((@)see) \s+ - - ({(?: - \* | # {*} any type - \? | # {?} unknown type - - (?: - (?: # Check for a prefix - \? | # {?string} nullable type - ! | # {!string} non-nullable type - \.{3} # {...string} variable number of parameters - )? - - (?: - (?: - function # {function(string, number)} function type - \s* - \( - \s* - (?: - [a-zA-Z_$][\w$]* - (?: - \s*,\s* - [a-zA-Z_$][\w$]* - )* - )? - \s* - \) - (?: # {function(): string} function return type - \s*:\s* - [a-zA-Z_$][\w$]* - )? - )? - | - (?: - \( # Opening bracket of multiple types with parenthesis {(string|number)} - [a-zA-Z_$]+ - (?: - (?: - [\w$]* - (?:\[\])? # {(string[]|number)} type application, an array of strings or a number - ) | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - (?: - [\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback - [a-zA-Z_$]+ - (?: - (?: - [\w$]* - (?:\[\])? # {(string|number[])} type application, a string or an array of numbers - ) | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - )* - \) | - [a-zA-Z_$]+ - (?: - (?: - [\w$]* - (?:\[\])? # {(string|number[])} type application, a string or an array of numbers - ) | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - (?: - [\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - )* - ) - ) - # Check for suffix - (?:\[\])? # {string[]} type application, an array of strings - =? # {string=} optional parameter + (?: + # URL + ( + (?=https?://) + (?:[^\s*]|\*[^/])+ ) - )}) - + | + # JSDoc namepath + ( + (?! + # Avoid matching bare URIs (also acceptable as links) + https?:// + | + # Avoid matching {@inline tags}; we match those below + (?:\[[^\[\]]*\])? # Possible description [preceding]{@tag} + {@(?:link|linkcode|linkplain|tutorial)\b + ) + # Matched namepath + (?:[^@\s*/]|\*[^/])+ + ) + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.link.underline.jsdoc + 4: entity.name.type.instance.jsdoc + - match: |- + (?x) + ((@)template) \s+ - + # One or more valid identifiers ( - \[ # [foo] optional parameter - \s* - (?: - [a-zA-Z_$][\w$]* - (?: - (?:\[\])? # Foo[].bar properties within an array - \. # Foo.Bar namespaced parameter - [a-zA-Z_$][\w$]* - )* - (?: - \s* - = # [foo=bar] Default parameter value - \s* - [\w$\s]* - )? - ) - \s* - \] | - (?: - [a-zA-Z_$][\w$]* - (?: - (?:\[\])? # Foo[].bar properties within an array - \. # Foo.Bar namespaced parameter - [a-zA-Z_$][\w$]* - )* - )? + [A-Za-z_$] # First character: non-numeric word character + [\w$.\[\]]* # Rest of identifier + (?: # Possible list of additional identifiers + \s* , \s* + [A-Za-z_$] + [\w$.\[\]]* + )* ) - - \s+ - - (?:-\s+)? # optional hyphen before the description - - ((?:(?!\*\/).)*) # The type description captures: - 0: other.meta.jsdoc - 1: entity.name.type.instance.jsdoc - 2: variable.other.jsdoc - 3: other.description.jsdoc + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc - match: |- (?x) - - ({(?: - \* | # {*} any type - \? | # {?} unknown type - - (?: - (?: # Check for a prefix - \? | # {?string} nullable type - ! | # {!string} non-nullable type - \.{3} # {...string} variable number of parameters - )? - + ( + (@) + (?:arg|argument|const|constant|member|namespace|param|var) + ) + \s+ + ( + [A-Za-z_$] + [\w$.\[\]]* + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: '((@)typedef)\s+(?={)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: '(?:[^@\s*/]|\*[^/])+' + scope: entity.name.type.instance.jsdoc + - match: '((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\s+(?={)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: '([A-Za-z_$][\w$.\[\]]*)' + scope: variable.other.jsdoc + - match: |- + (?x) + (\[)\s* + [\w$]+ (?: - (?: - function # {function(string, number)} function type - \s* - \( - \s* - (?: - [a-zA-Z_$][\w$]* - (?: - \s*,\s* - [a-zA-Z_$][\w$]* - )* - )? - \s* - \) - (?: # {function(): string} function return type - \s*:\s* - [a-zA-Z_$][\w$]* - )? - )? - | - (?: - \( # Opening bracket of multiple types with parenthesis {(string|number)} - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - (?: - [\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - )* - \) | - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - (?: - [\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) + (?:\[\])? # Foo[ ].bar properties within an array + \. # Foo.Bar namespaced parameter + [\w$]+ + )* + (?: + \s* + (=) # [foo=bar] Default parameter value + \s* + ( + # The inner regexes are to stop the match early at */ and to not stop at escaped quotes + (?> + "(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted + '(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted + \[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal + (?:(?:\*(?!/))|\s(?!\s*\])|\[.*?(?:\]|(?=\*/))|[^*\s\[\]])* # Everything else )* ) - ) - # Check for suffix - (?:\[\])? # {string[]} type application, an array of strings - =? # {string=} optional parameter - ) - )}) - - \s+ - - (?:-\s+)? # optional hyphen before the description - - ((?:(?!\*\/).)*) # The type description + )? + \s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/)) + scope: variable.other.jsdoc + captures: + 1: punctuation.definition.optional-value.begin.bracket.square.jsdoc + 2: keyword.operator.assignment.jsdoc + 3: source.embedded.ts + 4: punctuation.definition.optional-value.end.bracket.square.jsdoc + 5: invalid.illegal.syntax.jsdoc + - match: |- + (?x) + ( + (@) + (?:define|enum|exception|export|extends|lends|implements|modifies + |namespace|private|protected|returns?|suppress|this|throws|type + |yields?) + ) + \s+(?={) captures: - 0: other.meta.jsdoc - 1: entity.name.type.instance.jsdoc - 2: other.description.jsdoc + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: |- + (?x) + ( + (@) + (?:alias|augments|callback|constructs|emits|event|fires|exports? + |extends|external|function|func|host|lends|listens|interface|memberof!? + |method|module|mixes|mixin|name|requires|see|this|typedef|uses) + ) + \s+ + ( + (?: + [^{}@\s*] | \*[^/] + )+ + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + - match: '((@)(?:default(?:value)?|license|version))\s+(([''''"]))' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + 4: punctuation.definition.string.begin.jsdoc + push: + - meta_content_scope: variable.other.jsdoc + - match: (\3)|(?=$|\*/) + captures: + 0: variable.other.jsdoc + 1: punctuation.definition.string.end.jsdoc + pop: true + - match: '((@)(?:default(?:value)?|license|tutorial|variation|version))\s+([^\s*]+)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: '(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \b' + scope: storage.type.class.jsdoc + captures: + 1: punctuation.definition.block.tag.jsdoc + - include: inline-tags enum-declaration: - - match: '(?) | - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)) - ) | - (:\s*( - (<) | - ([(]\s*( - ([)]) | - (\.\.\.) | - ([_$[:alnum:]]+\s*( - ([:,?=])| - ([)]\s*=>) - )) - ))) + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + ))) scope: meta.definition.property.ts entity.name.function.ts - match: "[_$[:alpha:]][_$[:alnum:]]*" scope: meta.definition.property.ts variable.object.property.ts - match: \? scope: keyword.operator.optional.ts for-loop: - - match: (?]|\<[^<>]+\>)+>\s*)?\()' + - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\))|\<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\)))*\>)*>\s*)?\()' push: - - match: '(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\.\s*)*|(\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()' + - match: '(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\))|\<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\)))*\>)*>\s*)?\()' pop: true - - include: literal - - include: support-objects - - include: object-identifiers - - include: punctuation-accessor - - match: "([_$[:alpha:]][_$[:alnum:]]*)" - scope: entity.name.function.ts + - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))' + push: + - meta_scope: meta.function-call.ts + - match: '(?=\s*(\?\.\s*)?(<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\))|\<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\)))*\>)*>\s*)?\()' + pop: true + - include: literal + - include: support-objects + - include: object-identifiers + - include: punctuation-accessor + - match: '(?:(?)| - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))) + (?x)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + )) captures: 1: punctuation.accessor.ts - 2: entity.name.function.ts - - match: '(\.)\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])' + 2: punctuation.accessor.optional.ts + 3: entity.name.function.ts + - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])' captures: 1: punctuation.accessor.ts - 2: variable.other.constant.property.ts - - match: '(\.)\s*([_$[:alpha:]][_$[:alnum:]]*)' + 2: punctuation.accessor.optional.ts + 3: variable.other.constant.property.ts + - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([_$[:alpha:]][_$[:alnum:]]*)' captures: 1: punctuation.accessor.ts - 2: variable.other.property.ts + 2: punctuation.accessor.optional.ts + 3: variable.other.property.ts - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" scope: variable.other.constant.ts - match: "[_$[:alpha:]][_$[:alnum:]]*" scope: variable.other.readwrite.ts import-declaration: - - match: (?)| - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)))) + (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(?=:\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + ))) + scope: meta.object.member.ts captures: 0: meta.object-literal.key.ts 1: entity.name.function.ts - 2: punctuation.separator.key-value.ts - push: - - meta_scope: meta.object.member.ts - - match: '(?=,|\})' - pop: true - - include: expression - - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(:)' + - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=:)' + scope: meta.object.member.ts captures: 0: meta.object-literal.key.ts - 1: punctuation.separator.key-value.ts - push: - - meta_scope: meta.object.member.ts - - match: '(?=,|\})' - pop: true - - include: expression - match: \.\.\. captures: 0: keyword.operator.spread.ts @@ -1289,6 +1410,20 @@ contexts: scope: meta.object.member.ts captures: 1: variable.other.readwrite.ts + - match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)' + push: + - meta_scope: meta.object.member.ts + - match: '(?=,|\}|$)' + pop: true + - include: expression + - match: ":" + captures: + 0: meta.object-literal.key.ts punctuation.separator.key-value.ts + push: + - meta_scope: meta.object.member.ts + - match: '(?=,|\})' + pop: true + - include: expression - include: punctuation-comma parameter-array-binding-pattern: - match: '(?:(\.\.\.)\s*)?(\[)' @@ -1313,42 +1448,63 @@ contexts: captures: 1: storage.modifier.ts - match: |- - (?x)(?:\s*\b(public|private|protected|readonly)\s+)?(\.\.\.)?\s*(?) | - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)) - ) | - (:\s*( - (<) | - ([(]\s*( - ([)]) | - (\.\.\.) | - ([_$[:alnum:]]+\s*( - ([:,?=])| - ([)]\s*=>) - )) - ))) + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + ))) captures: 1: storage.modifier.ts 2: keyword.operator.rest.ts - 3: entity.name.function.ts - 4: keyword.operator.optional.ts - - match: '(?:\s*\b(public|private|protected|readonly)\s+)?(\.\.\.)?\s*(?|&&|\|\||\*\/)\s*(/)(?![/*])(?=(?:[^/\\\[]|\\.|\[([^\]\\]|\\.)+\])+/(?![/*])[gimy]*(?!\s*[a-zA-Z0-9_$]))' + - match: '(?<=[=(:,\[?+!]|return|case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))' captures: 1: punctuation.definition.string.begin.ts push: @@ -1428,7 +1586,7 @@ contexts: 2: keyword.other.ts pop: true - include: regexp - - match: '(?]|\<[^<>]+\>)+>\s*)?\() + |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)?\() captures: 1: punctuation.accessor.ts - 2: support.constant.dom.ts - 3: support.variable.property.dom.ts + 2: punctuation.accessor.optional.ts + 3: support.constant.dom.ts + 4: support.variable.property.dom.ts - match: |- - (?x)(?])|(?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)' - pop: true - - include: comment - - include: type - type-builtin-literals: - - match: (?])|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))' + pop: true + - include: type + - match: (:) + captures: + 1: keyword.operator.type.annotation.ts + push: + - meta_scope: meta.type.annotation.ts + - match: '(?])|(?=^\s*$)|((?<=\S)(?=\s*$))|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))' + pop: true + - include: type + type-builtin-literals: + - match: '(?)(?=\s*\S) + captures: + 1: storage.type.function.arrow.ts + push: + - meta_scope: meta.type.function.return.ts + - match: '(?)(?]|//|$)' + pop: true + - include: type-function-return-type-core - match: "=>" captures: 0: storage.type.function.arrow.ts push: - meta_scope: meta.type.function.return.ts - - match: '(?)(?=[,\]\)\{\}=;>]|//|$)' + - match: '(?)(?]|//|^\s*$)|((?<=\S)(?=\s*$)))' pop: true - - include: comment - - match: '(?<==>)\s*(\{)' - captures: - 1: punctuation.definition.block.ts - push: - - meta_scope: meta.object.type.ts - - match: '\}' - captures: - 0: punctuation.definition.block.ts - pop: true - - include: type-object-members - - include: type-predicate-operator - - include: type + - include: type-function-return-type-core + type-function-return-type-core: + - include: comment + - match: '(?<==>)(?=\s*\{)' + push: + - match: '(?<=\})' + pop: true + - include: type-object + - include: type-predicate-operator + - include: type type-name: - - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)' + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))' captures: 1: entity.name.type.module.ts 2: punctuation.accessor.ts + 3: punctuation.accessor.optional.ts - match: "[_$[:alpha:]][_$[:alnum:]]*" scope: entity.name.type.ts type-object: @@ -1981,29 +2169,38 @@ contexts: captures: 0: punctuation.definition.block.ts pop: true - - include: type-object-members - type-object-members: - - include: comment - - include: method-declaration - - include: indexer-declaration - - include: indexer-mapped-type-declaration - - include: field-declaration - - include: type-annotation - - match: \.\.\. - captures: - 0: keyword.operator.spread.ts - push: - - match: '(?=\}|;|,|$)|(?<=\})' - pop: true + - include: comment + - include: method-declaration + - include: indexer-declaration + - include: indexer-mapped-type-declaration + - include: field-declaration + - include: type-annotation + - match: \.\.\. + captures: + 0: keyword.operator.spread.ts + push: + - match: '(?=\}|;|,|$)|(?<=\})' + pop: true + - include: type + - include: punctuation-comma + - include: punctuation-semicolon - include: type - - include: punctuation-comma - - include: punctuation-semicolon - - include: type type-operators: - include: typeof-operator + - match: '([&|])(?=\s*\{)' + captures: + 0: keyword.operator.type.ts + push: + - match: '(?<=\})' + pop: true + - include: type-object - match: "[&|]" - scope: keyword.operator.type.ts - - match: (?) + - match: (>) captures: 1: punctuation.definition.typeparameters.end.ts pop: true - include: comment - - match: (?) scope: keyword.operator.assignment.ts @@ -2035,10 +2232,10 @@ contexts: - include: type - include: function-parameters type-predicate-operator: - - match: (?) | - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)) - ) | - (:\s*( - (<) | - ([(]\s*( - ([)]) | - (\.\.\.) | - ([_$[:alnum:]]+\s*( - ([:,?=])| - ([)]\s*=>) - )) - ))) + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + ))) captures: 1: meta.definition.variable.ts entity.name.function.ts push: - meta_scope: meta.var-single-variable.expr.ts - - match: '(?=$|[;,=}]|(\s+(of|in)\s+))' + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' pop: true - include: var-single-variable-type-annotation - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" @@ -2108,7 +2334,7 @@ contexts: 1: meta.definition.variable.ts variable.other.constant.ts push: - meta_scope: meta.var-single-variable.expr.ts - - match: '(?=$|[;,=}]|(\s+(of|in)\s+))' + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' pop: true - include: var-single-variable-type-annotation - match: "([_$[:alpha:]][_$[:alnum:]]*)" @@ -2116,7 +2342,7 @@ contexts: 1: meta.definition.variable.ts variable.other.readwrite.ts push: - meta_scope: meta.var-single-variable.expr.ts - - match: '(?=$|[;,=}]|(\s+(of|in)\s+))' + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' pop: true - include: var-single-variable-type-annotation var-single-variable-type-annotation: @@ -2128,13 +2354,13 @@ contexts: captures: 1: keyword.operator.assignment.ts push: - - match: '(?=$|[,);}\]])' + - match: '(?=$|^|[,);}\]])' pop: true - include: expression - match: (?)' + - match: '(?:(?)' scope: meta.arrow.tsx captures: 1: storage.modifier.async.tsx 2: variable.parameter.tsx - match: |- (?x) (?: - (? is on new line - ( - [(]\s* - ( - ([)]\s*:) | # (): - ([_$[:alpha:]][_$[:alnum:]]*\s*:) | # [(]param: - (\.\.\.) # [(]... - ) - ) | - ( - [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends - ) | - # arrow function possible to detect only with => on same line - ( - (<([^<>]|\<[^<>]+\>)+>\s*)? # typeparameters - \(([^()]|\([^()]*\))*\) # parameteres - (\s*:\s*(.)*)? # return type - \s*=> # arrow operator - ) + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) ) ) captures: 1: storage.modifier.async.tsx push: - meta_scope: meta.arrow.tsx - - match: '(?==>|\{)' + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' pop: true - include: comment - include: type-parameters @@ -131,7 +130,7 @@ contexts: 0: storage.type.function.arrow.tsx push: - meta_scope: meta.arrow.tsx - - match: '(?<=\})|((?!\{)(?=\S))' + - match: '(?<=\}|\S)(?)|((?!\{)(?=\S))' pop: true - include: decl-block - include: expression @@ -141,18 +140,13 @@ contexts: 1: keyword.operator.type.annotation.tsx push: - meta_scope: meta.return.type.arrow.tsx - - match: '(?==>|\{)' + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' pop: true - - match: '(?<=:)\s*(\{)' - captures: - 1: punctuation.definition.block.tsx + - match: '(?<=[:])(?=\s*\{)' push: - - meta_scope: meta.object.type.tsx - - match: '\}' - captures: - 0: punctuation.definition.block.tsx + - match: '(?<=\})' pop: true - - include: type-object-members + - include: type-object - include: type-predicate-operator - include: type binding-element: @@ -162,23 +156,51 @@ contexts: - include: destructuring-variable-rest - include: variable-initializer boolean-literal: - - match: (?\s*$)' + - match: '^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|name)\s*=\s*((\''([^\''\\]|\\\''|\\)*\'')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/>\s*$)' captures: 1: punctuation.definition.comment.tsx push: - meta_scope: comment.line.triple-slash.directive.tsx - - match: (?=$) + - match: (?=^) pop: true - match: (<)(reference|amd-dependency|amd-module) captures: @@ -365,270 +370,251 @@ contexts: - include: string docblock: - match: |- - (?x)(?*/] + (?:[^@<>*/]|\*[^/])* + ) (?: - { - ( - @ - (?: link # Name of tag - | linkcode - | linkplain - | tutorial - ) - ) - - \s+ - - ([^\s|}]+) # Namepath or URL - - (?: # Optional link text following link target - [\s|] # Bar or space separating target and text - [^}]* # Actual text - )? - } - ) - scope: other.meta.jsdoc + \s* + (<) + ([^>\s]+) + (>) + )? captures: - 0: entity.name.type.instance.jsdoc - 1: constant.other.description.jsdoc - 2: storage.type.class.jsdoc - 3: variable.other.description.jsdoc + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + 4: punctuation.definition.bracket.angle.begin.jsdoc + 5: constant.other.email.link.underline.jsdoc + 6: punctuation.definition.bracket.angle.end.jsdoc - match: |- (?x) - - (?:(?<=@param)|(?<=@arg)|(?<=@argument)|(?<=@type)|(?<=@property)|(?<=@prop)) - + ((@)borrows) \s+ + ((?:[^@\s*/]|\*[^/])+) # + \s+ (as) \s+ # as + ((?:[^@\s*/]|\*[^/])+) # + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + 4: keyword.operator.control.jsdoc + 5: entity.name.type.instance.jsdoc + - match: ((@)example)\s+ + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - meta_scope: meta.example.jsdoc + - match: (?=@|\*/) + pop: true + - match: ^\s\*\s+ + - match: \G(<)caption(>) + captures: + 0: entity.name.tag.inline.jsdoc + 1: punctuation.definition.bracket.angle.begin.jsdoc + 2: punctuation.definition.bracket.angle.end.jsdoc + push: + - meta_content_scope: constant.other.description.jsdoc + - match: ()|(?=\*/) + captures: + 0: entity.name.tag.inline.jsdoc + 1: punctuation.definition.bracket.angle.begin.jsdoc + 2: punctuation.definition.bracket.angle.end.jsdoc + pop: true + - match: '[^\s@*](?:[^*]|\*[^/])*' + captures: + 0: source.embedded.tsx + - match: (?x) ((@)kind) \s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \b + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: constant.language.symbol-type.jsdoc + - match: |- + (?x) + ((@)see) \s+ - - ({(?: - \* | # {*} any type - \? | # {?} unknown type - - (?: - (?: # Check for a prefix - \? | # {?string} nullable type - ! | # {!string} non-nullable type - \.{3} # {...string} variable number of parameters - )? - - (?: - (?: - function # {function(string, number)} function type - \s* - \( - \s* - (?: - [a-zA-Z_$][\w$]* - (?: - \s*,\s* - [a-zA-Z_$][\w$]* - )* - )? - \s* - \) - (?: # {function(): string} function return type - \s*:\s* - [a-zA-Z_$][\w$]* - )? - )? - | - (?: - \( # Opening bracket of multiple types with parenthesis {(string|number)} - [a-zA-Z_$]+ - (?: - (?: - [\w$]* - (?:\[\])? # {(string[]|number)} type application, an array of strings or a number - ) | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - (?: - [\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback - [a-zA-Z_$]+ - (?: - (?: - [\w$]* - (?:\[\])? # {(string|number[])} type application, a string or an array of numbers - ) | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - )* - \) | - [a-zA-Z_$]+ - (?: - (?: - [\w$]* - (?:\[\])? # {(string|number[])} type application, a string or an array of numbers - ) | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - (?: - [\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - )* - ) - ) - # Check for suffix - (?:\[\])? # {string[]} type application, an array of strings - =? # {string=} optional parameter + (?: + # URL + ( + (?=https?://) + (?:[^\s*]|\*[^/])+ ) - )}) - + | + # JSDoc namepath + ( + (?! + # Avoid matching bare URIs (also acceptable as links) + https?:// + | + # Avoid matching {@inline tags}; we match those below + (?:\[[^\[\]]*\])? # Possible description [preceding]{@tag} + {@(?:link|linkcode|linkplain|tutorial)\b + ) + # Matched namepath + (?:[^@\s*/]|\*[^/])+ + ) + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.link.underline.jsdoc + 4: entity.name.type.instance.jsdoc + - match: |- + (?x) + ((@)template) \s+ - + # One or more valid identifiers ( - \[ # [foo] optional parameter - \s* - (?: - [a-zA-Z_$][\w$]* - (?: - (?:\[\])? # Foo[].bar properties within an array - \. # Foo.Bar namespaced parameter - [a-zA-Z_$][\w$]* - )* - (?: - \s* - = # [foo=bar] Default parameter value - \s* - [\w$\s]* - )? - ) - \s* - \] | - (?: - [a-zA-Z_$][\w$]* - (?: - (?:\[\])? # Foo[].bar properties within an array - \. # Foo.Bar namespaced parameter - [a-zA-Z_$][\w$]* - )* - )? + [A-Za-z_$] # First character: non-numeric word character + [\w$.\[\]]* # Rest of identifier + (?: # Possible list of additional identifiers + \s* , \s* + [A-Za-z_$] + [\w$.\[\]]* + )* ) - - \s+ - - (?:-\s+)? # optional hyphen before the description - - ((?:(?!\*\/).)*) # The type description captures: - 0: other.meta.jsdoc - 1: entity.name.type.instance.jsdoc - 2: variable.other.jsdoc - 3: other.description.jsdoc + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc - match: |- (?x) - - ({(?: - \* | # {*} any type - \? | # {?} unknown type - - (?: - (?: # Check for a prefix - \? | # {?string} nullable type - ! | # {!string} non-nullable type - \.{3} # {...string} variable number of parameters - )? - + ( + (@) + (?:arg|argument|const|constant|member|namespace|param|var) + ) + \s+ + ( + [A-Za-z_$] + [\w$.\[\]]* + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: '((@)typedef)\s+(?={)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: '(?:[^@\s*/]|\*[^/])+' + scope: entity.name.type.instance.jsdoc + - match: '((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\s+(?={)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: '([A-Za-z_$][\w$.\[\]]*)' + scope: variable.other.jsdoc + - match: |- + (?x) + (\[)\s* + [\w$]+ (?: - (?: - function # {function(string, number)} function type - \s* - \( - \s* - (?: - [a-zA-Z_$][\w$]* - (?: - \s*,\s* - [a-zA-Z_$][\w$]* - )* - )? - \s* - \) - (?: # {function(): string} function return type - \s*:\s* - [a-zA-Z_$][\w$]* - )? - )? - | - (?: - \( # Opening bracket of multiple types with parenthesis {(string|number)} - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - (?: - [\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - )* - \) | - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) - (?: - [\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback - [a-zA-Z_$]+ - (?: - [\w$]* | - \.?<[\w$]+(?:,\s+[\w$]+)*> # {Array} or {Object} type application (optional .) - ) + (?:\[\])? # Foo[ ].bar properties within an array + \. # Foo.Bar namespaced parameter + [\w$]+ + )* + (?: + \s* + (=) # [foo=bar] Default parameter value + \s* + ( + # The inner regexes are to stop the match early at */ and to not stop at escaped quotes + (?> + "(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted + '(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted + \[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal + (?:(?:\*(?!/))|\s(?!\s*\])|\[.*?(?:\]|(?=\*/))|[^*\s\[\]])* # Everything else )* ) - ) - # Check for suffix - (?:\[\])? # {string[]} type application, an array of strings - =? # {string=} optional parameter - ) - )}) - - \s+ - - (?:-\s+)? # optional hyphen before the description - - ((?:(?!\*\/).)*) # The type description + )? + \s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/)) + scope: variable.other.jsdoc + captures: + 1: punctuation.definition.optional-value.begin.bracket.square.jsdoc + 2: keyword.operator.assignment.jsdoc + 3: source.embedded.tsx + 4: punctuation.definition.optional-value.end.bracket.square.jsdoc + 5: invalid.illegal.syntax.jsdoc + - match: |- + (?x) + ( + (@) + (?:define|enum|exception|export|extends|lends|implements|modifies + |namespace|private|protected|returns?|suppress|this|throws|type + |yields?) + ) + \s+(?={) captures: - 0: other.meta.jsdoc - 1: entity.name.type.instance.jsdoc - 2: other.description.jsdoc + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: |- + (?x) + ( + (@) + (?:alias|augments|callback|constructs|emits|event|fires|exports? + |extends|external|function|func|host|lends|listens|interface|memberof!? + |method|module|mixes|mixin|name|requires|see|this|typedef|uses) + ) + \s+ + ( + (?: + [^{}@\s*] | \*[^/] + )+ + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + - match: '((@)(?:default(?:value)?|license|version))\s+(([''''"]))' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + 4: punctuation.definition.string.begin.jsdoc + push: + - meta_content_scope: variable.other.jsdoc + - match: (\3)|(?=$|\*/) + captures: + 0: variable.other.jsdoc + 1: punctuation.definition.string.end.jsdoc + pop: true + - match: '((@)(?:default(?:value)?|license|tutorial|variation|version))\s+([^\s*]+)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: '(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \b' + scope: storage.type.class.jsdoc + captures: + 1: punctuation.definition.block.tag.jsdoc + - include: inline-tags enum-declaration: - - match: '(?) | - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)) - ) | - (:\s*( - (<) | - ([(]\s*( - ([)]) | - (\.\.\.) | - ([_$[:alnum:]]+\s*( - ([:,?=])| - ([)]\s*=>) - )) - ))) + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + ))) scope: meta.definition.property.tsx entity.name.function.tsx - match: "[_$[:alpha:]][_$[:alnum:]]*" scope: meta.definition.property.tsx variable.object.property.tsx - match: \? scope: keyword.operator.optional.tsx for-loop: - - match: (?]|\<[^<>]+\>)+>\s*)?\()' + - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\))|\<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\)))*\>)*>\s*)?\()' push: - - match: '(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\.\s*)*|(\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()' + - match: '(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\))|\<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\)))*\>)*>\s*)?\()' pop: true - - include: literal - - include: support-objects - - include: object-identifiers - - include: punctuation-accessor - - match: "([_$[:alpha:]][_$[:alnum:]]*)" - scope: entity.name.function.tsx + - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))' + push: + - meta_scope: meta.function-call.tsx + - match: '(?=\s*(\?\.\s*)?(<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\))|\<\s*(([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))([^<>\(]|(\([^\(\)]*\)))*\>)*>\s*)?\()' + pop: true + - include: literal + - include: support-objects + - include: object-identifiers + - include: punctuation-accessor + - match: '(?:(?)| - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))) + (?x)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + )) captures: 1: punctuation.accessor.tsx - 2: entity.name.function.tsx - - match: '(\.)\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])' + 2: punctuation.accessor.optional.tsx + 3: entity.name.function.tsx + - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])' captures: 1: punctuation.accessor.tsx - 2: variable.other.constant.property.tsx - - match: '(\.)\s*([_$[:alpha:]][_$[:alnum:]]*)' + 2: punctuation.accessor.optional.tsx + 3: variable.other.constant.property.tsx + - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([_$[:alpha:]][_$[:alnum:]]*)' captures: 1: punctuation.accessor.tsx - 2: variable.other.property.tsx + 2: punctuation.accessor.optional.tsx + 3: variable.other.property.tsx - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" scope: variable.other.constant.tsx - match: "[_$[:alpha:]][_$[:alnum:]]*" scope: variable.other.readwrite.tsx import-declaration: - - match: (?)) push: - - match: '(/>)|(?:())' + - match: '(/>)|(?:())' captures: 0: meta.tag.tsx 1: punctuation.definition.tag.end.tsx 2: punctuation.definition.tag.begin.tsx 3: entity.name.tag.tsx - 4: punctuation.definition.tag.end.tsx + 4: support.class.component.tsx + 5: punctuation.definition.tag.end.tsx pop: true - include: jsx-tag jsx-children: - include: jsx-tag-without-attributes - include: jsx-child-tag - - include: jsx-tag-invalid - include: jsx-evaluated-code - include: jsx-entities jsx-entities: @@ -1114,12 +1207,14 @@ contexts: - match: |- (?x) (<)\s* - ([_$a-zA-Z][-$\w.]*(?) captures: 1: punctuation.definition.tag.begin.tsx 2: entity.name.tag.tsx + 3: support.class.component.tsx push: + - meta_content_scope: meta.tag.attributes.tsx - match: "(?=[/]?>)" pop: true - include: comment @@ -1157,40 +1252,48 @@ contexts: - match: |- (?x) (?<=[({\[,?=>:*]|&&|\|\||\?|\Wreturn|^return|\Wdefault|^)\s* - (?!(<)\s*([_$a-zA-Z][-$\w.]*(?)) #look ahead is not start of tag without attributes (?!<\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s+[^=>])|,)) # look ahead is not type parameter of arrow (?=(<)\s* ([_$a-zA-Z][-$\w.]*(?)) push: - - match: '(/>)|(?:())' + - match: '(/>)|(?:())' captures: 0: meta.tag.tsx 1: punctuation.definition.tag.end.tsx 2: punctuation.definition.tag.begin.tsx 3: entity.name.tag.tsx - 4: punctuation.definition.tag.end.tsx + 4: support.class.component.tsx + 5: punctuation.definition.tag.end.tsx pop: true - include: jsx-tag - jsx-tag-invalid: - - match: <\s*> - scope: invalid.illegal.tag.incomplete.tsx jsx-tag-without-attributes: - - match: '(<)\s*([_$a-zA-Z][-$\w.]*(?)' + - match: '(<)\s*((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?)' captures: 1: punctuation.definition.tag.begin.tsx 2: entity.name.tag.tsx - 3: punctuation.definition.tag.end.tsx + 3: support.class.component.tsx + 4: punctuation.definition.tag.end.tsx push: - meta_scope: meta.tag.without-attributes.tsx - meta_content_scope: meta.jsx.children.tsx - - match: '()' + - match: '()' captures: 1: punctuation.definition.tag.begin.tsx 2: entity.name.tag.tsx - 3: punctuation.definition.tag.end.tsx + 3: support.class.component.tsx + 4: punctuation.definition.tag.end.tsx pop: true - include: jsx-children + jsx-tag-without-attributes-in-expression: + - match: |- + (?x) + (?<=[({\[,?=>:*]|&&|\|\||\?|\Wreturn|^return|\Wdefault|^)\s* + (?=(<)\s*((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?)) + push: + - match: '(?!\s*(<)\s*((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?))' + pop: true + - include: jsx-tag-without-attributes literal: - include: numeric-literal - include: boolean-literal @@ -1201,27 +1304,35 @@ contexts: - include: this-literal - include: super-literal method-declaration: - - match: '(?)| - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)))) + (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(?=:\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + ))) + scope: meta.object.member.tsx captures: 0: meta.object-literal.key.tsx 1: entity.name.function.tsx - 2: punctuation.separator.key-value.tsx - push: - - meta_scope: meta.object.member.tsx - - match: '(?=,|\})' - pop: true - - include: expression - - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(:)' + - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=:)' + scope: meta.object.member.tsx captures: 0: meta.object-literal.key.tsx - 1: punctuation.separator.key-value.tsx - push: - - meta_scope: meta.object.member.tsx - - match: '(?=,|\})' - pop: true - - include: expression - match: \.\.\. captures: 0: keyword.operator.spread.tsx @@ -1438,6 +1558,20 @@ contexts: scope: meta.object.member.tsx captures: 1: variable.other.readwrite.tsx + - match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)' + push: + - meta_scope: meta.object.member.tsx + - match: '(?=,|\}|$)' + pop: true + - include: expression + - match: ":" + captures: + 0: meta.object-literal.key.tsx punctuation.separator.key-value.tsx + push: + - meta_scope: meta.object.member.tsx + - match: '(?=,|\})' + pop: true + - include: expression - include: punctuation-comma parameter-array-binding-pattern: - match: '(?:(\.\.\.)\s*)?(\[)' @@ -1462,42 +1596,63 @@ contexts: captures: 1: storage.modifier.tsx - match: |- - (?x)(?:\s*\b(public|private|protected|readonly)\s+)?(\.\.\.)?\s*(?) | - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)) - ) | - (:\s*( - (<) | - ([(]\s*( - ([)]) | - (\.\.\.) | - ([_$[:alnum:]]+\s*( - ([:,?=])| - ([)]\s*=>) - )) - ))) + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + ))) captures: 1: storage.modifier.tsx 2: keyword.operator.rest.tsx - 3: entity.name.function.tsx - 4: keyword.operator.optional.tsx - - match: '(?:\s*\b(public|private|protected|readonly)\s+)?(\.\.\.)?\s*(?|&&|\|\||\*\/)\s*(/)(?![/*])(?=(?:[^/\\\[]|\\.|\[([^\]\\]|\\.)+\])+/(?![/*])[gimy]*(?!\s*[a-zA-Z0-9_$]))' + - match: '(?<=[=(:,\[?+!]|return|case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))' captures: 1: punctuation.definition.string.begin.tsx push: @@ -1577,7 +1734,7 @@ contexts: 2: keyword.other.tsx pop: true - include: regexp - - match: '(?]|\<[^<>]+\>)+>\s*)?\() + |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)?\() captures: 1: punctuation.accessor.tsx - 2: support.constant.dom.tsx - 3: support.variable.property.dom.tsx + 2: punctuation.accessor.optional.tsx + 3: support.constant.dom.tsx + 4: support.variable.property.dom.tsx - match: |- - (?x)(?])|(?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)' - pop: true - - include: comment - - include: type - type-builtin-literals: - - match: (?])|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))' + pop: true + - include: type + - match: (:) + captures: + 1: keyword.operator.type.annotation.tsx + push: + - meta_scope: meta.type.annotation.tsx + - match: '(?])|(?=^\s*$)|((?<=\S)(?=\s*$))|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))' + pop: true + - include: type + type-builtin-literals: + - match: '(?)(?=\s*\S) + captures: + 1: storage.type.function.arrow.tsx + push: + - meta_scope: meta.type.function.return.tsx + - match: '(?)(?]|//|$)' + pop: true + - include: type-function-return-type-core - match: "=>" captures: 0: storage.type.function.arrow.tsx push: - meta_scope: meta.type.function.return.tsx - - match: '(?)(?=[,\]\)\{\}=;>]|//|$)' + - match: '(?)(?]|//|^\s*$)|((?<=\S)(?=\s*$)))' pop: true - - include: comment - - match: '(?<==>)\s*(\{)' - captures: - 1: punctuation.definition.block.tsx - push: - - meta_scope: meta.object.type.tsx - - match: '\}' - captures: - 0: punctuation.definition.block.tsx - pop: true - - include: type-object-members - - include: type-predicate-operator - - include: type + - include: type-function-return-type-core + type-function-return-type-core: + - include: comment + - match: '(?<==>)(?=\s*\{)' + push: + - match: '(?<=\})' + pop: true + - include: type-object + - include: type-predicate-operator + - include: type type-name: - - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)' + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))' captures: 1: entity.name.type.module.tsx 2: punctuation.accessor.tsx + 3: punctuation.accessor.optional.tsx - match: "[_$[:alpha:]][_$[:alnum:]]*" scope: entity.name.type.tsx type-object: @@ -2130,29 +2317,38 @@ contexts: captures: 0: punctuation.definition.block.tsx pop: true - - include: type-object-members - type-object-members: - - include: comment - - include: method-declaration - - include: indexer-declaration - - include: indexer-mapped-type-declaration - - include: field-declaration - - include: type-annotation - - match: \.\.\. - captures: - 0: keyword.operator.spread.tsx - push: - - match: '(?=\}|;|,|$)|(?<=\})' - pop: true + - include: comment + - include: method-declaration + - include: indexer-declaration + - include: indexer-mapped-type-declaration + - include: field-declaration + - include: type-annotation + - match: \.\.\. + captures: + 0: keyword.operator.spread.tsx + push: + - match: '(?=\}|;|,|$)|(?<=\})' + pop: true + - include: type + - include: punctuation-comma + - include: punctuation-semicolon - include: type - - include: punctuation-comma - - include: punctuation-semicolon - - include: type type-operators: - include: typeof-operator + - match: '([&|])(?=\s*\{)' + captures: + 0: keyword.operator.type.tsx + push: + - match: '(?<=\})' + pop: true + - include: type-object - match: "[&|]" - scope: keyword.operator.type.tsx - - match: (?) + - match: (>) captures: 1: punctuation.definition.typeparameters.end.tsx pop: true - include: comment - - match: (?) scope: keyword.operator.assignment.tsx @@ -2184,10 +2380,10 @@ contexts: - include: type - include: function-parameters type-predicate-operator: - - match: (?) | - ([(]\s*(([)]\s*:)|([_$[:alpha:]][_$[:alnum:]]*\s*:)|(\.\.\.) )) | - ([<]\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s*[^=>])|(\s*[,]))) | - ((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)) - ) | - (:\s*( - (<) | - ([(]\s*( - ([)]) | - (\.\.\.) | - ([_$[:alnum:]]+\s*( - ([:,?=])| - ([)]\s*=>) - )) - ))) + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + # sure shot arrow functions even if => is on new line + ( + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{[^\{\}]*\})|(\([^\(\)]*\))|(\[[^\[\]]*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + ))) captures: 1: meta.definition.variable.tsx entity.name.function.tsx push: - meta_scope: meta.var-single-variable.expr.tsx - - match: '(?=$|[;,=}]|(\s+(of|in)\s+))' + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' pop: true - include: var-single-variable-type-annotation - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" @@ -2257,7 +2482,7 @@ contexts: 1: meta.definition.variable.tsx variable.other.constant.tsx push: - meta_scope: meta.var-single-variable.expr.tsx - - match: '(?=$|[;,=}]|(\s+(of|in)\s+))' + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' pop: true - include: var-single-variable-type-annotation - match: "([_$[:alpha:]][_$[:alnum:]]*)" @@ -2265,7 +2490,7 @@ contexts: 1: meta.definition.variable.tsx variable.other.readwrite.tsx push: - meta_scope: meta.var-single-variable.expr.tsx - - match: '(?=$|[;,=}]|(\s+(of|in)\s+))' + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' pop: true - include: var-single-variable-type-annotation var-single-variable-type-annotation: @@ -2277,13 +2502,13 @@ contexts: captures: 1: keyword.operator.assignment.tsx push: - - match: '(?=$|[,);}\]])' + - match: '(?=$|^|[,);}\]])' pop: true - include: expression - match: (?