Add Swift, MiniZinc syntax and update the rest
Also fix tests Close #367, #372
This commit is contained in:
parent
ce813fab1b
commit
e0291cec65
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -34,3 +34,6 @@
|
||||||
[submodule "sublime_syntaxes/Sublime-CMakeLists"]
|
[submodule "sublime_syntaxes/Sublime-CMakeLists"]
|
||||||
path = sublime_syntaxes/Sublime-CMakeLists
|
path = sublime_syntaxes/Sublime-CMakeLists
|
||||||
url = https://github.com/zyxar/Sublime-CMakeLists
|
url = https://github.com/zyxar/Sublime-CMakeLists
|
||||||
|
[submodule "sublime_syntaxes/Swift-for-f-ing-sublime"]
|
||||||
|
path = sublime_syntaxes/Swift-for-f-ing-sublime
|
||||||
|
url = git@github.com:colinta/Swift-for-f-ing-sublime.git
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.4.2 (unreleased)
|
||||||
|
|
||||||
|
- Add assets to section indexes
|
||||||
|
- Allow users to add custom highlighting syntaxes
|
||||||
|
- Add Swift, MiniZinc syntaxes and update others
|
||||||
|
|
||||||
## 0.4.1 (2018-08-06)
|
## 0.4.1 (2018-08-06)
|
||||||
|
|
||||||
- Fix live reload of a section content change getting no pages data
|
- Fix live reload of a section content change getting no pages data
|
||||||
|
|
|
@ -90,7 +90,7 @@ $ git submodule update --remote --merge
|
||||||
And finally from the root of the components/highlighting crate run the following command:
|
And finally from the root of the components/highlighting crate run the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ cargo run --example generate_sublime synpack ../../sublime_syntaxes ../../sublime_syntaxes/newlines.packdump ../../sublime_syntaxes/nonewlines.packdump
|
$ cargo run --example generate_sublime synpack ../../sublime_syntaxes ../../sublime_syntaxes/newlines.packdump
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Adding a theme
|
#### Adding a theme
|
||||||
|
|
|
@ -166,7 +166,14 @@ impl Page {
|
||||||
|
|
||||||
/// We need access to all pages url to render links relative to content
|
/// We need access to all pages url to render links relative to content
|
||||||
/// so that can't happen at the same time as parsing
|
/// so that can't happen at the same time as parsing
|
||||||
pub fn render_markdown(&mut self, permalinks: &HashMap<String, String>, tera: &Tera, config: &Config, base_path: &Path, anchor_insert: InsertAnchor) -> Result<()> {
|
pub fn render_markdown(
|
||||||
|
&mut self,
|
||||||
|
permalinks: &HashMap<String, String>,
|
||||||
|
tera: &Tera,
|
||||||
|
config: &Config,
|
||||||
|
base_path: &Path,
|
||||||
|
anchor_insert: InsertAnchor,
|
||||||
|
) -> Result<()> {
|
||||||
let mut context = RenderContext::new(
|
let mut context = RenderContext::new(
|
||||||
tera,
|
tera,
|
||||||
config,
|
config,
|
||||||
|
@ -311,7 +318,13 @@ Hello world"#;
|
||||||
let res = Page::parse(Path::new("post.md"), content, &Config::default());
|
let res = Page::parse(Path::new("post.md"), content, &Config::default());
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let mut page = res.unwrap();
|
let mut page = res.unwrap();
|
||||||
page.render_markdown(&HashMap::default(), &Tera::default(), &Config::default(), InsertAnchor::None).unwrap();
|
page.render_markdown(
|
||||||
|
&HashMap::default(),
|
||||||
|
&Tera::default(),
|
||||||
|
&Config::default(),
|
||||||
|
Path::new("something"),
|
||||||
|
InsertAnchor::None,
|
||||||
|
).unwrap();
|
||||||
|
|
||||||
assert_eq!(page.meta.title.unwrap(), "Hello".to_string());
|
assert_eq!(page.meta.title.unwrap(), "Hello".to_string());
|
||||||
assert_eq!(page.meta.slug.unwrap(), "hello-world".to_string());
|
assert_eq!(page.meta.slug.unwrap(), "hello-world".to_string());
|
||||||
|
@ -417,7 +430,13 @@ Hello world
|
||||||
let res = Page::parse(Path::new("hello.md"), &content, &config);
|
let res = Page::parse(Path::new("hello.md"), &content, &config);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let mut page = res.unwrap();
|
let mut page = res.unwrap();
|
||||||
page.render_markdown(&HashMap::default(), &Tera::default(), &config, InsertAnchor::None).unwrap();
|
page.render_markdown(
|
||||||
|
&HashMap::default(),
|
||||||
|
&Tera::default(),
|
||||||
|
&config,
|
||||||
|
Path::new("something"),
|
||||||
|
InsertAnchor::None,
|
||||||
|
).unwrap();
|
||||||
assert_eq!(page.summary, Some("<p>Hello world</p>\n".to_string()));
|
assert_eq!(page.summary, Some("<p>Hello world</p>\n".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,25 +19,20 @@ fn usage_and_exit() -> ! {
|
||||||
// Check README for more details
|
// Check README for more details
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut args = env::args().skip(1);
|
let mut args = env::args().skip(1);
|
||||||
match (args.next(), args.next(), args.next(), args.next()) {
|
match (args.next(), args.next(), args.next()) {
|
||||||
(Some(ref cmd), Some(ref package_dir), Some(ref packpath_newlines), Some(ref packpath_nonewlines)) if cmd == "synpack" => {
|
(Some(ref cmd), Some(ref package_dir), Some(ref packpath_newlines)) if cmd == "synpack" => {
|
||||||
let mut ps = SyntaxSet::new();
|
let mut ps = SyntaxSet::new();
|
||||||
ps.load_plain_text_syntax();
|
ps.load_plain_text_syntax();
|
||||||
ps.load_syntaxes(package_dir, true).unwrap();
|
ps.load_syntaxes(package_dir, true).unwrap();
|
||||||
dump_to_file(&ps, packpath_newlines).unwrap();
|
dump_to_file(&ps, packpath_newlines).unwrap();
|
||||||
|
|
||||||
ps = SyntaxSet::new();
|
|
||||||
ps.load_plain_text_syntax();
|
|
||||||
ps.load_syntaxes(package_dir, false).unwrap();
|
|
||||||
dump_to_file(&ps, packpath_nonewlines).unwrap();
|
|
||||||
|
|
||||||
for s in ps.syntaxes() {
|
for s in ps.syntaxes() {
|
||||||
if !s.file_extensions.is_empty() {
|
if !s.file_extensions.is_empty() {
|
||||||
println!("- {} -> {:?}", s.name, s.file_extensions);
|
println!("- {} -> {:?}", s.name, s.file_extensions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(Some(ref cmd), Some(ref theme_dir), Some(ref packpath), None) if cmd == "themepack" => {
|
(Some(ref cmd), Some(ref theme_dir), Some(ref packpath)) if cmd == "themepack" => {
|
||||||
let ts = ThemeSet::load_from_folder(theme_dir).unwrap();
|
let ts = ThemeSet::load_from_folder(theme_dir).unwrap();
|
||||||
for path in ts.themes.keys() {
|
for path in ts.themes.keys() {
|
||||||
println!("{:?}", path);
|
println!("{:?}", path);
|
||||||
|
|
|
@ -14,8 +14,7 @@ use syntect::easy::HighlightLines;
|
||||||
thread_local! {
|
thread_local! {
|
||||||
/// A pair of the set and whether extras have been added to it.
|
/// A pair of the set and whether extras have been added to it.
|
||||||
pub static SYNTAX_SET: RefCell<(SyntaxSet, bool)> = {
|
pub static SYNTAX_SET: RefCell<(SyntaxSet, bool)> = {
|
||||||
let mut ss: SyntaxSet = from_binary(include_bytes!("../../../sublime_syntaxes/newlines.packdump"));
|
let ss: SyntaxSet = from_binary(include_bytes!("../../../sublime_syntaxes/newlines.packdump"));
|
||||||
ss.link_syntaxes();
|
|
||||||
RefCell::new((ss, false))
|
RefCell::new((ss, false))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,6 +180,8 @@ pub fn render_shortcodes(content: &str, context: &RenderContext) -> Result<Strin
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
use tera::Tera;
|
use tera::Tera;
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use front_matter::InsertAnchor;
|
use front_matter::InsertAnchor;
|
||||||
|
@ -202,7 +204,7 @@ mod tests {
|
||||||
fn render_shortcodes(code: &str, tera: &Tera) -> String {
|
fn render_shortcodes(code: &str, tera: &Tera) -> String {
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let permalinks = HashMap::new();
|
let permalinks = HashMap::new();
|
||||||
let context = RenderContext::new(&tera, &config, "", &permalinks, InsertAnchor::None);
|
let context = RenderContext::new(&tera, &config, "", &permalinks, Path::new("something"), InsertAnchor::None);
|
||||||
super::render_shortcodes(code, &context).unwrap()
|
super::render_shortcodes(code, &context).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ extern crate rendering;
|
||||||
extern crate config;
|
extern crate config;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
use tera::Tera;
|
use tera::Tera;
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ fn can_do_render_content_simple() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("hello", &context).unwrap();
|
let res = render_content("hello", &context).unwrap();
|
||||||
assert_eq!(res.0, "<p>hello</p>\n");
|
assert_eq!(res.0, "<p>hello</p>\n");
|
||||||
}
|
}
|
||||||
|
@ -30,7 +31,7 @@ fn doesnt_highlight_code_block_with_highlighting_off() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.highlight_code = false;
|
config.highlight_code = false;
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("```\n$ gutenberg server\n```", &context).unwrap();
|
let res = render_content("```\n$ gutenberg server\n```", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -43,7 +44,7 @@ fn can_highlight_code_block_no_lang() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("```\n$ gutenberg server\n$ ping\n```", &context).unwrap();
|
let res = render_content("```\n$ gutenberg server\n$ ping\n```", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -56,7 +57,7 @@ fn can_highlight_code_block_with_lang() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("```python\nlist.append(1)\n```", &context).unwrap();
|
let res = render_content("```python\nlist.append(1)\n```", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -69,7 +70,7 @@ fn can_higlight_code_block_with_unknown_lang() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("```yolo\nlist.append(1)\n```", &context).unwrap();
|
let res = render_content("```yolo\nlist.append(1)\n```", &context).unwrap();
|
||||||
// defaults to plain text
|
// defaults to plain text
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -82,7 +83,7 @@ fn can_higlight_code_block_with_unknown_lang() {
|
||||||
fn can_render_shortcode() {
|
fn can_render_shortcode() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content(r#"
|
let res = render_content(r#"
|
||||||
Hello
|
Hello
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ Hello
|
||||||
fn can_render_shortcode_with_markdown_char_in_args_name() {
|
fn can_render_shortcode_with_markdown_char_in_args_name() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let input = vec![
|
let input = vec![
|
||||||
"name",
|
"name",
|
||||||
"na_me",
|
"na_me",
|
||||||
|
@ -113,7 +114,7 @@ fn can_render_shortcode_with_markdown_char_in_args_name() {
|
||||||
fn can_render_shortcode_with_markdown_char_in_args_value() {
|
fn can_render_shortcode_with_markdown_char_in_args_value() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let input = vec![
|
let input = vec![
|
||||||
"ub36ffWAqgQ-hey",
|
"ub36ffWAqgQ-hey",
|
||||||
"ub36ffWAqgQ_hey",
|
"ub36ffWAqgQ_hey",
|
||||||
|
@ -140,7 +141,7 @@ fn can_render_body_shortcode_with_markdown_char_in_name() {
|
||||||
|
|
||||||
for i in input {
|
for i in input {
|
||||||
tera.add_raw_template(&format!("shortcodes/{}.html", i), "<blockquote>{{ body }} - {{ author}}</blockquote>").unwrap();
|
tera.add_raw_template(&format!("shortcodes/{}.html", i), "<blockquote>{{ body }} - {{ author}}</blockquote>").unwrap();
|
||||||
let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
|
|
||||||
let res = render_content(&format!("{{% {}(author=\"Bob\") %}}\nhey\n{{% end %}}", i), &context).unwrap();
|
let res = render_content(&format!("{{% {}(author=\"Bob\") %}}\nhey\n{{% end %}}", i), &context).unwrap();
|
||||||
println!("{:?}", res);
|
println!("{:?}", res);
|
||||||
|
@ -169,7 +170,7 @@ Here is another paragraph.
|
||||||
|
|
||||||
tera.add_raw_template(&format!("shortcodes/{}.html", "figure"), shortcode).unwrap();
|
tera.add_raw_template(&format!("shortcodes/{}.html", "figure"), shortcode).unwrap();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
|
|
||||||
let res = render_content(markdown_string, &context).unwrap();
|
let res = render_content(markdown_string, &context).unwrap();
|
||||||
println!("{:?}", res);
|
println!("{:?}", res);
|
||||||
|
@ -202,7 +203,7 @@ Here is another paragraph.
|
||||||
|
|
||||||
tera.add_raw_template(&format!("shortcodes/{}.html", "figure"), shortcode).unwrap();
|
tera.add_raw_template(&format!("shortcodes/{}.html", "figure"), shortcode).unwrap();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
|
|
||||||
let res = render_content(markdown_string, &context).unwrap();
|
let res = render_content(markdown_string, &context).unwrap();
|
||||||
println!("{:?}", res);
|
println!("{:?}", res);
|
||||||
|
@ -213,7 +214,7 @@ Here is another paragraph.
|
||||||
fn can_render_several_shortcode_in_row() {
|
fn can_render_several_shortcode_in_row() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content(r#"
|
let res = render_content(r#"
|
||||||
Hello
|
Hello
|
||||||
|
|
||||||
|
@ -240,7 +241,7 @@ fn doesnt_render_ignored_shortcodes() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.highlight_code = false;
|
config.highlight_code = false;
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content(r#"```{{/* youtube(id="w7Ft2ymGmfc") */}}```"#, &context).unwrap();
|
let res = render_content(r#"```{{/* youtube(id="w7Ft2ymGmfc") */}}```"#, &context).unwrap();
|
||||||
assert_eq!(res.0, "<p><code>{{ youtube(id="w7Ft2ymGmfc") }}</code></p>\n");
|
assert_eq!(res.0, "<p><code>{{ youtube(id="w7Ft2ymGmfc") }}</code></p>\n");
|
||||||
}
|
}
|
||||||
|
@ -252,7 +253,7 @@ fn can_render_shortcode_with_body() {
|
||||||
tera.add_raw_template("shortcodes/quote.html", "<blockquote>{{ body }} - {{ author }}</blockquote>").unwrap();
|
tera.add_raw_template("shortcodes/quote.html", "<blockquote>{{ body }} - {{ author }}</blockquote>").unwrap();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
|
|
||||||
let res = render_content(r#"
|
let res = render_content(r#"
|
||||||
Hello
|
Hello
|
||||||
|
@ -268,7 +269,7 @@ fn errors_rendering_unknown_shortcode() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("{{ hello(flash=true) }}", &context);
|
let res = render_content("{{ hello(flash=true) }}", &context);
|
||||||
assert!(res.is_err());
|
assert!(res.is_err());
|
||||||
}
|
}
|
||||||
|
@ -279,10 +280,10 @@ fn can_make_valid_relative_link() {
|
||||||
permalinks.insert("pages/about.md".to_string(), "https://vincent.is/about".to_string());
|
permalinks.insert("pages/about.md".to_string(), "https://vincent.is/about".to_string());
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content(
|
let res = render_content(
|
||||||
r#"[rel link](./pages/about.md), [abs link](https://vincent.is/about)"#,
|
r#"[rel link](./pages/about.md), [abs link](https://vincent.is/about)"#,
|
||||||
&context
|
&context,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
|
@ -296,7 +297,7 @@ fn can_make_relative_links_with_anchors() {
|
||||||
permalinks.insert("pages/about.md".to_string(), "https://vincent.is/about".to_string());
|
permalinks.insert("pages/about.md".to_string(), "https://vincent.is/about".to_string());
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content(r#"[rel link](./pages/about.md#cv)"#, &context).unwrap();
|
let res = render_content(r#"[rel link](./pages/about.md#cv)"#, &context).unwrap();
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
|
@ -309,7 +310,7 @@ fn errors_relative_link_inexistant() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("[rel link](./pages/about.md)", &context);
|
let res = render_content("[rel link](./pages/about.md)", &context);
|
||||||
assert!(res.is_err());
|
assert!(res.is_err());
|
||||||
}
|
}
|
||||||
|
@ -319,7 +320,7 @@ fn can_add_id_to_headers() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content(r#"# Hello"#, &context).unwrap();
|
let res = render_content(r#"# Hello"#, &context).unwrap();
|
||||||
assert_eq!(res.0, "<h1 id=\"hello\">Hello</h1>\n");
|
assert_eq!(res.0, "<h1 id=\"hello\">Hello</h1>\n");
|
||||||
}
|
}
|
||||||
|
@ -329,7 +330,7 @@ fn can_add_id_to_headers_same_slug() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("# Hello\n# Hello", &context).unwrap();
|
let res = render_content("# Hello\n# Hello", &context).unwrap();
|
||||||
assert_eq!(res.0, "<h1 id=\"hello\">Hello</h1>\n<h1 id=\"hello-1\">Hello</h1>\n");
|
assert_eq!(res.0, "<h1 id=\"hello\">Hello</h1>\n<h1 id=\"hello-1\">Hello</h1>\n");
|
||||||
}
|
}
|
||||||
|
@ -338,7 +339,7 @@ fn can_add_id_to_headers_same_slug() {
|
||||||
fn can_insert_anchor_left() {
|
fn can_insert_anchor_left() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::Left);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::Left);
|
||||||
let res = render_content("# Hello", &context).unwrap();
|
let res = render_content("# Hello", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -350,7 +351,7 @@ fn can_insert_anchor_left() {
|
||||||
fn can_insert_anchor_right() {
|
fn can_insert_anchor_right() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::Right);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::Right);
|
||||||
let res = render_content("# Hello", &context).unwrap();
|
let res = render_content("# Hello", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -363,7 +364,7 @@ fn can_insert_anchor_right() {
|
||||||
fn can_insert_anchor_with_exclamation_mark() {
|
fn can_insert_anchor_with_exclamation_mark() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::Left);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::Left);
|
||||||
let res = render_content("# Hello!", &context).unwrap();
|
let res = render_content("# Hello!", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -376,7 +377,7 @@ fn can_insert_anchor_with_exclamation_mark() {
|
||||||
fn can_insert_anchor_with_link() {
|
fn can_insert_anchor_with_link() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::Left);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::Left);
|
||||||
let res = render_content("## [Rust](https://rust-lang.org)", &context).unwrap();
|
let res = render_content("## [Rust](https://rust-lang.org)", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -388,7 +389,7 @@ fn can_insert_anchor_with_link() {
|
||||||
fn can_insert_anchor_with_other_special_chars() {
|
fn can_insert_anchor_with_other_special_chars() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::Left);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::Left);
|
||||||
let res = render_content("# Hello*_()", &context).unwrap();
|
let res = render_content("# Hello*_()", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -405,7 +406,8 @@ fn can_make_toc() {
|
||||||
&config,
|
&config,
|
||||||
"https://mysite.com/something",
|
"https://mysite.com/something",
|
||||||
&permalinks_ctx,
|
&permalinks_ctx,
|
||||||
InsertAnchor::Left
|
Path::new("something"),
|
||||||
|
InsertAnchor::Left,
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = render_content(r#"
|
let res = render_content(r#"
|
||||||
|
@ -422,14 +424,13 @@ fn can_make_toc() {
|
||||||
assert_eq!(toc.len(), 1);
|
assert_eq!(toc.len(), 1);
|
||||||
assert_eq!(toc[0].children.len(), 2);
|
assert_eq!(toc[0].children.len(), 2);
|
||||||
assert_eq!(toc[0].children[1].children.len(), 1);
|
assert_eq!(toc[0].children[1].children.len(), 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_understand_backtick_in_titles() {
|
fn can_understand_backtick_in_titles() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("# `Hello`", &context).unwrap();
|
let res = render_content("# `Hello`", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -441,7 +442,7 @@ fn can_understand_backtick_in_titles() {
|
||||||
fn can_understand_backtick_in_paragraphs() {
|
fn can_understand_backtick_in_paragraphs() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("Hello `world`", &context).unwrap();
|
let res = render_content("Hello `world`", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -454,7 +455,7 @@ fn can_understand_backtick_in_paragraphs() {
|
||||||
fn can_understand_links_in_header() {
|
fn can_understand_links_in_header() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("# [Rust](https://rust-lang.org)", &context).unwrap();
|
let res = render_content("# [Rust](https://rust-lang.org)", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -466,7 +467,7 @@ fn can_understand_links_in_header() {
|
||||||
fn can_understand_link_with_title_in_header() {
|
fn can_understand_link_with_title_in_header() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("# [Rust](https://rust-lang.org \"Rust homepage\")", &context).unwrap();
|
let res = render_content("# [Rust](https://rust-lang.org \"Rust homepage\")", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -480,10 +481,10 @@ fn can_make_valid_relative_link_in_header() {
|
||||||
permalinks.insert("pages/about.md".to_string(), "https://vincent.is/about/".to_string());
|
permalinks.insert("pages/about.md".to_string(), "https://vincent.is/about/".to_string());
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks, InsertAnchor::None);
|
let context = RenderContext::new(&tera_ctx, &config, "", &permalinks, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content(
|
let res = render_content(
|
||||||
r#" # [rel link](./pages/about.md)"#,
|
r#" # [rel link](./pages/about.md)"#,
|
||||||
&context
|
&context,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -496,7 +497,7 @@ fn can_make_valid_relative_link_in_header() {
|
||||||
fn can_make_permalinks_with_colocated_assets_for_link() {
|
fn can_make_permalinks_with_colocated_assets_for_link() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("[an image](image.jpg)", &context).unwrap();
|
let res = render_content("[an image](image.jpg)", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -508,7 +509,7 @@ fn can_make_permalinks_with_colocated_assets_for_link() {
|
||||||
fn can_make_permalinks_with_colocated_assets_for_image() {
|
fn can_make_permalinks_with_colocated_assets_for_image() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("![alt text](image.jpg)", &context).unwrap();
|
let res = render_content("![alt text](image.jpg)", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -520,7 +521,7 @@ fn can_make_permalinks_with_colocated_assets_for_image() {
|
||||||
fn markdown_doesnt_wrap_html_in_paragraph() {
|
fn markdown_doesnt_wrap_html_in_paragraph() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content(r#"
|
let res = render_content(r#"
|
||||||
Some text
|
Some text
|
||||||
|
|
||||||
|
@ -543,7 +544,7 @@ fn can_validate_valid_external_links() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.check_external_links = true;
|
config.check_external_links = true;
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("[a link](http://google.com)", &context).unwrap();
|
let res = render_content("[a link](http://google.com)", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.0,
|
res.0,
|
||||||
|
@ -556,7 +557,7 @@ fn can_show_error_message_for_invalid_external_links() {
|
||||||
let permalinks_ctx = HashMap::new();
|
let permalinks_ctx = HashMap::new();
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.check_external_links = true;
|
config.check_external_links = true;
|
||||||
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, InsertAnchor::None);
|
let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, Path::new("something"), InsertAnchor::None);
|
||||||
let res = render_content("[a link](http://google.comy)", &context);
|
let res = render_content("[a link](http://google.comy)", &context);
|
||||||
assert!(res.is_err());
|
assert!(res.is_err());
|
||||||
let err = res.unwrap_err();
|
let err = res.unwrap_err();
|
||||||
|
|
|
@ -27,12 +27,12 @@ Here is a full list of the supported languages and the short names you can use:
|
||||||
- Assembly x86 (NASM) -> ["asm", "inc", "nasm"]
|
- Assembly x86 (NASM) -> ["asm", "inc", "nasm"]
|
||||||
- Crystal -> ["cr"]
|
- Crystal -> ["cr"]
|
||||||
- Elixir -> ["ex", "exs"]
|
- Elixir -> ["ex", "exs"]
|
||||||
- Elm -> ["elm"]
|
|
||||||
- Handlebars -> ["handlebars", "handlebars.html", "hbr", "hbrs", "hbs", "hdbs", "hjs", "mu", "mustache", "rac", "stache", "template", "tmpl"]
|
- Handlebars -> ["handlebars", "handlebars.html", "hbr", "hbrs", "hbs", "hdbs", "hjs", "mu", "mustache", "rac", "stache", "template", "tmpl"]
|
||||||
- Jinja2 -> ["j2", "jinja2"]
|
- Jinja2 -> ["j2", "jinja2"]
|
||||||
- Julia -> ["jl"]
|
- Julia -> ["jl"]
|
||||||
- Kotlin -> ["kt", "kts"]
|
- Kotlin -> ["kt", "kts"]
|
||||||
- Less -> ["less", "css.less"]
|
- Less -> ["less", "css.less"]
|
||||||
|
- MiniZinc (MZN) -> ["mzn", "dzn"]
|
||||||
- Nim -> ["nim", "nims"]
|
- Nim -> ["nim", "nims"]
|
||||||
- ASP -> ["asa"]
|
- ASP -> ["asa"]
|
||||||
- HTML (ASP) -> ["asp"]
|
- HTML (ASP) -> ["asp"]
|
||||||
|
@ -49,10 +49,17 @@ Here is a full list of the supported languages and the short names you can use:
|
||||||
- Diff -> ["diff", "patch"]
|
- Diff -> ["diff", "patch"]
|
||||||
- Erlang -> ["erl", "hrl", "Emakefile", "emakefile"]
|
- Erlang -> ["erl", "hrl", "Emakefile", "emakefile"]
|
||||||
- HTML (Erlang) -> ["yaws"]
|
- HTML (Erlang) -> ["yaws"]
|
||||||
|
- Git Attributes -> ["attributes", "gitattributes", ".gitattributes"]
|
||||||
|
- Git Commit -> ["COMMIT_EDITMSG", "MERGE_MSG", "TAG_EDITMSG"]
|
||||||
|
- Git Config -> ["gitconfig", ".gitconfig", ".gitmodules"]
|
||||||
|
- Git Ignore -> ["exclude", "gitignore", ".gitignore"]
|
||||||
|
- Git Link -> [".git"]
|
||||||
|
- Git Log -> ["gitlog"]
|
||||||
|
- Git Rebase Todo -> ["git-rebase-todo"]
|
||||||
- Go -> ["go"]
|
- Go -> ["go"]
|
||||||
- Graphviz (DOT) -> ["dot", "DOT", "gv"]
|
- Graphviz (DOT) -> ["dot", "DOT", "gv"]
|
||||||
- Groovy -> ["groovy", "gvy", "gradle"]
|
- Groovy -> ["groovy", "gvy", "gradle", "Jenkinsfile"]
|
||||||
- HTML -> ["html", "htm", "shtml", "xhtml", "inc", "tmpl", "tpl"]
|
- HTML -> ["html", "htm", "shtml", "xhtml"]
|
||||||
- Haskell -> ["hs"]
|
- Haskell -> ["hs"]
|
||||||
- Literate Haskell -> ["lhs"]
|
- Literate Haskell -> ["lhs"]
|
||||||
- Java Server Page (JSP) -> ["jsp"]
|
- Java Server Page (JSP) -> ["jsp"]
|
||||||
|
@ -65,7 +72,7 @@ Here is a full list of the supported languages and the short names you can use:
|
||||||
- TeX -> ["sty", "cls"]
|
- TeX -> ["sty", "cls"]
|
||||||
- Lisp -> ["lisp", "cl", "clisp", "l", "mud", "el", "scm", "ss", "lsp", "fasl"]
|
- Lisp -> ["lisp", "cl", "clisp", "l", "mud", "el", "scm", "ss", "lsp", "fasl"]
|
||||||
- Lua -> ["lua"]
|
- Lua -> ["lua"]
|
||||||
- Makefile -> ["make", "GNUmakefile", "makefile", "Makefile", "OCamlMakefile", "mak", "mk"]
|
- Makefile -> ["make", "GNUmakefile", "makefile", "Makefile", "makefile.am", "Makefile.am", "makefile.in", "Makefile.in", "OCamlMakefile", "mak", "mk"]
|
||||||
- Markdown -> ["md", "mdown", "markdown", "markdn"]
|
- Markdown -> ["md", "mdown", "markdown", "markdn"]
|
||||||
- MATLAB -> ["matlab"]
|
- MATLAB -> ["matlab"]
|
||||||
- OCaml -> ["ml", "mli"]
|
- OCaml -> ["ml", "mli"]
|
||||||
|
@ -90,19 +97,25 @@ Here is a full list of the supported languages and the short names you can use:
|
||||||
- Rust -> ["rs"]
|
- Rust -> ["rs"]
|
||||||
- SQL -> ["sql", "ddl", "dml"]
|
- SQL -> ["sql", "ddl", "dml"]
|
||||||
- Scala -> ["scala", "sbt"]
|
- Scala -> ["scala", "sbt"]
|
||||||
- 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"]
|
- 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", ".zshrc"]
|
||||||
- HTML (Tcl) -> ["adp"]
|
- HTML (Tcl) -> ["adp"]
|
||||||
- Tcl -> ["tcl"]
|
- Tcl -> ["tcl"]
|
||||||
- Textile -> ["textile"]
|
- Textile -> ["textile"]
|
||||||
- XML -> ["xml", "xsd", "xslt", "tld", "dtml", "rss", "opml", "svg"]
|
- XML -> ["xml", "xsd", "xslt", "tld", "dtml", "rss", "opml", "svg"]
|
||||||
- YAML -> ["yaml", "yml", "sublime-syntax"]
|
- YAML -> ["yaml", "yml", "sublime-syntax"]
|
||||||
- SWI-Prolog -> ["pro"]
|
- SWI-Prolog -> ["pro"]
|
||||||
|
- CMake C Header -> ["h.in"]
|
||||||
|
- CMake C++ Header -> ["hh.in", "hpp.in", "hxx.in", "h++.in"]
|
||||||
|
- CMake -> ["CMakeLists.txt", "cmake"]
|
||||||
|
- CMakeCache -> ["CMakeCache.txt"]
|
||||||
- Generic Config -> ["cfg", "conf", "config", "ini", "pro", "mak", "mk", "Doxyfile", "inputrc", ".inputrc", "dircolors", ".dircolors", "gitmodules", ".gitmodules", "gitignore", ".gitignore", "gitattributes", ".gitattributes"]
|
- Generic Config -> ["cfg", "conf", "config", "ini", "pro", "mak", "mk", "Doxyfile", "inputrc", ".inputrc", "dircolors", ".dircolors", "gitmodules", ".gitmodules", "gitignore", ".gitignore", "gitattributes", ".gitattributes"]
|
||||||
|
- Elm -> ["elm"]
|
||||||
- Linker Script -> ["ld"]
|
- Linker Script -> ["ld"]
|
||||||
- TOML -> ["toml", "tml"]
|
- TOML -> ["toml", "tml"]
|
||||||
- TypeScript -> ["ts"]
|
- TypeScript -> ["ts"]
|
||||||
- TypeScriptReact -> ["tsx"]
|
- TypeScriptReact -> ["tsx"]
|
||||||
- VimL -> ["vim"]
|
- VimL -> ["vim"]
|
||||||
|
- TOML -> ["toml", "tml", "Cargo.lock", "Gopkg.lock"]
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to highlight a language not on that list, please open an issue or a pull request on the [Gutenberg repo](https://github.com/Keats/gutenberg).
|
If you want to highlight a language not on that list, please open an issue or a pull request on the [Gutenberg repo](https://github.com/Keats/gutenberg).
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6f0da0ace6d881648dbfb2c3c1a3799ff7d5c54a
|
Subproject commit d3ddfe7b51e01140db209f57af3bc47d04d9ac0a
|
65
sublime_syntaxes/MZN.sublime-syntax
Normal file
65
sublime_syntaxes/MZN.sublime-syntax
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: MiniZinc (MZN)
|
||||||
|
file_extensions:
|
||||||
|
- mzn
|
||||||
|
- dzn
|
||||||
|
scope: source.mzn
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: \%.*
|
||||||
|
scope: comment.line.percentage.mzn
|
||||||
|
- match: /\*
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.mzn
|
||||||
|
- match: \*/
|
||||||
|
pop: true
|
||||||
|
- match: \'.*?\'
|
||||||
|
scope: string.quoted.single.mzn
|
||||||
|
- match: \".*?\"
|
||||||
|
scope: string.quoted.double.mzn
|
||||||
|
- match: \b(ann|annotation|any|constraint|function|in|include|list|of|op|output|minimize|maximize|par|predicate|record|satisfy|solve|test|type|var)\b
|
||||||
|
scope: keyword.control.mzn
|
||||||
|
- match: \b(array|set|bool|enum|float|int|string|tuple)\b
|
||||||
|
scope: storage.type.mzn
|
||||||
|
- match: \b(for|forall|if|then|else|endif|where)\b
|
||||||
|
scope: keyword.control.mzn
|
||||||
|
- match: \b(abort|abs|acosh|array_intersect|array_union|array1d|array2d|array3d|array4d|array5d|array6d|asin|assert|atan|bool2int|card|ceil|concat|cos|cosh|dom|dom_array|dom_size|fix|exp|floor|index_set|index_set_1of2|index_set_2of2|index_set_1of3|index_set_2of3|index_set_3of3|int2float|is_fixed|join|lb|lb_array|length|ln|log|log2|log10|min|max|pow|product|round|set2array|show|show_int|show_float|sin|sinh|sqrt|sum|tan|tanh|trace|ub|ub_array)\b
|
||||||
|
scope: entity.name.function.mzn
|
||||||
|
- match: \b(circuit|disjoint|maximum|maximum_arg|member|minimum|minimum_arg|network_flow|network_flow_cost|partition_set|range|roots|sliding_sum|subcircuit|sum_pred)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(alldifferent|all_different|all_disjoint|all_equal|alldifferent_except_0|nvalue|symmetric_all_different)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(lex2|lex_greater|lex_greatereq|lex_less|lex_lesseq|strict_lex2|value_precede|value_precede_chain)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(arg_sort|decreasing|increasing|sort)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(int_set_channel|inverse|inverse_set|link_set_to_booleans)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(among|at_least|at_most|at_most1|count|count_eq|count_geq|count_gt|count_leq|count_lt|count_neq|distribute|exactly|global_cardinality|global_cardinality_closed|global_cardinality_low_up|global_cardinality_low_up_closed)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(bin_packing|bin_packing_capa|bin_packing_load|diffn|diffn_k|diffn_nonstrict|diffn_nonstrict_k|geost|geost_bb|geost_smallest_bb|knapsack)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(alternative|cumulative|disjunctive|disjunctive_strict|span)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(regular|regular_nfa|table)\b
|
||||||
|
scope: support.function.mzn
|
||||||
|
- match: \b(not|\+|-)\b
|
||||||
|
scope: keyword.operator.math.mzn
|
||||||
|
- match: \b(<->|->|<-|\\/|xor|/\\)\b
|
||||||
|
scope: keyword.operator.logical.mzn
|
||||||
|
- match: \b(<|>|<=|>=|==|=|!=)\b
|
||||||
|
scope: keyword.operator.math.mzn
|
||||||
|
- match: \b(\+|-|\*|/|div|mod)\b
|
||||||
|
scope: keyword.operator.math.mzn
|
||||||
|
- match: \b(in|subset|superset|union|diff|symdiff|intersect)\b
|
||||||
|
scope: keyword.operator.sets.mzn
|
||||||
|
- match: \|\.\.|\+\+
|
||||||
|
scope: keyword.operator.math.mzn
|
||||||
|
- match: \b(true|false)\b
|
||||||
|
scope: constant.language.mzn
|
||||||
|
- match: '\b([_A-Za-z])(\w*)\b'
|
||||||
|
scope: variable.other.mzn
|
||||||
|
- match: '([+-]?)\d+(\.[^\.]\d*)?([eE][-+]?\d+)?'
|
||||||
|
scope: constant.numeric.mzn
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1cb4c3ec368c751d6f7ecfa16fe02ceff23a1f6b
|
Subproject commit 289782ff2e4cb58de171579c7fc86fe00d280619
|
|
@ -1 +1 @@
|
||||||
Subproject commit ff9a800a4ca942edd095de553ca05fba03b02275
|
Subproject commit aba96a0862369e9f960bb63a38e2d7563ea6475e
|
|
@ -1 +1 @@
|
||||||
Subproject commit a9055b118c991601c3a0876730c8918beb422c84
|
Subproject commit 3c90f249ee6e4daa1d25a2dd9cda53071e42a076
|
Binary file not shown.
Binary file not shown.
|
@ -1 +1 @@
|
||||||
Subproject commit 1deb0745d7cfd069bdd5652878e321019b1ed229
|
Subproject commit 36f8239551f09ed354a6872a6cc2fd0168883446
|
Loading…
Reference in a new issue