mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-25 04:15:44 +01:00
Add :if/:elseif/:else/:endif contiditionals. Also add comment help tag.
--HG-- extra : rebase_source : 6b6e15157d2fae436aa812df2db94a36a5e7ce79
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
along with paren matching and syntax error highlighting.
|
||||
</p>
|
||||
|
||||
<h2 tag="javascript-evaluation">JavaScript evaluation</h2>
|
||||
|
||||
<item>
|
||||
<tags>:ec :echo</tags>
|
||||
<spec>:ec<oa>ho</oa> <a>expr</a></spec>
|
||||
@@ -134,6 +136,8 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<h2 tag="global-variables">Global Variables</h2>
|
||||
|
||||
<item>
|
||||
<tags>:let</tags>
|
||||
<spec>:let <a>var-name</a> [+-.]= <a>expr1</a></spec>
|
||||
@@ -166,6 +170,55 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<h2 tag="conditionals">Conditionals</h2>
|
||||
|
||||
<item>
|
||||
<tags>:if</tags>
|
||||
<spec>:if <a>expr</a></spec>
|
||||
<description>
|
||||
<p>
|
||||
Execute commands until the next <ex>:elseif</ex>, <ex>:else</ex>,
|
||||
or <ex>:endif</ex> only if the JavaScript expression <a>expr</a>
|
||||
evaluates to a true value.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>:endif :en :fi</tags>
|
||||
<spec>:en<oa>dif</oa></spec>
|
||||
<description>
|
||||
<p>
|
||||
Ends a string of <ex>:if</ex>/<ex>:elseif</ex>/<ex>:else</ex>
|
||||
conditionals.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<tags>:elseif :elsei :elif</tags>
|
||||
<spec>:elsei<oa>f</oa> <a>expr</a></spec>
|
||||
<description>
|
||||
<p>
|
||||
Execute commands until the next <ex>:elseif</ex>, <ex>:else</ex>,
|
||||
or <ex>:endif</ex> only if the JavaScript expression <a>expr</a>
|
||||
evaluates to a true value.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>:else :el</tags>
|
||||
<spec>:el<oa>se</oa></spec>
|
||||
<description>
|
||||
<p>
|
||||
Execute commands until the next <ex>:endif</ex> only if the
|
||||
previous conditionals were not executed.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
</document>
|
||||
|
||||
<!-- vim:se sts=4 sw=4 et: -->
|
||||
|
||||
@@ -242,7 +242,10 @@ This file contains a list of all available commands, mappings and options.
|
||||
<dt><ex>:echo</ex></dt> <dd>Echo the expression</dd>
|
||||
<dt><ex>:echoerr</ex></dt> <dd>Echo the expression as an error message</dd>
|
||||
<dt><ex>:echomsg</ex></dt> <dd>Echo the expression as an informational message</dd>
|
||||
<dt><ex>:else</ex></dt> <dd>Execute commands until the next <ex>:endif</ex> only if the previous conditionals were not executed</dd>
|
||||
<dt><ex>:elseif</ex></dt> <dd>Execute commands until the next :elseif, <ex>:else</ex>, or :endif only if the argument returns true</dd>
|
||||
<dt><ex>:emenu</ex></dt> <dd>Execute the specified menu item from the command line</dd>
|
||||
<dt><ex>:endif</ex></dt> <dd>Ends a string of <ex>:if</ex>/<ex>:elseif</ex>/<ex>:else</ex> conditionals</dd>
|
||||
<dt><ex>:execute</ex></dt> <dd>Execute the argument as an Ex command</dd>
|
||||
<dt><ex>:extadd</ex></dt> <dd>Install an extension</dd>
|
||||
<dt><ex>:extdelete</ex></dt> <dd>Uninstall an extension</dd>
|
||||
@@ -262,6 +265,7 @@ This file contains a list of all available commands, mappings and options.
|
||||
<dt><ex>:history</ex></dt> <dd>Show recently visited URLs</dd>
|
||||
<dt><ex>:iabbrev</ex></dt> <dd>Abbreviate a key sequence in Insert mode</dd>
|
||||
<dt><ex>:iabclear</ex></dt> <dd>Remove all abbreviations in Insert mode</dd>
|
||||
<dt><ex>:if</ex></dt> <dd>Execute commands until the next <ex>:elseif</ex>, <ex>:else</ex>, or <ex>:endif</ex> only if the argument returns true</dd>
|
||||
<dt><ex>:imap</ex></dt> <dd>Map a key sequence in Insert mode</dd>
|
||||
<dt><ex>:imapclear</ex></dt> <dd>Remove all mappings in Insert mode</dd>
|
||||
<dt><ex>:inoremap</ex></dt> <dd>Map a key sequence without remapping keys in Insert mode</dd>
|
||||
|
||||
@@ -169,6 +169,8 @@
|
||||
on a single line, you can use
|
||||
</p>
|
||||
|
||||
<p>See also <t>ex-scripts</t> below.</p>
|
||||
|
||||
<code><ex>:js</ex> <<<em>EOF</em>
|
||||
<hl key="Object">var</hl> hello = <hl key="Key">function</hl> () {
|
||||
alert(<str>Hello world</str>);
|
||||
@@ -228,6 +230,54 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<h3 tag="ex-scripts">Ex Command Scripts</h3>
|
||||
|
||||
<p>
|
||||
Ex command scripts are similar to both entering commands on the
|
||||
<link topic="command-line">command line</link> and to Vim
|
||||
scripts, but with some notable differences.
|
||||
</p>
|
||||
|
||||
<p tag="multiline-commands">
|
||||
Commands in Ex command scripts can span multiple lines by
|
||||
prefixing the second and further lines with a <em>\</em>
|
||||
character. For instance, the following all define commands whose
|
||||
definitions span multiple lines.
|
||||
</p>
|
||||
|
||||
<code><ex>:command!</ex> <em>foo</em>
|
||||
\ <em>-description</em> <str>A command that frobs bars</str>
|
||||
\ <ex>:javascript</ex> frob(content.bar)</code>
|
||||
|
||||
<code><ex>:style</ex> <em>-name</em> <str>foo</str>
|
||||
\ <str delim="'">foobar.com</str>
|
||||
\ p:first-line { <em>font-variant:</em> <str delim="">small-caps</str>; }
|
||||
\ div#side-bar > :first-child { <em>display</em>: <str delim="">none</str>; }</code>
|
||||
|
||||
<code><ex>:command</ex> <em>do-some-stuff</em>
|
||||
\ <em>-description</em> <str>A command does some stuff in JavaScript</str>
|
||||
\ <ex>:javascript</ex> <<<em>EOF</em>
|
||||
\ window.do(<str>some</str>);
|
||||
\ window.do(<str>stuff</str>);
|
||||
\<em>EOF</em></code>
|
||||
|
||||
<code><ex>:command</ex> <em>do-some-stuff</em>
|
||||
\ <em>-description</em> <str>A command does some stuff in JavaScript</str>
|
||||
\ <ex>:javascript</ex>
|
||||
\\ window.do(<str>some</str>);
|
||||
\\ window.do(<str>stuff</str>);</code>
|
||||
|
||||
<p tag="comments">
|
||||
Lines may be commented out by prefixing them with a <em>"</em>
|
||||
character.
|
||||
</p>
|
||||
|
||||
<code> <html:span style="color: #444"> " This is a comment</html:span>
|
||||
foo bar <html:span style="color: #444">" This is a comment</html:span>
|
||||
<str> This is not a comment</str>
|
||||
foo bar <str> This is not a cumment</str>
|
||||
</code>
|
||||
|
||||
<h2 tag="profile profiling">Profiling</h2>
|
||||
|
||||
<item>
|
||||
|
||||
Reference in New Issue
Block a user