diff --git a/UltiSnips/tm_css.snippets b/UltiSnips/tm_css.snippets new file mode 100644 index 0000000..02d5663 --- /dev/null +++ b/UltiSnips/tm_css.snippets @@ -0,0 +1,411 @@ +snippet ! "!important CSS (!)" +${1:!important} +endsnippet + +snippet fixed "Fixed Position Bottom 100% wide IE6" +${2:bottom: auto;}top: expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-${1:THE HEIGHT OF THIS THING IN PIXELS})); +${3:left: expression(eval(document.documentElement.scrollLeft)); +}${4:width: expression(eval(document.documentElement.clientWidth));}$0 +endsnippet + +snippet background "background-attachment: scroll:fixed (background)" +background-attachment: ${1:scroll/fixed};$0 +endsnippet + +snippet background "background-color: color-hex (background)" +background-color: #${1:DDD};$0 +endsnippet + +snippet background "background-color: color-name (background)" +background-color: ${1:red};$0 +endsnippet + +snippet background "background-color: color-rgb (background)" +background-color: rgb(${1:255},${2:255},${3:255});$0 +endsnippet + +snippet background "background-color: transparent (background)" +background-color: transparent;$0 +endsnippet + +snippet background "background-image: none (background)" +background-image: none;$0 +endsnippet + +snippet background "background-image: url (background)" +background-image: url($1);$0 +endsnippet + +snippet background "background-position: position (background)" +background-position: ${1:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0 +endsnippet + +snippet background "background-repeat: r:r-x:r-y:n-r (background)" +background-repeat: ${1:repeat/repeat-x/repeat-y/no-repeat};$0 +endsnippet + +snippet background "background: color image repeat attachment position (background)" +background:${6: #${1:DDD}} url($2) ${3:repeat/repeat-x/repeat-y/no-repeat} ${4:scroll/fixed} ${5:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0 +endsnippet + +snippet border "border-bottom-color: size style color (border)" +border-bottom-color: #${1:999};$0 +endsnippet + +snippet border "border-bottom-style: size style color (border)" +border-bottom-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-bottom-width: size style color (border)" +border-bottom-width: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-bottom: size style color (border)" +border-bottom: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-color: color (border)" +border-color: ${1:999};$0 +endsnippet + +snippet border "border-left-color: color (border)" +border-right-color: #${1:999};$0 +endsnippet + +snippet border "border-left-style: style (border)" +border-left-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-left-width: size (border)" +border-left-width: ${1:1}px +endsnippet + +snippet border "border-left: size style color (border)" +border-left: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-right-color: color (border)" +border-right-color: #${1:999};$0 +endsnippet + +snippet border "border-right-style: style (border)" +border-right-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-right-width: size (border)" +border-right-width: ${1:1}px +endsnippet + +snippet border "border-right: size style color (border)" +border-right: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-style: style (border)" +border-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-top-color: color (border)" +border-top-color: #${1:999};$0 +endsnippet + +snippet border "border-top-style: style (border)" +border-top-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-top-width: size (border)" +border-top-width: ${1:1}px +endsnippet + +snippet border "border-top: size style color (border)" +border-top: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-width: width (border)" +border-width: ${1:1px};$0 +endsnippet + +snippet border "border: size style color (border)" +border: ${1:1px} ${2:solid} #${3:999};$0 +endsnippet + +snippet clear "clear: value (clear)" +clear: ${1:left/right/both/none};$0 +endsnippet + +snippet color "color: color-hex (color)" +color: #${1:DDD};$0 +endsnippet + +snippet color "color: color-name (color)" +color: ${1:red};$0 +endsnippet + +snippet color "color: color-rgb (color)" +color: rgb(${1:255},${2:255},${3:255});$0 +endsnippet + +snippet cursor "cursor: type (cursor)" +cursor: ${1:default/auto/crosshair/pointer/move/*-resize/text/wait/help};$0 +endsnippet + +snippet cursor "cursor: url (cursor)" +cursor: url($1);$0 +endsnippet + +snippet direction "direction: ltr|rtl (direction)" +direction: ${1:ltr|rtl};$0 +endsnippet + +snippet display "display: block (display)" +display: block;$0 +endsnippet + +snippet display "display: common-types (display)" +display: ${1:none/inline/block/list-item/run-in/compact/marker};$0 +endsnippet + +snippet display "display: inline (display)" +display: inline;$0 +endsnippet + +snippet display "display: table-types (display)" +display: ${1:table/inline-table/table-row-group/table-header-group/table-footer-group/table-row/table-column-group/table-column/table-cell/table-caption};$0 +endsnippet + +snippet background "filter: AlphaImageLoader [for IE PNGs] (background)" +${3:background-image: none; +}filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1:${TM_SELECTED_TEXT:/images/transparent.png}}', sizingMethod='${2:image/scale/crop}'); +endsnippet + +snippet float "float: left:right:none (float)" +float: ${1:left/right/none};$0 +endsnippet + +snippet font "font-family: family (font)" +font-family: ${1:Arial, "MS Trebuchet"}, ${2:sans-}serif;$0 +endsnippet + +snippet font "font-size: size (font)" +font-size: ${1:100%};$0 +endsnippet + +snippet font "font-style: normal:italic:oblique (font)" +font-style: ${1:normal/italic/oblique};$0 +endsnippet + +snippet font "font-variant: normal:small-caps (font)" +font-variant: ${1:normal/small-caps};$0 +endsnippet + +snippet font "font-weight: weight (font)" +font-weight: ${1:normal/bold};$0 +endsnippet + +snippet font "font: style variant weight size:line-height font -family (font)" +font: ${1:normal/italic/oblique} ${2:normal/small-caps} ${3:normal/bold} ${4:1em/1.5em} ${5:Arial}, ${6:sans-}serif;$0 +endsnippet + +snippet font "font: size font (font)" +font: ${1:75%} ${2:"Lucida Grande", "Trebuchet MS", Verdana,} ${3:sans-}serif;$0 +endsnippet + +snippet letter "letter-spacing: length-em (letter)" +letter-spacing: $1em;$0 +endsnippet + +snippet letter "letter-spacing: length-px (letter)" +letter-spacing: $1px;$0 +endsnippet + +snippet list "list-style-image: url (list)" +list-style-image: url($1);$0 +endsnippet + +snippet list "list-style-position: pos (list)" +list-style-position: ${1:inside/outside};$0 +endsnippet + +snippet list "list-style-type: asian (list)" +list-style-type: ${1:cjk-ideographic/hiragana/katakana/hiragana-iroha/katakana-iroha};$0 +endsnippet + +snippet list "list-style-type: marker(list)" +list-style-type: ${1:none/disc/circle/square};$0 +endsnippet + +snippet list "list-style-type: numeric (list)" +list-style-type: ${1:decimal/decimal-leading-zero/zero};$0 +endsnippet + +snippet list "list-style-type: other (list)" +list-style-type: ${1:hebrew/armenian/georgian};$0 +endsnippet + +snippet list "list-style-type: roman-alpha-greek (list)" +list-style-type: ${1:lower-roman/upper-roman/lower-alpha/upper-alpha/lower-greek/lower-latin/upper-latin};$0 +endsnippet + +snippet list "list-style: type position image (list)" +list-style: ${1:none/disc/circle/square/decimal/zero} ${2:inside/outside} url($3);$0 +endsnippet + +snippet margin "margin-bottom: length (margin)" +margin-bottom: ${1:20px};$0 +endsnippet + +snippet margin "margin-left: length (margin)" +margin-left: ${1:20px};$0 +endsnippet + +snippet margin "margin-right: length (margin)" +margin-right: ${1:20px};$0 +endsnippet + +snippet margin "margin-top: length (margin)" +margin-top: ${1:20px};$0 +endsnippet + +snippet margin "margin: all (margin)" +margin: ${1:20px};$0 +endsnippet + +snippet margin "margin: T R B L (margin)" +margin: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 +endsnippet + +snippet margin "margin: V H (margin)" +margin: ${1:20px} ${2:0px};$0 +endsnippet + +snippet marker "marker-offset: auto (marker)" +marker-offset: auto;$0 +endsnippet + +snippet marker "marker-offset: length (marker)" +marker-offset: ${1:10px};$0 +endsnippet + +snippet opacity "opacity: [for Safari, FF and IE] (opacity)" +opacity: ${1:0.5};${100: +}-moz-opacity: ${1:0.5};${100: +}filter:alpha(opacity=${2:${1/(1?)0?\.(.*)/$1$2/}${1/^\d*\.\d\d+$|^\d*$|(^\d\.\d$)/(?1:0)/}});$0 +endsnippet + +snippet overflow "overflow: type (overflow)" +overflow: ${1:visible/hidden/scroll/auto};$0 +endsnippet + +snippet padding "padding-bottom: length (margin)" +padding-bottom: ${1:20px};$0 +endsnippet + +snippet padding "padding-left: length (margin)" +padding-left: ${1:20px};$0 +endsnippet + +snippet padding "padding-right: length (margin)" +padding-right: ${1:20px};$0 +endsnippet + +snippet padding "padding-top: length (margin)" +padding-top: ${1:20px};$0 +endsnippet + +snippet padding "padding: T R B L (padding)" +padding: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 +endsnippet + +snippet padding "padding: V H (padding)" +padding: ${1:20px} ${2:0px};$0 +endsnippet + +snippet padding "padding: all (padding)" +padding: ${1:20px};$0 +endsnippet + +snippet position "position: type (position)" +position: ${1:static/relative/absolute/fixed};$0 +endsnippet + +snippet { "properties { } ( } )" +{ + /* $1 */ + $0 + +endsnippet + +snippet scrollbar "scrollbar" +scrollbar-base-color: ${1:#CCCCCC};${2: +scrollbar-arrow-color: ${3:#000000}; +scrollbar-track-color: ${4:#999999}; +scrollbar-3dlight-color: ${5:#EEEEEE}; +scrollbar-highlight-color: ${6:#FFFFFF}; +scrollbar-face-color: ${7:#CCCCCC}; +scrollbar-shadow-color: ${9:#999999}; +scrollbar-darkshadow-color: ${8:#666666};} +endsnippet + +snippet selection "selection" +$1::-moz-selection, +$1::selection { + color: ${2:inherit}; + background: ${3:inherit}; +} +endsnippet + +snippet text "text-align: left:center:right (txt)" +text-align: ${1:left/right/center/justify};$0 +endsnippet + +snippet text "text-decoration: none:underline:overline:line-through:blink (text)" +text-decoration: ${1:none/underline/overline/line-through/blink};$0 +endsnippet + +snippet text "text-indent: length (text)" +text-indent: ${1:10}px;$0 +endsnippet + +snippet text "text-shadow: color-hex x y blur (text)" +text-shadow: #${1:DDD} ${2:10px} ${3:10px} ${4:2px};$0 +endsnippet + +snippet text "text-shadow: color-rgb x y blur (text)" +text-shadow: rgb(${1:255},${2:255},${3:255}) ${4:10px} ${5:10px} ${6:2px};$0 +endsnippet + +snippet text "text-shadow: none (text)" +text-shadow: none;$0 +endsnippet + +snippet text "text-transform: capitalize:upper:lower (text)" +text-transform: ${1:capitalize/uppercase/lowercase};$0 +endsnippet + +snippet text "text-transform: none (text)" +text-transform: none;$0 +endsnippet + +snippet vertical "vertical-align: type (vertical)" +vertical-align: ${1:baseline/sub/super/top/text-top/middle/bottom/text-bottom/length/%};$0 +endsnippet + +snippet visibility "visibility: type (visibility)" +visibility: ${1:visible/hidden/collapse};$0 +endsnippet + +snippet white "white-space: normal:pre:nowrap (white)" +white-space: ${1:normal/pre/nowrap};$0 +endsnippet + +snippet word "word-spacing: length (word)" +word-spacing: ${1:10px};$0 +endsnippet + +snippet word "word-spacing: normal (word)" +word-spacing: normal;$0 +endsnippet + +snippet z "z-index: index (z)" +z-index: $1;$0 +endsnippet + diff --git a/UltiSnips/tm_html.snippets b/UltiSnips/tm_html.snippets new file mode 100644 index 0000000..c420ea4 --- /dev/null +++ b/UltiSnips/tm_html.snippets @@ -0,0 +1,224 @@ +########################################################################### +# TextMate Snippets # +########################################################################### + + +snippet doctype "DocType XHTML 1.0 Strict" + + +endsnippet + +snippet doctype "DocType XHTML 1.0 Transitional" + + +endsnippet + +snippet doctype "DocType XHTML 1.1" + + +endsnippet + +snippet down "Down (down)" +↓ +endsnippet + +snippet movie "Embed QT movie (movie)" + + + + + + +endsnippet + +snippet enter "Enter (enter)" +⌅ +endsnippet + +snippet escape "Escape (escape)" +⎋ +endsnippet + +snippet fieldset "Fieldset" +
+ + + $0 +
+endsnippet + +snippet doctype "HTML - 4.0 Transitional (doctype)" + + +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 5_0 only" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 5_5 only" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 5_x" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 6 and below" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 6 only" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 7+" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer" +$0 +endsnippet + +snippet ! "IE Conditional Comment: NOT Internet Explorer" +${1:${TM_SELECTED_TEXT: IE Conditional Comment: NOT Internet Explorer }}$0 +endsnippet + +snippet input "Input with Label" + + +endsnippet + +snippet left "Left (left)" +← +endsnippet + +snippet option "Option (option)" +⌥ +endsnippet + +snippet opt "Option" +${3:$2} +endsnippet + +snippet return "Return (return)" +↩ +endsnippet + +snippet right "Right (right)" +→ +endsnippet + +snippet select "Select Box" + +endsnippet + +snippet shift "Shift (shift)" +⇧ +endsnippet + +snippet tab "Tab (tab)" +⇥ +endsnippet + +snippet up "Up (up)" +↑ +endsnippet + +snippet input "XHTML " + +endsnippet + +snippet textarea "XHTML +endsnippet + +snippet mailto "XHTML " +${3:email me} +endsnippet + +snippet base "XHTML " + +endsnippet + +snippet body "XHTML " + + $0 + +endsnippet + +snippet div "XHTML
" + + ${0:$TM_SELECTED_TEXT} +
+endsnippet + +snippet form "XHTML
" + + $0 + +

