Skip to content

Commit

Permalink
Fixed: A dot in text adds a class.
Browse files Browse the repository at this point in the history
Signed-off-by: Guillermo O. Freschi <tordek@tordek.com.ar>
  • Loading branch information
Guillermo O. Freschi committed Nov 26, 2009
1 parent e957361 commit 5807acc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 7 additions & 6 deletions sparkup
Expand Up @@ -844,6 +844,13 @@ class Token:
elif (name == ''): self.name = 'div'
else: self.name = name

# Try looking for text
text = None
for text in re.findall('\{([^\}]*)\}', self.str):
self.str = self.str.replace("{" + text + "}", "")
if text is not None:
self.text = text

# Get the class names
classes = []
for classname in re.findall('\.([\$a-zA-Z0-9_\-\&]+)', self.str):
Expand Down Expand Up @@ -875,12 +882,6 @@ class Token:
except: key, value = [attrib, '']
self.attributes[key] = value

# Try looking for text
text = None
for text in re.findall('\{([^\}]*)\}', self.str): pass
if text is not None:
self.text = text

# Populate flag (e.g., ul+)
flags = None
for flags in re.findall('[\+\!]+$', self.str): pass
Expand Down
4 changes: 4 additions & 0 deletions sparkup-unittest.py
Expand Up @@ -91,6 +91,10 @@ class SparkupTest:
'input': 'p#menu > table+ + ul',
'output': '<p id="menu">\n <table cellspacing="0">\n <tr>\n <td>$1</td>\n </tr>\n </table>\n <ul>$2</ul>\n</p>$0'
},
'Text with dot test': {
'input': 'p { text.com }',
'output': '<p> text.com </p>$0'
},
# Add: text test, broken test, multi-attribute tests, indentation test, start and end comments test
}
def run(self):
Expand Down

0 comments on commit 5807acc

Please sign in to comment.