* Fixed the "direct-keymaps" bug with `emulation-mode-map-alists'

* Fixed a bug when evaluating primary field expressions

* Completed importation of TextMate HTML snippets, some TextMate HTML commands missing.
This commit is contained in:
capitaomorte
2009-11-04 15:51:43 +00:00
parent 73bad7366f
commit 477f7c99e4
30 changed files with 111 additions and 82 deletions

View File

@@ -17,7 +17,7 @@
(setq word-begin (point))
(forward-word 1)
(setq word-end (point)))
(when (and (> word-end word-begin)
(when (and (< word-begin orig-point)
(>= word-end (point)))
(setq retval
(cons
@@ -57,12 +57,19 @@
(defun yas/html-wrap-each-line-in-openclose-tag ()
(let* ((mirror "${1:$(yas/html-first-word yas/text)}")
(yas/html-wrap-newline (when (string-match "\n" yas/selected-text) "\n"))
(template (concat (format "<${1:%s}>" (or yas/html-default-tag "p"))
yas/selected-text
"</" mirror ">")))
(setq template (replace-regexp-in-string "\n" (concat "</" mirror ">\n<" mirror ">") template))
(setq template (replace-regexp-in-string "\n" (concat "</" mirror ">\n<$1>") template))
(yas/expand-snippet template)))
(defun yas/html-wrap-selection-if-not-wrapped-already (wrapping)
(if (string-match (format "<%s>.*</%s>" wrapping wrapping) yas/selected-text)
(insert yas/selected-text)
(insert (format "<%s>%s</%s>" wrapping yas/selected-text wrapping))))
(defun yas/html-between-tag-pair-p ()
(save-excursion
(backward-word)

View File

@@ -4,4 +4,4 @@
# 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
<!--[if IE 5.0]>${1:`(or yas/selected-text " IE Conditional Comment: Internet Explorer 5.0 only ")`}<![endif]-->$0

View File

@@ -4,4 +4,4 @@
# 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
<!--[if IE 5.5000]>${1:`(or yas/selected-text " IE Conditional Comment: Internet Explorer 5.5 only ")`}<![endif]-->$0

View File

@@ -4,4 +4,4 @@
# 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
<!--[if lt IE 6]>${1:`(or yas/selected-text " IE Conditional Comment: Internet Explorer 5.x ")`}<![endif]-->$0

View File

@@ -4,4 +4,4 @@
# 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
<!--[if lte IE 6]>${1:`(or yas/selected-text " IE Conditional Comment: Internet Explorer 6 and below ")`}<![endif]-->$0

View File

@@ -4,4 +4,4 @@
# 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
<!--[if IE 6]>${1:`(or yas/selected-text " IE Conditional Comment: Internet Explorer 6 only ")`}<![endif]-->$0

View File

@@ -4,4 +4,4 @@
# 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
<!--[if gte IE 7]>${1:`(or yas/selected-text " IE Conditional Comment: Internet Explorer 7 and above ")`}<![endif]-->$0

View File

@@ -4,4 +4,4 @@
# name: IE Conditional Comment: Internet Explorer
## condition: "text.html"
# --
<!--[if IE]>${1:${TM_SELECTED_TEXT: IE Conditional Comment: Internet Explorer }}<![endif]-->$0
<!--[if IE]>${1:`(or yas/selected-text " IE Conditional Comment: Internet Explorer ")`}<![endif]-->$0

View File

@@ -4,4 +4,4 @@
# name: IE Conditional Comment: NOT Internet Explorer
## condition: "text.html"
# --
<!--[if !IE]><!-->${1:${TM_SELECTED_TEXT: IE Conditional Comment: NOT Internet Explorer }}<!-- <![endif]-->$0
<!--[if !IE]><!-->${1:`(or yas/selected-text " IE Conditional Comment: NOT Internet Explorer ")`}<!-- <![endif]-->$0

View File

@@ -1,7 +1,8 @@
# -*- mode: snippet -*-
# contributor: Translated from TextMate Snippet
# name: Non-Breaking Space
## binding: "~ "
# key: nbsp
## binding: " "
## condition: "text.html"
# --
&nbsp;

View File

@@ -1,7 +1,7 @@
# -*- mode: snippet -*-
# contributor: Translated from TextMate Snippet
# type: command
# name: Emphasize
# binding: "A-i"
# binding: A-i
## condition: "text.html"
# --
(yas/html-wrap-selection-if-not-wrapped-already "em")

View File

@@ -1,8 +1,7 @@
# -*- mode: snippet -*-
# type: command
# contributor: Translated from TextMate Snippet
# name: Strong
# binding: "A-b"
# binding: A-b
## condition: "text.html"
# --
(yas/html-wrap-selection-if-not-wrapped-already "strong")

View File

@@ -5,13 +5,13 @@
## 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}>
<param name="controller" value="$4"${TM_XHTML}>
<param name="autoplay" value="$5"${TM_XHTML}>
<param name="src" value="$1"`yas/html-xhtml-attr`>
<param name="controller" value="$4"`yas/html-xhtml-attr`>
<param name="autoplay" value="$5"`yas/html-xhtml-attr`>
<embed src="${1:movie.mov}"
width="${2:320}" height="${3:240}"
controller="${4:true}" autoplay="${5:true}"
scale="tofit" cache="true"
pluginspage="http://www.apple.com/quicktime/download/"
${TM_XHTML}>
pluginspage="http://www.apple.com/quicktime/download/"`(when (and yas/html-xhtml-attr (not (string= "" yas/html-xhtml-attr)))
(concat "\n" yas/html-xhtml-attr))`>
</object>

View File

@@ -4,7 +4,7 @@
# name: Fieldset
## condition: "text.html"
# --
<fieldset id="${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}" ${2:class="${3:}"}>
<fieldset id="${1:$(yas/html-id-from-string yas/text)}" ${2:class="$3"}>
<legend>${1:`yas/selected-text`}</legend>
$0

View File

@@ -4,4 +4,6 @@
# 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}>
<label for="${2:id$(yas/get-field-once 1 #'yas/html-id-from-string)}">$1</label><input type="${3:$$(yas/choose-value '("text" "submit" "hidden" "button"))}" name="${4:name$(
yas/get-field-once 2)}" value="$5"${6: id="${7:id$(
yas/get-field-once 2)}"}`yas/html-xhtml-attr`>

View File

@@ -4,4 +4,4 @@
# name: Option
## condition: "text.html"
# --
<option${1: value="${2:option}"}>${3:$2}</option>
<option${1: value="${2:option}"}>${3:option$(unless yas/modified-p (yas/field-value 2))}</option>

View File

@@ -4,8 +4,8 @@
# 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>
<option${12: value="${13:option2}"}>${14:$13}</option>${15:}
<select name="${1:some_name}" id="${2:id$(yas/get-field-once 1)}"${3:${4: multiple}${5: onchange="$6"}${7: size="${8:1}"}}>
<option${9: value="${10:option1}"}>${11:$$(yas/get-field-once 10)}</option>
<option${12: value="${13:option2}"}>${14:$$(yas/get-field-once 13)}</option>$15
$0
</select>

View File

@@ -4,4 +4,4 @@
# name: Base
## condition: "text.html"
# --
<base href="$1"${2: target="$3"}${TM_XHTML}>
<base href="$1"${2: target="$3"}`yas/html-xhtml-attr`>

View File

@@ -4,6 +4,8 @@
# name: Body
## condition: "text.html"
# --
<body id="${1:${TM_FILENAME/(.*)\..*/\L$1/}}"${2: onload="$3"}>
<body id="${1:`(or (and buffer-file-name
(downcase (file-name-sans-extension (file-name-nondirectory buffer-file-name))))
"some_id")`}"${2: onload="$3"}>
$0
</body>

View File

@@ -1,7 +1,7 @@
# -*- mode: snippet -*-
# contributor: Translated from TextMate Snippet
# name: Br
## binding: "^
# binding: M-RET
## condition: "text.html"
# --
# --
<br`yas/html-xhtml-attr`>

View File

@@ -4,8 +4,11 @@
# name: Form
## condition: "text.html"
# --
<form action="${1:${TM_FILENAME/(.*?)\..*/$1_submit/}}" method="${2:get}" accept-charset="utf-8">
<form action="${1:`(or (and buffer-file-name
(concat (file-name-sans-extension (file-name-nondirectory buffer-file-name))
"_submit"))
"some_action")`}" method="${2:get}" accept-charset="utf-8">
$0
<p><input type="submit" value="Continue &rarr;"${TM_XHTML}></p>
<p><input type="submit" value="Continue &rarr;"`yas/html-xhtml-attr`></p>
</form>

View File

@@ -4,4 +4,4 @@
# name: Heading
## condition: "text.html"
# --
<h1 id="${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}">${1:`yas/selected-text`}</h1>
<h1 id="${1:$(yas/html-id-from-string yas/text)}">${1:`yas/selected-text`}</h1>

View File

@@ -5,7 +5,9 @@
## condition: "text.html - text.html source"
# --
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"${TM_XHTML}>
<title>${1:${TM_FILENAME/((.+)\..*)?/(?2:$2:Page Title)/}}</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"`yas/html-xhtml-attr`>
<title>${1:`(or (and buffer-file-name
(file-name-sans-extension (file-name-nondirectory buffer-file-name)))
"Page Title")`}</title>
$0
</head>

View File

@@ -1,7 +1,6 @@
# -*- mode: snippet -*-
# 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}>
<input type="${1:$$(yas/choose-value '("text" "submit" "hidden" "button"))}" name="${2:some_name}" value="$3"${4: id="${5:$$(yas/get-field-once 2)}"}`yas/html-xhtml-attr`>

View File

@@ -4,4 +4,4 @@
# 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}>
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`yas/html-xhtml-attr`>

View File

@@ -4,4 +4,4 @@
# name: Meta
## condition: "text.html"
# --
<meta name="${1:name}" content="${2:content}"${TM_XHTML}>
<meta name="${1:name}" content="${2:content}"`yas/html-xhtml-attr`>

View File

@@ -4,4 +4,6 @@
# name: Title
## condition: "text.html - text.blog"
# --
<title>${1:${TM_FILENAME/((.+)\..*)?/(?2:$2:Page Title)/}}</title>
<title>${1:`(or (and buffer-file-name
(file-name-sans-extension (file-name-nondirectory buffer-file-name)))
"Page Title")`}</title>

View File

@@ -1,7 +1,7 @@
# -*- mode: snippet -*-
# contributor: Translated from TextMate Snippet
# name: Special: Return Inside Empty Open/Close Tags
# binding: "C-M"
# binding: RET
# condition: (yas/html-between-tag-pair-p)
# --

View File

@@ -1,7 +1,8 @@
# -*- mode: snippet -*-
# contributor: joaotavora, adapted from TextMate HTML bundle
# name: Wrap Selection in Open/Close Tag
# binding: "C-S-w"
# binding: C-S-w
# condition: mark-active
# expand-env: ((yas/html-wrap-newline (when (string-match "\n" yas/selected-text) "\n")))
# --
<${1:p}>`yas/selected-text`</${1:$(yas/html-first-word yas/text)}>
<${1:p}>`(concat yas/html-wrap-newline yas/selected-text yas/html-wrap-newline)`</${1:$(yas/html-first-word yas/text)}>