PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
HTML | 33 lines | 29 code | 4 blank | 0 comment | 0 complexity | f2de2fb8d4b1ad89f80c67d2c59fa2cd MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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.65.1"><link rel="home" href="index.html" title="jEdit 4.2 User's Guide"><link rel="up" href="writing-modes.html" title="Chapter 10. Mode Definition Syntax"><link rel="previous" 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></div></div><p>
  2. The <tt class="literal">IMPORT</tt> tag, which must be placed inside a <tt class="literal">RULES</tt> tag, loads all rules defined in a given ruleset into the current ruleset; in other words, it has the same effect as copying and pasting the imported ruleset.
  3. </p><p>
  4. The only required attribute <tt class="literal">DELEGATE</tt> must be set to the name of a ruleset. To import a ruleset defined
  5. in the current mode, just specify its name. To import a ruleset
  6. defined in another mode, specify a name of the form
  7. <tt class="literal"><i class="replaceable"><tt>mode</tt></i>::<i class="replaceable"><tt>ruleset</tt></i></tt>.
  8. Note that the first (unnamed) ruleset in a mode is called
  9. &#8220;<span class="quote">MAIN</span>&#8221;.
  10. </p><p>
  11. One quirk is that the definition of the imported ruleset is not copied to the location of the <tt class="literal">IMPORT</tt> tag, but rather to the end of the containing ruleset. This has implications with rule-ordering; see <a href="mode-tag-rules.html#rule-ordering" title="Rule Ordering Requirements">the section called &#8220;Rule Ordering Requirements&#8221;</a>.
  12. </p><p>
  13. Here is an example from the PHP mode, which extends the inline JavaScript highlighting to support embedded PHP:
  14. </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">
  15. &lt;RULES SET="JAVASCRIPT+PHP"&gt;
  16. &lt;SPAN TYPE="MARKUP" DELEGATE="php::PHP"&gt;
  17. &lt;BEGIN&gt;&amp;lt;?php&lt;/BEGIN&gt;
  18. &lt;END&gt;?&amp;gt;&lt;/END&gt;
  19. &lt;/SPAN&gt;
  20. &lt;SPAN TYPE="MARKUP" DELEGATE="php::PHP"&gt;
  21. &lt;BEGIN&gt;&amp;lt;?&lt;/BEGIN&gt;
  22. &lt;END&gt;?&amp;gt;&lt;/END&gt;
  23. &lt;/SPAN&gt;
  24. &lt;SPAN TYPE="MARKUP" DELEGATE="php::PHP"&gt;
  25. &lt;BEGIN&gt;&amp;lt;%=&lt;/BEGIN&gt;
  26. &lt;END&gt;%&amp;gt;&lt;/END&gt;
  27. &lt;/SPAN&gt;
  28. &lt;IMPORT DELEGATE="javascript::MAIN"/&gt;
  29. &lt;/RULES&gt;</pre></td></tr></table></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>