Comments (4)
I just add tests for this issue, I can not reproduce this issue. May you test on current master version again or provide sample code? thanks.
from lightncandy.
Here is the code:
<?php
require 'lightncandy.php';
$template = '{{#with items}}
{{/with}}';
$tplString = \LightnCandy::compile($template, [\LightnCandy::FLAG_WITH]);
print_r(\LightnCandy::getContext());
?>
from lightncandy.
Result:
Array
(
[flags] => Array
(
[errorlog] => 0
[exception] => 0
[skippartial] => 0
[standalone] => 0
[jstrue] => 0
[jsobj] => 0
[jsquote] => 0
[this] => 0
[with] => 0
[parent] => 0
[echo] => 16384
[advar] => 0
[namev] => 0
[spvar] => 0
[slash] => 0
[else] => 0
[exhlp] => 0
[mustsp] => 0
[mustlok] => 0
[mustpi] => 0
[debug] => 0
[prop] => 0
[method] => 0
[runpart] => 0
)
[level] => 0
[stack] => Array
(
[0] => ['with']
)
[error] => Array
(
[0] => Unexpect token /with !
)
[basedir] => Array
(
[0] => /home/a/projects/csr/protected/vendor/zordius/lightncandy/src
)
[fileext] => Array
(
[0] => .tmpl
)
[tokens] => Array
(
[ahead] =>
[current] => 2
[count] => 2
[startchar] => {
[left] => {{
[right] => }}
[search] => /^(.*?)(\s*)(\{{2,3})(~?)([\^#\/!&>]?)(.*?)(~?)(\}{2,3})(\s*)(.*)$/s
)
[usedPartial] => Array
(
)
[partialStack] => Array
(
)
[partialCode] =>
[usedFeature] => Array
(
[rootthis] => 0
[enc] => 0
[raw] => 0
[sec] => 1
[isec] => 0
[if] => 0
[else] => 0
[unless] => 0
[each] => 0
[this] => 0
[parent] => 0
[with] => 0
[dot] => 0
[comment] => 0
[partial] => 0
[helper] => 0
[bhelper] => 0
[hbhelper] => 0
[delimiter] => 0
)
[usedCount] => Array
(
[var] => Array
(
)
[helpers] => Array
(
)
[blockhelpers] => Array
(
)
[hbhelpers] => Array
(
)
[lcrun] => Array
(
[sec] => 1
)
)
[helpers] => Array
(
)
[blockhelpers] => Array
(
)
[hbhelpers] => Array
(
)
[ops] => Array
(
[seperator] => ,
[f_start] => echo
[f_end] => ;
[op_start] => ob_start();echo
[op_end] => ;return ob_get_clean();
[cnd_start] => ;if
[cnd_then] => {echo
[cnd_else] => ;}else{echo
[cnd_end] => ;}echo
[enc] => enc
)
)
PHP version
php -v
PHP 5.5.9-1ubuntu4.3 (cli) (built: Jul 7 2014 16:36:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
from lightncandy.
There is a small wrong place in your code, try this:
$tplString = \LightnCandy::compile($template, Array('flags' => LightnCandy::FLAG_WITH));
Then it works well. But, there is still one bug when compile without LightnCandy::FLAG_WITH
, I will fix it later.
from lightncandy.
Related Issues (20)
- Valid use for Lightncandy::prepare() HOT 6
- Nested Helpers Unavailable When Rendered
- The problem in PHP8 HOT 7
- Bad indentation in case of nested partials
- Different behaviour than Javascript when modifying context in helper HOT 1
- Hi...broken forum link
- Opencart 1.5.6 Integration
- SafeString fails with FLAG_EXTHELPER | FLAG_BESTPERFORMANCE
- Custom condition helper over payload array with conditions
- Subexpression with a string where zero spaces occur before parenthesis breaks Parser
- Custom Block Helper with blockParams
- PHP Warning: Undefined array key when trying to access unavailable key from parent context
- Possible bug with `$context['flags']['debug']`? HOT 1
- Helpers closure causes error in Laravel HOT 1
- Arrow function helpers generate invalid php code
- Parentheses in subexpression argument cause error
- .git included in vendor distribution causes errors in grunt and other tools HOT 1
- length with @root is causing parse error
- Custom each does not support `as | a index |` syntax
- Multiple `@partial-block`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightncandy.