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

mixins arguments don't include the '$' dollar sign at variable instantiation when outputing std text templates #49

Open
alarbada opened this issue Nov 25, 2022 · 1 comment

Comments

@alarbada
Copy link

So, the following mixin, gotten from the tests:

//- Declaration
mixin pet(name)
  li.pet= name
//- Use
ul
  +pet('cat')
  +pet('dog')
  +pet('pig')

Converts to this:

<ul>{{ $name := "cat" }} 
    <li class="pet">{{ name }}</li>
    {{ $name := "dog" }} 
    <li class="pet">{{ name }}</li>
    {{ $name := "pig" }} 
    <li class="pet">{{ name }}</li>
</ul>

But this is not valid text template code, it needs the dollar sign, so it will result in an error.

I expected the following output:

<ul>{{ $name := "cat" }} 
    <li class="pet">{{ $name }}</li>
    {{ $name := "dog" }} 
    <li class="pet">{{ $name }}</li>
    {{ $name := "pig" }} 
    <li class="pet">{{ $name }}</li>
</ul>
@alarbada
Copy link
Author

Mmm, maybe these lines: https://github.com/Joker/jade/blob/master/config.go#L33-L34

Shouldn't they be like this:

	code__buffered  = "{{ $%s }}"
	code__unescaped = "{{ $%s }}"

I see that I can change the replace behaviour at runtime, so I can deal with this situation.

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