Skip to content

Commit

Permalink
Added input:button shortcut, fixed short tags (br)
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Oct 18, 2009
1 parent 31746b2 commit 744520f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
20 changes: 17 additions & 3 deletions TextMate/Sparkup.tmbundle/Support/sparkup.py
Expand Up @@ -350,7 +350,7 @@ def render(self):

# Short, self-closing tags (<br />)
elif self.name in short_tags:
output = "%s<%s />\n" % (indent, self.get_tag())
output = "%s<%s />\n" % (indent, self.get_default_tag())

# Tags with text, possibly
elif self.name != '' or \
Expand Down Expand Up @@ -594,6 +594,7 @@ def _init_element(self):
'opening_tag': '<!--[if !IE]><!-->',
'closing_tag': '<!--<![endif]-->'},
'html:4t': {
'expand': True,
'opening_tag':
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n' +
'<html lang="en">\n' +
Expand All @@ -606,6 +607,7 @@ def _init_element(self):
'</body>\n' +
'</html>'},
'html:4s': {
'expand': True,
'opening_tag':
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n' +
'<html lang="en">\n' +
Expand All @@ -618,6 +620,7 @@ def _init_element(self):
'</body>\n' +
'</html>'},
'html:xs': {
'expand': True,
'opening_tag':
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' +
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n' +
Expand All @@ -630,6 +633,7 @@ def _init_element(self):
'</body>\n' +
'</html>'},
'html:xxs': {
'expand': True,
'opening_tag':
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n' +
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n' +
Expand All @@ -642,6 +646,7 @@ def _init_element(self):
'</body>\n' +
'</html>'},
'html:5': {
'expand': True,
'opening_tag':
'<!DOCTYPE html>\n' +
'<html lang="en">\n' +
Expand All @@ -653,13 +658,22 @@ def _init_element(self):
'closing_tag':
'</body>\n' +
'</html>'},
'input:button': {
'name': 'input',
'attributes': {
'class': 'button',
'type': 'button',
'name': '',
'value': ''}
},
}
if name in shortcuts.keys():
for key, value in shortcuts[name].iteritems():
setattr(self, key, value)
return
if 'html' in name:
return

if (name == ''): self.name = 'div'
elif (name == ''): self.name = 'div'
else: self.name = name

# Get the class names
Expand Down
20 changes: 17 additions & 3 deletions sparkup
Expand Up @@ -350,7 +350,7 @@ class Element:

# Short, self-closing tags (<br />)
elif self.name in short_tags:
output = "%s<%s />\n" % (indent, self.get_tag())
output = "%s<%s />\n" % (indent, self.get_default_tag())

# Tags with text, possibly
elif self.name != '' or \
Expand Down Expand Up @@ -594,6 +594,7 @@ class Token:
'opening_tag': '<!--[if !IE]><!-->',
'closing_tag': '<!--<![endif]-->'},
'html:4t': {
'expand': True,
'opening_tag':
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n' +
'<html lang="en">\n' +
Expand All @@ -606,6 +607,7 @@ class Token:
'</body>\n' +
'</html>'},
'html:4s': {
'expand': True,
'opening_tag':
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n' +
'<html lang="en">\n' +
Expand All @@ -618,6 +620,7 @@ class Token:
'</body>\n' +
'</html>'},
'html:xs': {
'expand': True,
'opening_tag':
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' +
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n' +
Expand All @@ -630,6 +633,7 @@ class Token:
'</body>\n' +
'</html>'},
'html:xxs': {
'expand': True,
'opening_tag':
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n' +
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n' +
Expand All @@ -642,6 +646,7 @@ class Token:
'</body>\n' +
'</html>'},
'html:5': {
'expand': True,
'opening_tag':
'<!DOCTYPE html>\n' +
'<html lang="en">\n' +
Expand All @@ -653,13 +658,22 @@ class Token:
'closing_tag':
'</body>\n' +
'</html>'},
'input:button': {
'name': 'input',
'attributes': {
'class': 'button',
'type': 'button',
'name': '',
'value': ''}
},
}
if name in shortcuts.keys():
for key, value in shortcuts[name].iteritems():
setattr(self, key, value)
return
if 'html' in name:
return

if (name == ''): self.name = 'div'
elif (name == ''): self.name = 'div'
else: self.name = name

# Get the class names
Expand Down

0 comments on commit 744520f

Please sign in to comment.