PageRenderTime 52ms CodeModel.GetById 43ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/users-guide/mode-rule-import.html

#
HTML | 33 lines | 29 code | 4 blank | 0 comment | 0 complexity | d0d0fd9dd7aa9620324a946a8cba4a3f MD5 | raw file
 1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>The IMPORT Tag</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="jEdit 4.3 User's Guide"><link rel="up" href="writing-modes.html" title="Chapter 10. Mode Definition Syntax"><link rel="prev" href="mode-rule-seq-regexp.html" title="The SEQ_REGEXP Tag"><link rel="next" href="mode-rule-keywords.html" title="The KEYWORDS Tag"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The IMPORT Tag</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mode-rule-seq-regexp.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Mode Definition Syntax</th><td width="20%" align="right"> <a accesskey="n" href="mode-rule-keywords.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="mode-rule-import"></a>The IMPORT Tag</h2></div></div></div><p>The <code class="literal">IMPORT</code> tag, which must be placed inside a
 2        <code class="literal">RULES</code> tag, loads all rules defined in a given ruleset
 3        into the current ruleset; in other words, it has the same effect as
 4        copying and pasting the imported ruleset.</p><p>The only required attribute <code class="literal">DELEGATE</code> must be
 5        set to the name of a ruleset. To import a ruleset defined in the current
 6        mode, just specify its name. To import a ruleset defined in another
 7        mode, specify a name of the form
 8        <code class="literal"><em class="replaceable"><code>mode</code></em>::<em class="replaceable"><code>ruleset</code></em></code>.
 9        Note that the first (unnamed) ruleset in a mode is called
10        &#8220;<span class="quote">MAIN</span>&#8221;.</p><p>One quirk is that the definition of the imported ruleset is not
11        copied to the location of the <code class="literal">IMPORT</code> tag, but rather
12        to the end of the containing ruleset. This has implications with
13        rule-ordering; see <a class="xref" href="mode-tag-rules.html#rule-ordering" title="Rule Ordering Requirements">the section called &#8220;Rule Ordering Requirements&#8221;</a>.</p><p>Here is an example from the PHP mode, which extends the inline
14        JavaScript highlighting to support embedded PHP:</p><pre class="programlisting">
15   &lt;RULES SET="JAVASCRIPT+PHP"&gt;
16
17   &lt;SPAN TYPE="MARKUP" DELEGATE="php::PHP"&gt;
18       &lt;BEGIN&gt;&amp;lt;?php&lt;/BEGIN&gt;
19       &lt;END&gt;?&amp;gt;&lt;/END&gt;
20   &lt;/SPAN&gt;
21
22   &lt;SPAN TYPE="MARKUP" DELEGATE="php::PHP"&gt;
23       &lt;BEGIN&gt;&amp;lt;?&lt;/BEGIN&gt;
24       &lt;END&gt;?&amp;gt;&lt;/END&gt;
25   &lt;/SPAN&gt;
26
27   &lt;SPAN TYPE="MARKUP" DELEGATE="php::PHP"&gt;
28       &lt;BEGIN&gt;&amp;lt;%=&lt;/BEGIN&gt;
29       &lt;END&gt;%&amp;gt;&lt;/END&gt;
30   &lt;/SPAN&gt;
31
32   &lt;IMPORT DELEGATE="javascript::MAIN"/&gt;
33&lt;/RULES&gt;</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="mode-rule-seq-regexp.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="writing-modes.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="mode-rule-keywords.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The SEQ_REGEXP Tag </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The KEYWORDS Tag</td></tr></table></div></body></html>