|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Which syntax you like? |
{tag--} |
|
50% |
[ 1 ] |
{tag>>} |
|
50% |
[ 1 ] |
{tag<<} |
|
0% |
[ 0 ] |
|
Total Votes : 2 |
|
Author |
Message |
VEG Smarty Rookie
Joined: 02 May 2010 Posts: 20 Location: Belarus
|
Posted: Fri Apr 19, 2013 6:03 am Post subject: Whitespace control in Smarty 3.2 |
|
|
Code: | Whitespaces in front or after tags can now be controled by the tag itself.
{-tag} remove white space infront of tag up to the previous non-whitespace character or beginning of the line
"text \n\n\t {-tag}" -> "text \n\n{tag}"
"text \n\n\t text\t {-tag}" -> "text \n\n\t text{tag}"
{--tag} remove white space infront of tag up to the previous non-whitespace character
"text \n\n\t {--tag}" -> "text{tag}"
"text \n\n\t text\t {--tag}" -> "text \n\n\t text{tag}"
{tag-} remove white space after tag up to the next non-whitespace character or end of the line
"{tag-} \n\n\t text" -> "{tag}\n\n\t text"
"{tag-} text \n\n\t text" -> "{tag}text \n\n\t text"
{tag--} remove white space after tag up to the next non-whitespace character
"{tag--} \n\n\t text" -> "{tag}text"
"{tag--} text \n\n\t text" -> "{tag}text \n\n\t text" |
I think that {$var--} looks a little weird. Maybe better to use different syntax?
For example:
Code: |
{<tag} instead of {-tag}
{<<tag} instead of {--tag}
{tag>>} instead of {tag--}
{tag>} instead of {tag-}
{<>} (remove spaces before and after this construction)
{<} (remove spaces only before this construction)
{<<>>} (remove spaces and newlines before and after this construction)
{<>>} (remove spaces before, and spaces+newlines after this construction)
|
Or another variant inspired by the </li><li>:
Code: |
{><} (remove spaces before and after this construction)
{>} (remove spaces only before this construction)
{>><<} (remove spaces and newlines before and after this construction)
{><<} (remove spaces before, and spaces+newlines after this construction)
{>tag} instead of {-tag}
{>>tag} instead of {--tag}
{tag<<} instead of {tag--}
{tag<} instead of {tag-}
|
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|