-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡️ Prepare text nodes during compiling
- Loading branch information
Showing
6 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1805,6 +1805,22 @@ Renderer.setCommand(function printUnsafe(content) { | |
return this.actualPrint(content); | ||
}); | ||
|
||
/** | ||
* Print the string as a text node | ||
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 2.4.0 | ||
* @version 2.4.0 | ||
* | ||
* @param {String} content | ||
* | ||
* @return {Number} The index of the pushed line | ||
*/ | ||
Renderer.setMethod(function printTextNode(content) { | ||
content = Hawkejs.Hawkejs.createTextNode(content); | ||
return this.actualPrint(content); | ||
}); | ||
|
||
/** | ||
* Safely print the contents | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -657,7 +657,7 @@ Builder.setMethod(function _compileBody(subroutine, body) { | |
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 2.2.0 | ||
* @version 2.3.8 | ||
* @version 2.4.0 | ||
* | ||
* @param {Hawkejs.Parser.Subroutine} subroutine | ||
* @param {Object} entry | ||
|
@@ -678,7 +678,8 @@ Builder.setMethod(function _compileEntry(subroutine, entry) { | |
this._compileEntry(subroutine, child); | ||
} | ||
} else if (entry.type == 'text') { | ||
subroutine.appendCall('__render.printUnsafe', [entry.value]); | ||
let value = Bound.String.decodeHTML(entry.value); | ||
subroutine.appendCall('__render.printTextNode', [value]); | ||
} else if (entry.type == 'open_tag') { | ||
|
||
let args = [], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{% extend "base_scene" %} | ||
|
||
{% set my_value = 47 %} | ||
|
||
{% block "main" %} | ||
<h1>Welcome to the Benchmark page!</h1> | ||
<p> | ||
This template is used to test the performance of the framework. | ||
</p> | ||
<p> | ||
Most elements on this page won't do anything. | ||
</p> | ||
<div> | ||
<a id="link-to-welcome" href="/welcome">Go to welcome</a><br> | ||
<a id="link-to-welcome-without-history" href="/welcome" data-he-history="false"> | ||
Go to welcome without history | ||
</a><br> | ||
</div> | ||
<div> | ||
<ul> | ||
<li>A simple string: {{ b_string }}</li> | ||
<li>A string containg HTML tags: {{ g_string }}</li> | ||
</ul> | ||
</div> | ||
{% if a_number gt 0 %} | ||
<p>`a_number` is greater than 0: {{ a_number }}</p> | ||
{% /if %} | ||
{% if does.not.exist gt 0 %} | ||
WRONG | ||
{% else %} | ||
<p>`does.not.exist` was successfully detected as not-existing</p> | ||
{% /if %} | ||
{% if h_array %} | ||
WRONG | ||
{% else %} | ||
<p>`h_array` was successfully detected as empty</p> | ||
{% /if %} | ||
<p>Getting `a` from a map: {{ e_object.map.get('a') }}</p> | ||
<p>`my_value` should be 47: {{ my_value }}</p> | ||
{% /block %} |