mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-02-04 06:32:24 +00:00
@@ -7,7 +7,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
||||
<meta name="title" content="Writing snippets"/>
|
||||
<meta name="generator" content="Org-mode"/>
|
||||
<meta name="generated" content="2014-05-11T19:37-0400"/>
|
||||
<meta name="generated" content="2014-06-17T19:49-0400"/>
|
||||
<meta name="author" content=""/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="keywords" content=""/>
|
||||
@@ -671,12 +671,13 @@ the field and others mirrors.
|
||||
|
||||
|
||||
<p>
|
||||
If the value of an <code>${n:</code>-construct starts with and contains <code>$(</code>, then
|
||||
it is interpreted as a mirror for field <code>n</code> with a transformation. The
|
||||
mirror's text content is calculated according to this transformation,
|
||||
which is Emacs-lisp code that gets evaluated in an environment where the
|
||||
variable <code>text</code> (or <a href="snippet-reference.html#yas-text"><code>yas-text</code></a>) is bound to the text content (string)
|
||||
contained in the field <code>n</code>.Here's an example for Objective-C:
|
||||
If the value of an <code>${n:</code>-construct starts with and contains <code>$(</code>,
|
||||
then it is interpreted as a mirror for field <code>n</code> with a
|
||||
transformation. The mirror's text content is calculated according to
|
||||
this transformation, which is Emacs-lisp code that gets evaluated in
|
||||
an environment where the variable <a href="snippet-reference.html#yas-text"><code>yas-text</code></a> is bound to the text
|
||||
content (string) contained in the field <code>n</code>. Here's an example for
|
||||
Objective-C:
|
||||
</p>
|
||||
|
||||
|
||||
@@ -686,7 +687,7 @@ contained in the field <code>n</code>.Here's an example for Objective-C:
|
||||
return $2;
|
||||
}
|
||||
|
||||
- (void)set${2:$(capitalize text)}:($1)aValue
|
||||
- (void)set${2:$(capitalize yas-text)}:($1)aValue
|
||||
{
|
||||
[$2 autorelease];
|
||||
$2 = [aValue retain];
|
||||
@@ -696,12 +697,13 @@ $0
|
||||
|
||||
|
||||
<p>
|
||||
Look at <code>${2:$(capitalize text)}</code>, it is a mirror with transformation
|
||||
instead of a field. The actual field is at the first line: <code>${2:foo}</code>.
|
||||
When you type text in <code>${2:foo}</code>, the transformation will be evaluated
|
||||
and the result will be placed there as the transformed text. So in this
|
||||
example, if you type "baz" in the field, the transformed text will be
|
||||
"Baz". This example is also available in the screencast.
|
||||
Look at <code>${2:$(capitalize yas-text)}</code>, it is a mirror with
|
||||
transformation instead of a field. The actual field is at the first
|
||||
line: <code>${2:foo}</code>. When you type text in <code>${2:foo}</code>, the transformation
|
||||
will be evaluated and the result will be placed there as the
|
||||
transformed text. So in this example, if you type "baz" in the field,
|
||||
the transformed text will be "Baz". This example is also available in
|
||||
the screencast.
|
||||
</p>
|
||||
<p>
|
||||
Another example is for <code>rst-mode</code>. In reStructuredText, the document
|
||||
@@ -735,9 +737,9 @@ is not. Here's an snippet for rst title:
|
||||
|
||||
|
||||
|
||||
<pre class="example">${1:$(make-string (string-width text) ?\=)}
|
||||
<pre class="example">${1:$(make-string (string-width yas-text) ?\=)}
|
||||
${1:Title}
|
||||
${1:$(make-string (string-width text) ?\=)}
|
||||
${1:$(make-string (string-width yas-text) ?\=)}
|
||||
|
||||
$0
|
||||
</pre>
|
||||
@@ -875,7 +877,7 @@ performs the normal Emacs <code>delete-char</code> command.
|
||||
</div>
|
||||
|
||||
<div id="postamble">
|
||||
<hr><p class='creator'>Generated by <a href="http://orgmode.org">Org</a> version 7.9.3f with <a href="http://www.gnu.org/software/emacs/">Emacs</a> version 24 on 2014-05-11T19:37-0400 from fe288a156c063666d9c6613b6eea0ed5a515a86b
|
||||
<hr><p class='creator'>Generated by <a href="http://orgmode.org">Org</a> version 7.9.3f with <a href="http://www.gnu.org/software/emacs/">Emacs</a> version 24 on 2014-06-17T19:49-0400 from e53ec1e0c3611c3a0f4ac6228aab041a82b9d3bb
|
||||
</p>
|
||||
<p class='xhtml-validation'><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user