Blocks:strip
From Dwoo Docs
Removes the white-space at the beginning and end of each line, and also removes all line breaks
strip(string $mode = 'default')
- mode : the stripping mode defines some rules to prevent harmful behavior on some types of content, currently the only special mode is "js" or "javascript" that ensures javascript line comments do not break the script
Example:
{strip}
spaces between words in a same line
- are not removed -
but
everything
else
is
{/strip}
Output:
spaces between words in a same line- are not removed -buteverythingelseis
If you have a template with inline-Javascript, the {strip} plugin might break your script if it contains line comments.
Take a look at this example:
{strip}
<script type="text/javascript">
// say hello!
alert("hello!");
</script>
{/strip}
This will render the output to:
<script type="text/javascript"> // say hello! alert("hello!"); </script>
The script is on a single line now, and since the first line is a comment, everything is treated as a comment. To avoid this, use the "js" parameter inside the {strip} plugin.
{strip js}
<script type="text/javascript">
// say hello!
alert("hello!");
</script>
{/strip}
- This will remove all comments inside the script.
- Be careful to code properly and end each instruction with a ";", otherwise it might become "foo()bar()" and the browser will most likely treat that as an error. Use JSLint to test your code if you have issues.




