Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected template-style behavior with default #55

Open
xpe opened this issue Jun 19, 2020 · 0 comments
Open

Unexpected template-style behavior with default #55

xpe opened this issue Jun 19, 2020 · 0 comments

Comments

@xpe
Copy link

xpe commented Jun 19, 2020

First, thanks for sigil. I prefer it already to envsubst and shell evaluation.

% print "{{ \$x | default \"foo\" }}" | tee template
{{ $x | default "foo" }}

This did not behave as I expected:

% sigil -f template
template: template:1: undefined variable "$x"

Interestingly, in this case, the default works:

% sigil -f template x=
foo

Regular behavior, of course, is fine:

% sigil -f template x=bar
bar

I'm using sigil 0.6.0 on macOS.

Now, after reading how Hugo does templating, I tried using $.x instead of $x, and...

% print "{{ \$.x | default \"foo\" }}" | tee template
{{ $.x | default "foo" }}
% sigil -f template
foo

Ok, this is the result I wanted, but it took a lot of horsing around.

At the least, I'd suggest more documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant