mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
* Imported ""# condition:" directive to all snippets
* Start writing the insert tag snippet-command
This commit is contained in:
parent
088ba32300
commit
fb1a98dcbf
@ -2,5 +2,6 @@
|
||||
# key: !
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IE Conditional Comment: Internet Explorer 5.0 only
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!--[if IE 5.0]>${1:${TM_SELECTED_TEXT: IE Conditional Comment: Internet Explorer 5.0 only }}<![endif]-->$0
|
@ -2,5 +2,6 @@
|
||||
# key: !
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IE Conditional Comment: Internet Explorer 5.5 only
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!--[if IE 5.5000]>${1:${TM_SELECTED_TEXT: IE Conditional Comment: Internet Explorer 5.5 only }}<![endif]-->$0
|
@ -2,5 +2,6 @@
|
||||
# key: !
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IE Conditional Comment: Internet Explorer 5.x
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!--[if lt IE 6]>${1:${TM_SELECTED_TEXT: IE Conditional Comment: Internet Explorer 5.x }}<![endif]-->$0
|
@ -2,5 +2,6 @@
|
||||
# key: !
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IE Conditional Comment: Internet Explorer 6 and below
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!--[if lte IE 6]>${1:${TM_SELECTED_TEXT: IE Conditional Comment: Internet Explorer 6 and below }}<![endif]-->$0
|
@ -2,5 +2,6 @@
|
||||
# key: !
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IE Conditional Comment: Internet Explorer 6 only
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!--[if IE 6]>${1:${TM_SELECTED_TEXT: IE Conditional Comment: Internet Explorer 6 only }}<![endif]-->$0
|
@ -2,5 +2,6 @@
|
||||
# key: !
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IE Conditional Comment: Internet Explorer 7 and above
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!--[if gte IE 7]>${1:${TM_SELECTED_TEXT: IE Conditional Comment: Internet Explorer 7 and above }}<![endif]-->$0
|
@ -2,5 +2,6 @@
|
||||
# key: !
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IE Conditional Comment: Internet Explorer
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!--[if IE]>${1:${TM_SELECTED_TEXT: IE Conditional Comment: Internet Explorer }}<![endif]-->$0
|
@ -2,5 +2,6 @@
|
||||
# key: !
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IE Conditional Comment: NOT Internet Explorer
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!--[if !IE]><!-->${1:${TM_SELECTED_TEXT: IE Conditional Comment: NOT Internet Explorer }}<!-- <![endif]-->$0
|
@ -2,5 +2,6 @@
|
||||
# key: arrow
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: →
|
||||
## condition: "text.html"
|
||||
# --
|
||||
→
|
@ -2,5 +2,6 @@
|
||||
# key: backspace
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⌫
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⌫
|
@ -2,5 +2,6 @@
|
||||
# key: backtab
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⇤
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⇤
|
@ -2,5 +2,6 @@
|
||||
# key: command
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⌘
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⌘
|
@ -2,5 +2,6 @@
|
||||
# key: control
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⌃
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⌃
|
@ -2,5 +2,6 @@
|
||||
# key: delete
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⌦
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⌦
|
@ -2,5 +2,6 @@
|
||||
# key: down
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ↓
|
||||
## condition: "text.html"
|
||||
# --
|
||||
↓
|
@ -2,5 +2,6 @@
|
||||
# key: enter
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⌅
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⌅
|
@ -2,5 +2,6 @@
|
||||
# key: escape
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⎋
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⎋
|
@ -2,5 +2,6 @@
|
||||
# key: left
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ←
|
||||
## condition: "text.html"
|
||||
# --
|
||||
←
|
@ -2,5 +2,6 @@
|
||||
# key: option
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⌥
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⌥
|
@ -2,5 +2,6 @@
|
||||
# key: return
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ↩
|
||||
## condition: "text.html"
|
||||
# --
|
||||
↩
|
@ -2,5 +2,6 @@
|
||||
# key: right
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: →
|
||||
## condition: "text.html"
|
||||
# --
|
||||
→
|
@ -2,5 +2,6 @@
|
||||
# key: shift
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⇧
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⇧
|
@ -2,5 +2,6 @@
|
||||
# key: tab
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ⇥
|
||||
## condition: "text.html"
|
||||
# --
|
||||
⇥
|
@ -2,5 +2,6 @@
|
||||
# key: up
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ↑
|
||||
## condition: "text.html"
|
||||
# --
|
||||
↑
|
@ -1,6 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Non-Breaking Space
|
||||
# binding: "~ "
|
||||
## binding: "~ "
|
||||
## condition: "text.html"
|
||||
# --
|
||||
|
@ -1,6 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Emphasize
|
||||
# binding: "@i"
|
||||
# binding: "A-i"
|
||||
## condition: "text.html"
|
||||
# --
|
||||
${0:${TM_SELECTED_TEXT/\A<em>(.*)<\/em>\z|.*/(?1:$1:<em>$0<\/em>)/m}}
|
||||
(yas/html-wrap-selection-if-not-wrapped-already "em")
|
||||
|
@ -1,6 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# type: command
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Strong
|
||||
# binding: "@b"
|
||||
# binding: "A-b"
|
||||
## condition: "text.html"
|
||||
# --
|
||||
${0:${TM_SELECTED_TEXT/\A<strong>(.*)<\/strong>\z|.*/(?1:$1:<strong>$0<\/strong>)/m}}
|
||||
(yas/html-wrap-selection-if-not-wrapped-already "strong")
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: doctype
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: HTML — 4.01 Strict
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: doctype
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: XHTML — 1.0 Frameset
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: doctype
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: XHTML — 1.0 Strict
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: doctype
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: XHTML — 1.0 Transitional
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: doctype
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: XHTML — 1.1
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: doctype
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: HTML — 4.01 Transitional
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
48
extras/imported/html-mode/Insert Tag Pair.yasnippet
Normal file
48
extras/imported/html-mode/Insert Tag Pair.yasnippet
Normal file
@ -0,0 +1,48 @@
|
||||
# -*- mode: snippet -*-
|
||||
# type: command
|
||||
# contributor: joaotavora, adapted from TextMate HTML bundle, work in progress
|
||||
# name: Insert Open/Close Tag (With Current Word)
|
||||
# binding: "^<"
|
||||
## condition: "text.html,"
|
||||
# --
|
||||
(let* ((tag yas/selected-text)
|
||||
(single-no-arg "\\(br\\|hr\\)")
|
||||
(single "\\(img\\|meta\\|link\\|input\\|base\\|area\\|col\\|frame\\|param\\)"))
|
||||
(cond ((string-match single-no-arg yas/selected-text))))
|
||||
# This script will expand the current word into: <word></word>
|
||||
# It will recognize HTML 4.0 tags that need no close tag.
|
||||
#
|
||||
# With no current word, it will insert: <p></p> and allows you
|
||||
# to overwrite the tag name and add potential arguments.
|
||||
#
|
||||
# The result is inserted as a snippet, so it's
|
||||
# possible to tab through the place holders.
|
||||
|
||||
# single tags
|
||||
single_no_arg = /^(?:br|hr)$/i
|
||||
single = /^(?:img|meta|link|input|base|area|col|frame|param)$/i
|
||||
|
||||
# we are not in HTML mode, so let's scrap the above hardcoded tag lists
|
||||
unless ENV.has_key? 'TM_HTML_EMPTY_TAGS' then
|
||||
single_no_arg = /(?=not)possible/
|
||||
single = /(?=not)possible/
|
||||
end
|
||||
|
||||
# handle the case where caret is in the middle of a word, assume only the left part is the tag
|
||||
index = ENV['TM_LINE_INDEX'].to_i - ENV['TM_INPUT_START_LINE_INDEX'].to_i
|
||||
tag, suffix = STDIN.read, ''
|
||||
if index < tag.length && !ENV['TM_SELECTED_TEXT']
|
||||
tag, suffix = tag[0...index], tag[index..-1]
|
||||
end
|
||||
|
||||
xhtml = ENV['TM_XHTML'].to_s
|
||||
|
||||
print case tag
|
||||
when single_no_arg then "<#{tag}#{xhtml}>"
|
||||
when single then "<#{tag} $1#{xhtml}>"
|
||||
when '' then "<${1:#{ENV['TM_DEFAULT_TAG'] || 'p'}}>$2</${1/\\s.*//}>"
|
||||
else "<#{tag}>$1</#{tag.strip[/^\S+/]}>"
|
||||
end
|
||||
|
||||
print suffix
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: movie
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Embed QT Movie
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
|
||||
<param name="src" value="$1"${TM_XHTML}>
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: fieldset
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Fieldset
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<fieldset id="${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}" ${2:class="${3:}"}>
|
||||
<legend>${1:`yas/selected-text`}</legend>
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: input
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Input with Label
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}${TM_XHTML}>
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: opt
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Option
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<option${1: value="${2:option}"}>${3:$2}</option>
|
@ -2,6 +2,7 @@
|
||||
# key: select
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Select Box
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
|
||||
<option${9: value="${10:option1}"}>${11:$10}</option>
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: input
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Input
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}${TM_XHTML}>
|
@ -2,5 +2,6 @@
|
||||
# key: textarea
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Text Area
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
@ -2,5 +2,6 @@
|
||||
# key: mailto
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Mail Anchor
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
@ -2,5 +2,6 @@
|
||||
# key: base
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Base
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<base href="$1"${2: target="$3"}${TM_XHTML}>
|
@ -2,6 +2,7 @@
|
||||
# key: body
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Body
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<body id="${1:${TM_FILENAME/(.*)\..*/\L$1/}}"${2: onload="$3"}>
|
||||
$0
|
||||
|
@ -1,6 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Br
|
||||
# binding: "^
"
|
||||
## binding: "^
"
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<br${TM_XHTML}>
|
@ -2,6 +2,7 @@
|
||||
# key: div
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Div
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<div${1: id="${2:name}"}>
|
||||
`yas/selected-text`$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: form
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Form
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<form action="${1:${TM_FILENAME/(.*?)\..*/$1_submit/}}" method="${2:get}" accept-charset="utf-8">
|
||||
$0
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: h1
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Heading
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<h1 id="${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}">${1:`yas/selected-text`}</h1>
|
@ -2,6 +2,7 @@
|
||||
# key: head
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Head
|
||||
## condition: "text.html - text.html source"
|
||||
# --
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"${TM_XHTML}>
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: link
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Link
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"${TM_XHTML}>
|
@ -2,5 +2,6 @@
|
||||
# key: meta
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Meta
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<meta name="${1:name}" content="${2:content}"${TM_XHTML}>
|
@ -2,5 +2,6 @@
|
||||
# key: scriptsrc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Script With External Source
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<script src="$1" type="text/javascript" charset="${3:utf-8}"></script>
|
@ -2,6 +2,7 @@
|
||||
# key: script
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Script
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: style
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Style
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<style type="text/css" media="screen">
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: table
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Table
|
||||
## condition: "text.html"
|
||||
# --
|
||||
<table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}>
|
||||
<tr><th>${5:Header}</th></tr>
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: title
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Title
|
||||
## condition: "text.html - text.blog"
|
||||
# --
|
||||
<title>${1:${TM_FILENAME/((.+)\..*)?/(?2:$2:Page Title)/}}</title>
|
@ -1,7 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Special: Return Inside Empty Open/Close Tags
|
||||
# binding: "
"
|
||||
## binding: "
"
|
||||
## condition: "meta.scope.between-tag-pair"
|
||||
# --
|
||||
|
||||
$0
|
||||
|
@ -1,6 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Wrap Selection in Open/Close Tag
|
||||
# binding: "^W"
|
||||
## binding: "^W"
|
||||
## condition: "text.html,"
|
||||
# --
|
||||
<${1:p}>`yas/selected-text`</${1/\s.*//}>
|
@ -1,5 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Wrap in <?= … ?>
|
||||
## condition: "text.html string"
|
||||
# --
|
||||
<?= `yas/selected-text` ?>
|
Loading…
x
Reference in New Issue
Block a user