Skip to content
Browse files

Retain inner } braces, useful for templates

When div{{{title}}} is mapped it will become <div>{{title}}</div>
  • Loading branch information...
1 parent 047fd15 commit 2fa779e539a10a8f120cc12d75a2f4a0a09e05d2 @maurizi maurizi committed Sep 10, 2013
Showing with 7 additions and 3 deletions.
  1. +1 −1 sparkup
  2. +5 −1 sparkup-unittest.py
  3. +1 −1 vim/ftplugin/html/sparkup.py
View
2 sparkup
@@ -869,7 +869,7 @@ class Token:
# Try looking for text
text = None
- for text in re.findall('\{([^\}]*)\}', self.str):
+ for text in re.findall('\{(.*?)\}(?!\})', self.str):
self.str = self.str.replace("{" + text + "}", "")
if text is not None:
self.text = text
View
6 sparkup-unittest.py
@@ -69,7 +69,7 @@ class SparkupTest:
},
'Multiplier test 2': {
'input': 'ul > li.item-$*3',
- 'output': '<ul>\n <li class="item-1">$1</li>\n <li class="item-2">$2</li>\n <li class="item-3">$3</li>\n</ul>$0'
+ 'output': '<ul>\n <li class="item-1">$1</li>\n <li class="item-2">$2</li>\n <li class="item-3">$3</li>\n</ul>$0'
},
'Multiplier test 3': {
'input': 'ul > li.item-$*3 > a',
@@ -99,6 +99,10 @@ class SparkupTest:
'input': 'p [attrib=text.com]',
'output': '<p attrib="text.com">$1</p>$0'
},
+ 'Nested curly braces test': {
+ 'input': 'p{{{ title }}}',
+ 'output': '<p>{{ title }}</p>$0'
+ },
# Add: text test, broken test, multi-attribute tests, indentation test, start and end comments test
}
def run(self):
View
2 vim/ftplugin/html/sparkup.py
@@ -869,7 +869,7 @@ def _init_element(self):
# Try looking for text
text = None
- for text in re.findall('\{([^\}]*)\}', self.str):
+ for text in re.findall('\{(.*?)\}(?!\})', self.str):
self.str = self.str.replace("{" + text + "}", "")
if text is not None:
self.text = text

0 comments on commit 2fa779e

Please sign in to comment.
Something went wrong with that request. Please try again.