LightnCandy option: FLAG_HBESCAPE

Align {{foo}} escaping logic with handlebars.js. This causes ', = and ` be escaped in different way.

Sample Codes

The default escaping is by htmlentities only.

Data:
array(
  "foo" => "Love & <b>Peace</b>"
)
Template:
{{foo}}
Result:
Love &amp; &lt;b&gt;Peace&lt;/b&gt;
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => "Love & <b>Peace</b>"
);
echo $render($data);

Escaping ':

Data:
array(
  "foo" => "Single Quote is '"
)
Template:
{{foo}}
Result:
Single Quote is &#039;
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => "Single Quote is '"
);
echo $render($data);

Escaping ':

Used option: FLAG_HBESCAPE

Data:
array(
  "foo" => "Single Quote is '"
)
Template:
{{foo}}
Result:
Single Quote is &#x27;
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_HBESCAPE
));
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => "Single Quote is '"
);
echo $render($data);

Escaping `:

Data:
array(
  "foo" => "Backtick is `"
)
Template:
{{foo}}
Result:
Backtick is `
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => "Backtick is `"
);
echo $render($data);

Escaping `:

Used option: FLAG_HBESCAPE

Data:
array(
  "foo" => "Backtick is `"
)
Template:
{{foo}}
Result:
Backtick is &#x60;
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_HBESCAPE
));
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => "Backtick is `"
);
echo $render($data);

Escaping =:

Data:
array(
  "foo" => "Equal is ="
)
Template:
{{foo}}
Result:
Equal is =
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => "Equal is ="
);
echo $render($data);

Escaping =:

Used option: FLAG_HBESCAPE

Data:
array(
  "foo" => "Equal is ="
)
Template:
{{foo}}
Result:
Equal is &#x3D;
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_HBESCAPE
));
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => "Equal is ="
);
echo $render($data);