~ubuntu-branches/ubuntu/saucy/ruby-erubis/saucy

« back to all changes in this revision

Viewing changes to doc-api/classes/Erubis/SimplifyEnhancer.html

  • Committer: Package Import Robot
  • Author(s): Laurent Bigonville
  • Date: 2012-01-26 15:15:58 UTC
  • Revision ID: package-import@ubuntu.com-20120126151558-9u7mnf9ooqnw3bwz
Tags: upstream-2.7.0
ImportĀ upstreamĀ versionĀ 2.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html 
 
3
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
4
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
5
 
 
6
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
7
<head>
 
8
  <title>Module: Erubis::SimplifyEnhancer</title>
 
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
 
11
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
 
12
  <script type="text/javascript">
 
13
  // <![CDATA[
 
14
 
 
15
  function popupCode( url ) {
 
16
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
 
17
  }
 
18
 
 
19
  function toggleCode( id ) {
 
20
    if ( document.getElementById )
 
21
      elem = document.getElementById( id );
 
22
    else if ( document.all )
 
23
      elem = eval( "document.all." + id );
 
24
    else
 
25
      return false;
 
26
 
 
27
    elemStyle = elem.style;
 
28
    
 
29
    if ( elemStyle.display != "block" ) {
 
30
      elemStyle.display = "block"
 
31
    } else {
 
32
      elemStyle.display = "none"
 
33
    }
 
34
 
 
35
    return true;
 
36
  }
 
37
  
 
38
  // Make codeblocks hidden by default
 
39
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
 
40
  
 
41
  // ]]>
 
42
  </script>
 
43
 
 
44
</head>
 
45
<body>
 
46
 
 
47
 
 
48
 
 
49
    <div id="classHeader">
 
50
        <table class="header-table">
 
51
        <tr class="top-aligned-row">
 
52
          <td><strong>Module</strong></td>
 
53
          <td class="class-name-in-header">Erubis::SimplifyEnhancer</td>
 
54
        </tr>
 
55
        <tr class="top-aligned-row">
 
56
            <td><strong>In:</strong></td>
 
57
            <td>
 
58
                <a href="../../files/erubis/enhancer_rb.html">
 
59
                erubis/enhancer.rb
 
60
                </a>
 
61
        <br />
 
62
            </td>
 
63
        </tr>
 
64
 
 
65
        </table>
 
66
    </div>
 
67
  <!-- banner header -->
 
68
 
 
69
  <div id="bodyContent">
 
70
 
 
71
 
 
72
 
 
73
  <div id="contextContent">
 
74
 
 
75
    <div id="description">
 
76
      <p>
 
77
get <a href="SimplifyEnhancer.html#M000062">convert</a> faster, but spaces
 
78
around &#8217;&lt;%&#8230;%&gt;&#8217; are not trimmed.
 
79
</p>
 
80
<p>
 
81
this is language-independent.
 
82
</p>
 
83
 
 
84
    </div>
 
85
 
 
86
 
 
87
   </div>
 
88
 
 
89
    <div id="method-list">
 
90
      <h3 class="section-bar">Methods</h3>
 
91
 
 
92
      <div class="name-list">
 
93
      <a href="#M000062">convert</a>&nbsp;&nbsp;
 
94
      </div>
 
95
    </div>
 
96
 
 
97
  </div>
 
98
 
 
99
 
 
100
    <!-- if includes -->
 
101
 
 
102
    <div id="section">
 
103
 
 
104
 
 
105
    <div id="constants-list">
 
106
      <h3 class="section-bar">Constants</h3>
 
107
 
 
108
      <div class="name-list">
 
109
        <table summary="Constants">
 
110
        <tr class="top-aligned-row context-row">
 
111
          <td class="context-item-name">SIMPLE_REGEXP</td>
 
112
          <td>=</td>
 
113
          <td class="context-item-value">/&lt;%(=+|\#)?(.*?)-?%&gt;/m</td>
 
114
          <td width="3em">&nbsp;</td>
 
115
          <td class="context-item-desc">
 
116
DEFAULT_REGEXP = /(^[ \t]*)?&lt;%(=+|\#)?(.*?)-?%&gt;([ \t]*\r?\n)?/m
 
117
 
 
118
</td>
 
119
        </tr>
 
120
        </table>
 
121
      </div>
 
122
    </div>
 
123
 
 
124
 
 
125
 
 
126
      
 
127
 
 
128
 
 
129
    <!-- if method_list -->
 
130
    <div id="methods">
 
131
      <h3 class="section-bar">Public Instance methods</h3>
 
132
 
 
133
      <div id="method-M000062" class="method-detail">
 
134
        <a name="M000062"></a>
 
135
 
 
136
        <div class="method-heading">
 
137
          <a href="#M000062" class="method-signature">
 
138
          <span class="method-name">convert</span><span class="method-args">(input)</span>
 
139
          </a>
 
140
        </div>
 
141
      
 
142
        <div class="method-description">
 
143
          <p><a class="source-toggle" href="#"
 
144
            onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
 
145
          <div class="method-source-code" id="M000062-source">
 
146
<pre>
 
147
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 342</span>
 
148
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
 
149
      <span class="ruby-identifier">src</span> = <span class="ruby-value str">&quot;&quot;</span>
 
150
      <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
 
151
      <span class="ruby-comment cmt">#regexp = pattern_regexp(@pattern)</span>
 
152
      <span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
 
153
      <span class="ruby-identifier">input</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-constant">SIMPLE_REGEXP</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
 
154
        <span class="ruby-identifier">match</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
 
155
        <span class="ruby-identifier">index</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>)
 
156
        <span class="ruby-identifier">text</span>  = <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">index</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span>]
 
157
        <span class="ruby-identifier">pos</span>   = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
 
158
        <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
 
159
        <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">indicator</span>              <span class="ruby-comment cmt"># &lt;% %&gt;</span>
 
160
          <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
 
161
        <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">indicator</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\#</span>  <span class="ruby-comment cmt"># &lt;%# %&gt;</span>
 
162
          <span class="ruby-identifier">n</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">count</span>(<span class="ruby-value str">&quot;\n&quot;</span>)
 
163
          <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
 
164
        <span class="ruby-keyword kw">else</span>                       <span class="ruby-comment cmt"># &lt;%= %&gt;</span>
 
165
          <span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
 
166
        <span class="ruby-keyword kw">end</span>
 
167
      <span class="ruby-keyword kw">end</span>
 
168
      <span class="ruby-comment cmt">#rest = $' || input                      # ruby1.8</span>
 
169
      <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">input</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]  <span class="ruby-comment cmt"># ruby1.9</span>
 
170
      <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
 
171
      <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
 
172
      <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">src</span>
 
173
    <span class="ruby-keyword kw">end</span>
 
174
</pre>
 
175
          </div>
 
176
        </div>
 
177
      </div>
 
178
 
 
179
 
 
180
    </div>
 
181
 
 
182
 
 
183
  </div>
 
184
 
 
185
 
 
186
<div id="validator-badges">
 
187
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
 
188
</div>
 
189
 
 
190
</body>
 
191
</html>
 
 
b'\\ No newline at end of file'