pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
387 stars 42 forks source link

How do i convert back to HTML and keep the variable intact? #246

Closed dzpt closed 2 years ago

dzpt commented 2 years ago

I wonder how can i convert the pug file back to HTML and keep variables in it?

a(href='#{abc}')

would be

<a href="#{abc}" />

all pug to html converter couldn't run with some complex syntaxes

kylekatarnls commented 2 years ago

There is no pug variable in your example, interpolation is a text feature, it does not apply inside a string such as in attribute. Inserting a variable in attribute would simply be in Pug:

a(href=abc)

Also, pug code does not represent static HTML code. Because of the mixin/extends/loops/etc., it actually represents dynamic template. So anyway, you would have any relevant way to transform pug code to HTML other than rendering the template completely.