pug-php / pug

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

Variables beginning with undercore not parsed in template #136

Closed stevenmunro closed 7 years ago

stevenmunro commented 7 years ago

I don't know if this is an actual bug but it is my desire to have my variables begin with an underscore (for other reasons). However it appears that these can not be parsed.

$html = $this->pugrenderer->render($template, [ '_message' => 'hello' ]);

p #{_message}

Is there a way around this?

stevenmunro commented 7 years ago

This works for

'expressionLanguage' => 'js'

Not for

'expressionLanguage' => 'php'

kylekatarnls commented 7 years ago

php means you must write expressions in PHP:

p #{$_message}

auto mode is like PHP but will do just some basic transformations such as add $ and handle simple . getters. So in auto mode, you can also use p #{_message}. js mode convert JS codes in PHP with a dedicated parser/compiler.