-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare v0.0.7, add license, add insta tests
- Loading branch information
Showing
18 changed files
with
344 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
[package] | ||
name = "yolk" | ||
name = "yolk_dots" | ||
authors = ["ElKowar <[email protected]>"] | ||
description = "Templated dotfile management without template files" | ||
version = "0.0.6" | ||
version = "0.0.7" | ||
edition = "2021" | ||
repository = "https://github.com/elkowar/yolk" | ||
homepage = "https://elkowar.github.io/yolk" | ||
license = "MIT OR Apache-2.0" | ||
|
||
[package.metadata.wix] | ||
upgrade-guid = "04CA81A1-EF78-4B08-8D76-74A8DB52A323" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2024 ElKowar | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[workspace] | ||
members = ["cargo:."] | ||
|
||
# Config for 'dist' | ||
[dist] | ||
# The preferred dist version to use in CI (Cargo.toml SemVer syntax) | ||
cargo-dist-version = "0.26.0-prerelease.3" | ||
# CI backends to support | ||
ci = "github" | ||
# The installers to generate for each app | ||
installers = ["shell"] | ||
# Target platforms to build apps for (Rust target-triple syntax) | ||
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"] | ||
# Path that installers should place binaries in | ||
install-path = "CARGO_HOME" | ||
# Whether to install an updater program | ||
install-updater = true |
12 changes: 12 additions & 0 deletions
12
src/templating/snapshots/yolk_dots__templating__parser__p_text_segment-2.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_text_segment.parse_peek(new_input(\"foo\"))?" | ||
snapshot_kind: text | ||
--- | ||
( | ||
"", | ||
( | ||
"", | ||
"foo", | ||
), | ||
) |
16 changes: 16 additions & 0 deletions
16
src/templating/snapshots/yolk_dots__templating__parser__p_text_segment-3.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_text_segment.parse_peek(new_input(\"{< bar >}\"))" | ||
snapshot_kind: text | ||
--- | ||
Err( | ||
Backtrack( | ||
YolkParseError { | ||
context: None, | ||
span: None, | ||
label: None, | ||
help: None, | ||
kind: None, | ||
}, | ||
), | ||
) |
12 changes: 12 additions & 0 deletions
12
src/templating/snapshots/yolk_dots__templating__parser__p_text_segment.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_text_segment.parse_peek(new_input(\"foo {% bar %} baz\"))?" | ||
snapshot_kind: text | ||
--- | ||
( | ||
"{% bar %} baz", | ||
( | ||
"{%", | ||
"foo ", | ||
), | ||
) |
70 changes: 70 additions & 0 deletions
70
src/templating/snapshots/yolk_dots__templating__parser__test__conditional.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_conditional_element(&mut new_input(indoc::indoc! {\n r#\"\n // {% if a %}\n a\n b\n // {% elif b %}\n // {% elif c %}\n // {% else %}\n c\n // {% end %}\n \"#\n }))" | ||
snapshot_kind: text | ||
--- | ||
Ok( | ||
Conditional { | ||
blocks: [ | ||
Block { | ||
tagged_line: TaggedLine { | ||
left: "// ", | ||
tag: "{% if a %}", | ||
right: "\n", | ||
full_line: [0..14]"// {% if a %}\n", | ||
}, | ||
expr: [6..11]"a ", | ||
body: [ | ||
Plain( | ||
[14..16]"a\n", | ||
), | ||
Plain( | ||
[16..18]"b\n", | ||
), | ||
], | ||
}, | ||
Block { | ||
tagged_line: TaggedLine { | ||
left: "// ", | ||
tag: "{% elif b %}", | ||
right: "\n", | ||
full_line: [18..34]"// {% elif b %}\n", | ||
}, | ||
expr: [24..31]"b ", | ||
body: [], | ||
}, | ||
Block { | ||
tagged_line: TaggedLine { | ||
left: "// ", | ||
tag: "{% elif c %}", | ||
right: "\n", | ||
full_line: [34..50]"// {% elif c %}\n", | ||
}, | ||
expr: [40..47]"c ", | ||
body: [], | ||
}, | ||
], | ||
else_block: Some( | ||
Block { | ||
tagged_line: TaggedLine { | ||
left: "// ", | ||
tag: "{% else %}", | ||
right: "\n", | ||
full_line: [50..64]"// {% else %}\n", | ||
}, | ||
expr: (), | ||
body: [ | ||
Plain( | ||
[64..66]"c\n", | ||
), | ||
], | ||
}, | ||
), | ||
end: TaggedLine { | ||
left: "// ", | ||
tag: "{% end %}", | ||
right: "\n", | ||
full_line: [66..79]"// {% end %}\n", | ||
}, | ||
}, | ||
) |
14 changes: 14 additions & 0 deletions
14
...emplating/snapshots/yolk_dots__templating__parser__test__error_if_without_expression.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "render_error(parse_document(\"{<if>}\").unwrap_err())" | ||
snapshot_kind: text | ||
--- | ||
× Failed to parse yolk template file | ||
|
||
Error: | ||
× Expected expression. | ||
╭─[file:1:4] | ||
1 │ {<if>} | ||
· ┬ | ||
· ╰── here | ||
╰──── |
14 changes: 14 additions & 0 deletions
14
...templating/snapshots/yolk_dots__templating__parser__test__error_incomplete_multiline.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "render_error(parse_document(\"{%f%}\").unwrap_err())" | ||
snapshot_kind: text | ||
--- | ||
× Failed to parse yolk template file | ||
|
||
Error: | ||
× Expected newline. | ||
╭─[file:1:5] | ||
1 │ {%f%} | ||
· ┬ | ||
· ╰── here | ||
╰──── |
14 changes: 14 additions & 0 deletions
14
src/templating/snapshots/yolk_dots__templating__parser__test__error_incomplete_nextline.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "render_error(parse_document(\"{#f#}\").unwrap_err())" | ||
snapshot_kind: text | ||
--- | ||
× Failed to parse yolk template file | ||
|
||
Error: | ||
× Expected newline. | ||
╭─[file:1:5] | ||
1 │ {#f#} | ||
· ┬ | ||
· ╰── here | ||
╰──── |
16 changes: 16 additions & 0 deletions
16
src/templating/snapshots/yolk_dots__templating__parser__test__error_multiline_with_else.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "render_error(parse_document(\"{%f%}\\n{%else%}\\n{%end%}\").unwrap_err())" | ||
snapshot_kind: text | ||
--- | ||
× Failed to parse yolk template file | ||
|
||
Error: | ||
× Expected valid element. | ||
╭─[file:2:3] | ||
1 │ {%f%} | ||
2 │ {%else%} | ||
· ───┬─── | ||
· ╰── here | ||
3 │ {%end%} | ||
╰──── |
15 changes: 15 additions & 0 deletions
15
src/templating/snapshots/yolk_dots__templating__parser__test__inline_tag.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_inline_element.parse(new_input(\"foo /* {< test >} */\"))?" | ||
snapshot_kind: text | ||
--- | ||
Inline { | ||
line: TaggedLine { | ||
left: "foo /* ", | ||
tag: "{< test >}", | ||
right: " */", | ||
full_line: [0..20]"foo /* {< test >} */", | ||
}, | ||
expr: [10..15]"test ", | ||
is_if: false, | ||
} |
27 changes: 27 additions & 0 deletions
27
src/templating/snapshots/yolk_dots__templating__parser__test__multiline_block.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_multiline_element(&mut new_input(\"/* {% test %} */\\nfoo\\n/* {% end %} */\"))?" | ||
snapshot_kind: text | ||
--- | ||
MultiLine { | ||
block: Block { | ||
tagged_line: TaggedLine { | ||
left: "/* ", | ||
tag: "{% test %}", | ||
right: " */\n", | ||
full_line: [0..17]"/* {% test %} */\n", | ||
}, | ||
expr: [6..11]"test ", | ||
body: [ | ||
Plain( | ||
[17..21]"foo\n", | ||
), | ||
], | ||
}, | ||
end: TaggedLine { | ||
left: "/* ", | ||
tag: "{% end %}", | ||
right: " */", | ||
full_line: [21..36]"/* {% end %} */", | ||
}, | ||
} |
50 changes: 50 additions & 0 deletions
50
src/templating/snapshots/yolk_dots__templating__parser__test__nested_conditional.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_conditional_element(&mut new_input(indoc::indoc! {\n r#\"\n // {% if foo %}\n // {% if foo %}\n // {% end %}\n // {% end %}\n \"#\n }))" | ||
snapshot_kind: text | ||
--- | ||
Ok( | ||
Conditional { | ||
blocks: [ | ||
Block { | ||
tagged_line: TaggedLine { | ||
left: "// ", | ||
tag: "{% if foo %}", | ||
right: "\n", | ||
full_line: [0..16]"// {% if foo %}\n", | ||
}, | ||
expr: [6..13]"foo ", | ||
body: [ | ||
Conditional { | ||
blocks: [ | ||
Block { | ||
tagged_line: TaggedLine { | ||
left: "// ", | ||
tag: "{% if foo %}", | ||
right: "\n", | ||
full_line: [16..32]"// {% if foo %}\n", | ||
}, | ||
expr: [22..29]"foo ", | ||
body: [], | ||
}, | ||
], | ||
else_block: None, | ||
end: TaggedLine { | ||
left: "// ", | ||
tag: "{% end %}", | ||
right: "\n", | ||
full_line: [32..45]"// {% end %}\n", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
else_block: None, | ||
end: TaggedLine { | ||
left: "// ", | ||
tag: "{% end %}", | ||
right: "\n", | ||
full_line: [45..58]"// {% end %}\n", | ||
}, | ||
}, | ||
) |
16 changes: 16 additions & 0 deletions
16
src/templating/snapshots/yolk_dots__templating__parser__test__nextline_tag.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_nextline_element(&mut new_input(\"/* {# x #} */\\nfoo\"))?" | ||
snapshot_kind: text | ||
--- | ||
NextLine { | ||
tagged_line: TaggedLine { | ||
left: "/* ", | ||
tag: "{# x #}", | ||
right: " */\n", | ||
full_line: [0..14]"/* {# x #} */\n", | ||
}, | ||
expr: [6..8]"x ", | ||
next_line: [14..17]"foo", | ||
is_if: false, | ||
} |
23 changes: 23 additions & 0 deletions
23
src/templating/snapshots/yolk_dots__templating__parser__test__nextline_tag_document.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "parse_document(&mut new_input(indoc::indoc! {\n r#\"\n # {# replace(`'.*'`, `'{data.value}'`) #}\n value = 'foo'\n \"#\n }))" | ||
snapshot_kind: text | ||
--- | ||
Ok( | ||
[ | ||
NextLine { | ||
tagged_line: TaggedLine { | ||
left: "# ", | ||
tag: "{# replace(`'.*'`, `'{data.value}'`) #}", | ||
right: "\n", | ||
full_line: [0..42]"# {# replace(`'.*'`, `'{data.value}'`) #}\n", | ||
}, | ||
expr: [5..39]"replace(`'.*'`, `'{data.value}'`) ", | ||
next_line: [42..55]"value = 'foo'", | ||
is_if: false, | ||
}, | ||
Plain( | ||
[55..56]"\n", | ||
), | ||
], | ||
) |
16 changes: 16 additions & 0 deletions
16
src/templating/snapshots/yolk_dots__templating__parser__test__parse_end.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
source: src/templating/parser.rs | ||
expression: "p_tag_line(\"{%\", \"end\", \"%}\", false).parse(new_input(\"a{% end %}b\"))" | ||
snapshot_kind: text | ||
--- | ||
Ok( | ||
( | ||
TaggedLine { | ||
left: "a", | ||
tag: "{% end %}", | ||
right: "b", | ||
full_line: [0..11]"a{% end %}b", | ||
}, | ||
[4..7]"end", | ||
), | ||
) |