+
+endsnippet + +snippet h1 "XHTML

" +

${1:$TM_SELECTED_TEXT}

+endsnippet + +snippet head "XHTML " + + + ${1:${TM_FILENAME/((.+)\..*)?/(?2:$2:Page Title)/}} + $0 + +endsnippet + +snippet link "XHTML " + +endsnippet + +snippet meta "XHTML " + +endsnippet + +snippet scriptsrc "XHTML +endsnippet + +snippet script "XHTML +endsnippet + +snippet style "XHTML +endsnippet + +snippet table "XHTML " +
+ + +
${5:Header}
${0:Data}
+endsnippet + +snippet title "XHTML " +<title>${1:${TM_FILENAME/((.+)\..*)?/(?2:$2:Page Title)/}} +endsnippet + diff --git a/utils/get_tm_snippets.py b/utils/get_tm_snippets.py index 369dfd9..91de93f 100755 --- a/utils/get_tm_snippets.py +++ b/utils/get_tm_snippets.py @@ -4,15 +4,34 @@ import urllib import re from xml.etree import ElementTree +from xml.parsers.expat import ExpatError +import htmlentitydefs + +_UNESCAPE = re.compile(ur'&\w+?;', re.UNICODE) +def unescape(s): + if s is None: + return "" + def fixup(m): + ent = m.group(0)[1:-1] + print ent + return unichr(htmlentitydefs.name2codepoint[ent]) + try: + return _UNESCAPE.sub(fixup,s.decode("utf-8")).encode("utf-8") + except: + print s.decode("utf-8") def parse_content(c): - data = ElementTree.fromstring(c)[0] + try: + data = ElementTree.fromstring(c)[0] - rv = {} - for k,v in zip(data[::2], data[1::2]): - rv[k.text] = v.text + rv = {} + for k,v in zip(data[::2], data[1::2]): + rv[k.text] = unescape(v.text) - return rv + return rv + except ExpatError: + print " Syntax Error" + return None def fetch_snippets(name): base_url = "http://svn.textmate.org/trunk/Bundles/" + name + ".tmbundle/" @@ -28,11 +47,13 @@ def fetch_snippets(name): if name == "..": continue - name = name.rsplit('.', 1)[0] # remove Extension + name = unescape(name.rsplit('.', 1)[0]) # remove Extension print "Fetching data for Snippet '%s'" % name content = urllib.urlopen(snippet_idx + link).read() - rv.append((name, parse_content(content))) + cont = parse_content(content) + if cont: + rv.append((name, cont)) return rv @@ -44,7 +65,7 @@ def write_snippets(snip_descr, f): continue f.write('snippet %s "%s"\n' % (d["tabTrigger"], name)) - f.write(d["content"] + "\n") + f.write(d["content"].encode("utf-8") + "\n") f.write("endsnippet\n\n")