mirror of
https://github.com/sbrow/thor.git
synced 2026-10-25 02:01:56 -04:00
fix: Fixed diagnostic issue with first/last in partials.
This commit is contained in:
+10
-8
@@ -343,19 +343,21 @@ should: ok
|
|||||||
expected: "foo"
|
expected: "foo"
|
||||||
---
|
---
|
||||||
# TODO: called First/last, but only tests first
|
# TODO: called First/last, but only tests first
|
||||||
|
# TODO: Include | last 3 }} in the suggestion.
|
||||||
name: "first/last in partial"
|
name: "first/last in partial"
|
||||||
enable: true
|
enable: true
|
||||||
input: "{{> footer }}"
|
input: "{{> footer }}"
|
||||||
should: error
|
should: warn
|
||||||
expected: |
|
expected: |
|
||||||
first -3 is equivalent to last 3
|
first -3 is equivalent to last 3
|
||||||
--> /home/spencer/github.com/sbrow.github.io/layouts/partials/footer.html:1:1
|
--> /home/spencer/github.com/sbrow.github.io/thor/mustache/fixtures/layouts/partials/footer.html:11:78
|
||||||
|
|
|
|
||||||
1 | <footer>
|
9 | href="https://edwardtufte.github.io/tufte-css/">Tufte CSS</a>
|
||||||
| ^ consider using the clearer form
|
10 | </p>
|
||||||
2 | <menu>
|
11 | <p><small>©</small> {{! now | format "2006" }} {{params.author.name | first -3 }}</p>
|
||||||
3 | <a class="goto-top opacity-0" href="#">{{> icons/chevron_up}}</a>
|
| ^^^^^^^^ consider using the clearer form
|
||||||
|
|
12 | </footer>
|
||||||
|
|
|
||||||
---
|
---
|
||||||
name: "Pipes are ignored in comments"
|
name: "Pipes are ignored in comments"
|
||||||
enable: true
|
enable: true
|
||||||
|
|||||||
+3
-2
@@ -460,14 +460,15 @@ take :: proc(
|
|||||||
any,
|
any,
|
||||||
Error,
|
Error,
|
||||||
) {
|
) {
|
||||||
elem_info, count, data := list_info(value)
|
unwrapped, _ := base_value(value)
|
||||||
|
elem_info, count, data := list_info(unwrapped)
|
||||||
is_list := elem_info != nil
|
is_list := elem_info != nil
|
||||||
from_start := from_start
|
from_start := from_start
|
||||||
warning: Error = nil
|
warning: Error = nil
|
||||||
|
|
||||||
str: string
|
str: string
|
||||||
if !is_list {
|
if !is_list {
|
||||||
s, is_str := reflect.as_string(value)
|
s, is_str := reflect.as_string(unwrapped)
|
||||||
if !is_str {
|
if !is_str {
|
||||||
return nil, Error_Body {
|
return nil, Error_Body {
|
||||||
msg = "requires a list or string",
|
msg = "requires a list or string",
|
||||||
|
|||||||
Reference in New Issue
Block a user