Skip to content

Commit

Permalink
Added 'jquery' shortcut, and 'jsapi' too
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Nov 5, 2009
1 parent f9241af commit 0b7817d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
26 changes: 24 additions & 2 deletions TextMate/Sparkup.tmbundle/Support/sparkup.py
Expand Up @@ -144,6 +144,18 @@ class HtmlDialect(Dialect):
'name': 'script',
'attributes': { 'src': '' }
},
'script:jquery': {
'name': 'script',
'attributes': { 'src': 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' }
},
'script:jsapi': {
'name': 'script',
'attributes': { 'src': 'http://www.google.com/jsapi' }
},
'script:jsapix': {
'name': 'script',
'text': '\n google.load("jquery", "1.3.2");\n google.setOnLoadCallback(function() {\n \n });\n'
},
'link:css': {
'name': 'link',
'attributes': { 'rel': 'stylesheet', 'type': 'text/css', 'href': '', 'media': 'all' },
Expand Down Expand Up @@ -199,26 +211,37 @@ class HtmlDialect(Dialect):
'input:c': 'input:checkbox',
'button': 'input:button',
'input:b': 'input:button',
'input:h': 'input:hidden',
'hidden': 'input:hidden',
'submit': 'input:submit',
'input:s': 'input:submit',
'radio': 'input:radio',
'input:r': 'input:radio',
'text': 'input:text',
'passwd': 'input:password',
'password': 'input:password',
'pw': 'input:password',
'input:t': 'input:text',
'linkcss': 'link:css',
'scriptsrc': 'script:src',
'jquery': 'script:jquery',
'jsapi': 'script:jsapi',
'html5': 'html:5',
'html4': 'html:4s',
'html4s': 'html:4s',
'html4l': 'html:4l',
'html4t': 'html:4t',
'xhtml': 'html:xxs',
'xhtmlt': 'html:xt',
'xhtmls': 'html:xs',
'xhtml11': 'html:xxs',
'opt': 'option',
'st': 'strong',
'css': 'style',
'csss': 'link:css',
'css:src': 'link:css',
'csssrc': 'link:css',
'js': 'script',
'jss': 'script:src',
'js:src': 'script:src',
'jssrc': 'script:src',
}
Expand Down Expand Up @@ -795,7 +818,6 @@ def _init_element(self):
[Private]
"""


# Get the tag name. Default to DIV if none given.
name = re.findall('^([\w\-:]*)', self.str)[0]
name = name.lower().replace('-', ':')
Expand Down
26 changes: 24 additions & 2 deletions sparkup
Expand Up @@ -144,6 +144,18 @@ class HtmlDialect(Dialect):
'name': 'script',
'attributes': { 'src': '' }
},
'script:jquery': {
'name': 'script',
'attributes': { 'src': 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' }
},
'script:jsapi': {
'name': 'script',
'attributes': { 'src': 'http://www.google.com/jsapi' }
},
'script:jsapix': {
'name': 'script',
'text': '\n google.load("jquery", "1.3.2");\n google.setOnLoadCallback(function() {\n \n });\n'
},
'link:css': {
'name': 'link',
'attributes': { 'rel': 'stylesheet', 'type': 'text/css', 'href': '', 'media': 'all' },
Expand Down Expand Up @@ -199,26 +211,37 @@ class HtmlDialect(Dialect):
'input:c': 'input:checkbox',
'button': 'input:button',
'input:b': 'input:button',
'input:h': 'input:hidden',
'hidden': 'input:hidden',
'submit': 'input:submit',
'input:s': 'input:submit',
'radio': 'input:radio',
'input:r': 'input:radio',
'text': 'input:text',
'passwd': 'input:password',
'password': 'input:password',
'pw': 'input:password',
'input:t': 'input:text',
'linkcss': 'link:css',
'scriptsrc': 'script:src',
'jquery': 'script:jquery',
'jsapi': 'script:jsapi',
'html5': 'html:5',
'html4': 'html:4s',
'html4s': 'html:4s',
'html4l': 'html:4l',
'html4t': 'html:4t',
'xhtml': 'html:xxs',
'xhtmlt': 'html:xt',
'xhtmls': 'html:xs',
'xhtml11': 'html:xxs',
'opt': 'option',
'st': 'strong',
'css': 'style',
'csss': 'link:css',
'css:src': 'link:css',
'csssrc': 'link:css',
'js': 'script',
'jss': 'script:src',
'js:src': 'script:src',
'jssrc': 'script:src',
}
Expand Down Expand Up @@ -795,7 +818,6 @@ class Token:
[Private]
"""


# Get the tag name. Default to DIV if none given.
name = re.findall('^([\w\-:]*)', self.str)[0]
name = name.lower().replace('-', ':')
Expand Down

0 comments on commit 0b7817d

Please sign in to comment.