PageRenderTime 74ms CodeModel.GetById 53ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
HTML | 48 lines | 48 code | 0 blank | 0 comment | 0 complexity | 886fb3e4b5ad2c5fb7b6f779e1ba0d1a MD5 | raw file
 1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>The SPAN 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-terminate.html" title="The TERMINATE Tag"><link rel="next" href="mode-rule-span-regexp.html" title="The SPAN_REGEXP 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 SPAN Tag</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mode-rule-terminate.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-span-regexp.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-span"></a>The SPAN Tag</h2></div></div></div><p>The <code class="literal">SPAN</code> rule, which must be placed inside a
 2        <code class="literal">RULES</code> tag, highlights text between a start and end
 3        string. The start and end strings are specified inside child elements of
 4        the <code class="literal">SPAN</code> tag. The following attributes are
 5        supported:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="literal">TYPE</code> - The token type to highlight the
 6                span with. See <a class="xref" href="mode-syntax-tokens.html" title="Token Types">the section called &#8220;Token Types&#8221;</a> for a list
 7                of token types.</p></li><li><p><code class="literal">AT_LINE_START</code> - If set to
 8                <code class="literal">TRUE</code>, the span will only be highlighted if
 9                the start sequence occurs at the beginning of a line.</p></li><li><p><code class="literal">AT_WHITESPACE_END</code> - If set to
10                <code class="literal">TRUE</code>, the span will only be highlighted if
11                the start sequence is the first non-whitespace text in the
12                line.</p></li><li><p><code class="literal">AT_WORD_START</code> - If set to
13                <code class="literal">TRUE</code>, the span will only be highlighted if
14                the start sequence occurs at the beginning of a word.</p></li><li><p><code class="literal">DELEGATE</code> - text inside the span will be
15                highlighted with the specified ruleset. To delegate to a ruleset
16                defined in the current mode, just specify its name. To delegate
17                to a ruleset defined in another mode, specify a name of the form
18                <code class="literal"><em class="replaceable"><code>mode</code></em>::<em class="replaceable"><code>ruleset</code></em></code>.
19                Note that the first (unnamed) ruleset in a mode is called
20                &#8220;<span class="quote">MAIN</span>&#8221;.</p></li><li><p><code class="literal">MATCH_TYPE</code> - Controls how the start and
21                end of the sequence will be highlighted. See <a class="xref" href="mode-match-type.html" title="The MATCH_TYPE Attribute">the section called &#8220;The MATCH_TYPE Attribute&#8221;</a> for more information.</p></li><li><p><code class="literal">ESCAPE</code> - specifies a character sequence
22                for escaping characters. The first character following the escape
23                sequence is not considered as input for syntax highlighting,
24                thus being highlighted with rule's token.
25                </p></li><li><p><code class="literal">NO_LINE_BREAK</code> - If set to
26                <code class="literal">TRUE</code>, the span will not cross line
27                breaks.</p></li><li><p><code class="literal">NO_WORD_BREAK</code> - If set to
28                <code class="literal">TRUE</code>, the span will not cross word
29                breaks.</p></li></ul></div><p>Note that the <code class="literal">AT_LINE_START</code>,
30        <code class="literal">AT_WHITESPACE_END</code> and
31        <code class="literal">AT_WORD_START</code> attributes can also be used on the
32        <code class="literal">BEGIN</code> and <code class="literal">END</code> elements. Setting
33        these attributes to the same value on both elements has the same effect
34        as setting them on the <code class="literal">SPAN</code> element.</p><p>Here is a <code class="literal">SPAN</code> that highlights Java string
35        literals, which cannot include line breaks:</p><pre class="programlisting">&lt;SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE"&gt;
36  &lt;BEGIN&gt;"&lt;/BEGIN&gt;
37  &lt;END&gt;"&lt;/END&gt;
38&lt;/SPAN&gt;</pre><p>Here is a <code class="literal">SPAN</code> that highlights Java
39        documentation comments by delegating to the &#8220;<span class="quote">JAVADOC</span>&#8221;
40        ruleset defined elsewhere in the current mode:</p><pre class="programlisting">&lt;SPAN TYPE="COMMENT2" DELEGATE="JAVADOC"&gt;
41  &lt;BEGIN&gt;/**&lt;/BEGIN&gt;
42  &lt;END&gt;*/&lt;/END&gt;
43&lt;/SPAN&gt;</pre><p>Here is a <code class="literal">SPAN</code> that highlights HTML cascading
44        stylesheets inside <code class="literal">&lt;STYLE&gt;</code> tags by delegating
45        to the main ruleset in the CSS edit mode:</p><pre class="programlisting">&lt;SPAN TYPE="MARKUP" DELEGATE="css::MAIN"&gt;
46  &lt;BEGIN&gt;&amp;lt;style&amp;gt;&lt;/BEGIN&gt;
47  &lt;END&gt;&amp;lt;/style&amp;gt;&lt;/END&gt;
48&lt;/SPAN&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-terminate.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-span-regexp.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The TERMINATE Tag </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The SPAN_REGEXP Tag</td></tr></table></div></body></html>