kwartz 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -0
- data/ChangeLog +103 -0
- data/README.txt +37 -0
- data/bin/kwartz +12 -0
- data/doc-api/classes/Kwartz.html +218 -0
- data/doc-api/classes/Kwartz/Assertion.html +140 -0
- data/doc-api/classes/Kwartz/AssertionError.html +148 -0
- data/doc-api/classes/Kwartz/AttrInfo.html +320 -0
- data/doc-api/classes/Kwartz/BaseError.html +206 -0
- data/doc-api/classes/Kwartz/BaseTranslator.html +331 -0
- data/doc-api/classes/Kwartz/CharacterType.html +212 -0
- data/doc-api/classes/Kwartz/CommandOptionError.html +154 -0
- data/doc-api/classes/Kwartz/CommandOptions.html +374 -0
- data/doc-api/classes/Kwartz/Config.html +150 -0
- data/doc-api/classes/Kwartz/ConvertError.html +191 -0
- data/doc-api/classes/Kwartz/Converter.html +252 -0
- data/doc-api/classes/Kwartz/CssStyleParser.html +483 -0
- data/doc-api/classes/Kwartz/DocumentRuleset.html +369 -0
- data/doc-api/classes/Kwartz/ElementExpander.html +325 -0
- data/doc-api/classes/Kwartz/ElementInfo.html +312 -0
- data/doc-api/classes/Kwartz/ElementRuleset.html +582 -0
- data/doc-api/classes/Kwartz/EperlHandler.html +338 -0
- data/doc-api/classes/Kwartz/EperlTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ErubisHandler.html +113 -0
- data/doc-api/classes/Kwartz/ErubisTranslator.html +168 -0
- data/doc-api/classes/Kwartz/ErubyHandler.html +337 -0
- data/doc-api/classes/Kwartz/ErubyTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ExpandStatement.html +227 -0
- data/doc-api/classes/Kwartz/Expression.html +119 -0
- data/doc-api/classes/Kwartz/Handler.html +558 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +657 -0
- data/doc-api/classes/Kwartz/JstlTranslator.html +226 -0
- data/doc-api/classes/Kwartz/KwartzError.html +146 -0
- data/doc-api/classes/Kwartz/Main.html +384 -0
- data/doc-api/classes/Kwartz/NativeExpression.html +236 -0
- data/doc-api/classes/Kwartz/NativeStatement.html +254 -0
- data/doc-api/classes/Kwartz/Node.html +156 -0
- data/doc-api/classes/Kwartz/ParseError.html +148 -0
- data/doc-api/classes/Kwartz/PhpHandler.html +333 -0
- data/doc-api/classes/Kwartz/PhpTranslator.html +194 -0
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +830 -0
- data/doc-api/classes/Kwartz/PrintStatement.html +221 -0
- data/doc-api/classes/Kwartz/RailsHandler.html +587 -0
- data/doc-api/classes/Kwartz/RailsTranslator.html +167 -0
- data/doc-api/classes/Kwartz/RubyStyleParser.html +558 -0
- data/doc-api/classes/Kwartz/Ruleset.html +117 -0
- data/doc-api/classes/Kwartz/Statement.html +119 -0
- data/doc-api/classes/Kwartz/StrutsTranslator.html +190 -0
- data/doc-api/classes/Kwartz/TagInfo.html +314 -0
- data/doc-api/classes/Kwartz/TextConverter.html +270 -0
- data/doc-api/classes/Kwartz/Translator.html +318 -0
- data/doc-api/classes/Test.html +107 -0
- data/doc-api/classes/Test/Unit.html +101 -0
- data/doc-api/created.rid +1 -0
- data/doc-api/files/__/README_txt.html +150 -0
- data/doc-api/files/kwartz/assert_rb.html +114 -0
- data/doc-api/files/kwartz/binding/eperl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/erubis_rb.html +116 -0
- data/doc-api/files/kwartz/binding/eruby_rb.html +115 -0
- data/doc-api/files/kwartz/binding/jstl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/php_rb.html +116 -0
- data/doc-api/files/kwartz/binding/rails_rb.html +115 -0
- data/doc-api/files/kwartz/binding/struts_rb.html +117 -0
- data/doc-api/files/kwartz/config_rb.html +107 -0
- data/doc-api/files/kwartz/converter_rb.html +119 -0
- data/doc-api/files/kwartz/error_rb.html +107 -0
- data/doc-api/files/kwartz/main_rb.html +124 -0
- data/doc-api/files/kwartz/node_rb.html +114 -0
- data/doc-api/files/kwartz/parser_rb.html +117 -0
- data/doc-api/files/kwartz/translator_rb.html +115 -0
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +115 -0
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +115 -0
- data/doc-api/files/kwartz_rb.html +120 -0
- data/doc-api/fr_class_index.html +75 -0
- data/doc-api/fr_file_index.html +45 -0
- data/doc-api/fr_method_index.html +216 -0
- data/doc-api/index.html +24 -0
- data/doc-api/rdoc-style.css +208 -0
- data/doc/docstyle.css +188 -0
- data/doc/p-pattern.html +1207 -0
- data/doc/reference.html +3396 -0
- data/doc/users-guide.html +1670 -0
- data/examples/breadcrumbs1/Makefile +15 -0
- data/examples/breadcrumbs1/breadcrumbs.eruby.plogic +27 -0
- data/examples/breadcrumbs1/breadcrumbs.html +12 -0
- data/examples/breadcrumbs1/breadcrumbs.jstl.plogic +28 -0
- data/examples/breadcrumbs1/breadcrumbs.php.plogic +26 -0
- data/examples/breadcrumbs1/main.php +12 -0
- data/examples/breadcrumbs1/main.rb +12 -0
- data/examples/breadcrumbs2/Makefile +15 -0
- data/examples/breadcrumbs2/breadcrumbs.eruby.plogic +22 -0
- data/examples/breadcrumbs2/breadcrumbs.html +14 -0
- data/examples/breadcrumbs2/breadcrumbs.jstl.plogic +24 -0
- data/examples/breadcrumbs2/breadcrumbs.php.plogic +23 -0
- data/examples/breadcrumbs2/main.php +12 -0
- data/examples/breadcrumbs2/main.rb +12 -0
- data/examples/pagelayout/Makefile +47 -0
- data/examples/pagelayout/content.eruby.plogic +44 -0
- data/examples/pagelayout/content.jstl.plogic +36 -0
- data/examples/pagelayout/content.php.plogic +37 -0
- data/examples/pagelayout/content1.html +36 -0
- data/examples/pagelayout/content2.html +29 -0
- data/examples/pagelayout/design.css +40 -0
- data/examples/pagelayout/layout.html +50 -0
- data/examples/pagelayout/main.php +55 -0
- data/examples/pagelayout/main.rb +77 -0
- data/examples/pagelayout/menu.eruby.plogic +14 -0
- data/examples/pagelayout/menu.html +13 -0
- data/examples/pagelayout/menu.jstl.plogic +14 -0
- data/examples/pagelayout/menu.php.plogic +14 -0
- data/examples/rails1/Makefile +36 -0
- data/examples/rails1/README +19 -0
- data/examples/rails1/application_helper.rb +31 -0
- data/examples/rails1/edit.html +28 -0
- data/examples/rails1/edit.plogic +10 -0
- data/examples/rails1/form.html +52 -0
- data/examples/rails1/form.plogic +33 -0
- data/examples/rails1/layout.plogic +15 -0
- data/examples/rails1/link_to.plogic +19 -0
- data/examples/rails1/list.html +48 -0
- data/examples/rails1/list.plogic +28 -0
- data/examples/rails1/new.html +27 -0
- data/examples/rails1/new.plogic +10 -0
- data/examples/rails1/reader.plogic +29 -0
- data/examples/rails1/show.html +40 -0
- data/examples/rails1/show.plogic +4 -0
- data/examples/rails1/writer.plogic +8 -0
- data/examples/table1/Makefile +15 -0
- data/examples/table1/main.php +11 -0
- data/examples/table1/main.rb +11 -0
- data/examples/table1/table1.eruby.plogic +21 -0
- data/examples/table1/table1.html +16 -0
- data/examples/table1/table1.jstl.plogic +21 -0
- data/examples/table1/table1.php.plogic +22 -0
- data/kwartz.gemspec +55 -0
- data/lib/kwartz.rb +13 -0
- data/lib/kwartz/assert.rb +31 -0
- data/lib/kwartz/binding/eperl.rb +166 -0
- data/lib/kwartz/binding/erubis.rb +61 -0
- data/lib/kwartz/binding/eruby.rb +164 -0
- data/lib/kwartz/binding/jstl.rb +334 -0
- data/lib/kwartz/binding/php.rb +167 -0
- data/lib/kwartz/binding/rails.rb +295 -0
- data/lib/kwartz/binding/struts.rb +109 -0
- data/lib/kwartz/config.rb +28 -0
- data/lib/kwartz/converter.rb +920 -0
- data/lib/kwartz/error.rb +41 -0
- data/lib/kwartz/main.rb +464 -0
- data/lib/kwartz/node.rb +454 -0
- data/lib/kwartz/parser.rb +903 -0
- data/lib/kwartz/translator.rb +153 -0
- data/lib/kwartz/util/assert-text-equal.rb +44 -0
- data/lib/kwartz/util/testcase-helper.rb +112 -0
- data/setup.rb +1331 -0
- data/test/test-compile.rb +36 -0
- data/test/test-compile.yaml +178 -0
- data/test/test-converter.rb +34 -0
- data/test/test-converter.yaml +127 -0
- data/test/test-directives.rb +32 -0
- data/test/test-directives.yaml +1411 -0
- data/test/test-main.rb +464 -0
- data/test/test-parser.rb +54 -0
- data/test/test-parser.yaml +394 -0
- data/test/test-rails.rb +28 -0
- data/test/test-rails.yaml +301 -0
- data/test/test-ruleset.rb +36 -0
- data/test/test-ruleset.yaml +804 -0
- data/test/test.rb +44 -0
- metadata +236 -0
@@ -0,0 +1,558 @@
|
|
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>Class: Kwartz::Handler</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>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Kwartz::Handler</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/kwartz/converter_rb.html">
|
59
|
+
kwartz/converter.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
.[abstract] handle directives
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000180">directive_format</a>
|
96
|
+
<a href="#M000178">directive_pattern</a>
|
97
|
+
<a href="#M000182">extract</a>
|
98
|
+
<a href="#M000184">get_class</a>
|
99
|
+
<a href="#M000177">get_element_info</a>
|
100
|
+
<a href="#M000176">get_element_ruleset</a>
|
101
|
+
<a href="#M000181">handle</a>
|
102
|
+
<a href="#M000179">mapping_pattern</a>
|
103
|
+
<a href="#M000175">new</a>
|
104
|
+
<a href="#M000183">register_class</a>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
<!-- if includes -->
|
112
|
+
<div id="includes">
|
113
|
+
<h3 class="section-bar">Included Modules</h3>
|
114
|
+
|
115
|
+
<div id="includes-list">
|
116
|
+
<span class="include-name"><a href="Assertion.html">Assertion</a></span>
|
117
|
+
<span class="include-name">ConverterHelper</span>
|
118
|
+
<span class="include-name"><a href="ElementExpander.html">ElementExpander</a></span>
|
119
|
+
</div>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div id="section">
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<div id="attribute-list">
|
129
|
+
<h3 class="section-bar">Attributes</h3>
|
130
|
+
|
131
|
+
<div class="name-list">
|
132
|
+
<table>
|
133
|
+
<tr class="top-aligned-row context-row">
|
134
|
+
<td class="context-item-name">converter</td>
|
135
|
+
<td class="context-item-value"> [RW] </td>
|
136
|
+
<td class="context-item-desc"></td>
|
137
|
+
</tr>
|
138
|
+
<tr class="top-aligned-row context-row">
|
139
|
+
<td class="context-item-name">even</td>
|
140
|
+
<td class="context-item-value"> [R] </td>
|
141
|
+
<td class="context-item-desc"></td>
|
142
|
+
</tr>
|
143
|
+
<tr class="top-aligned-row context-row">
|
144
|
+
<td class="context-item-name">filename</td>
|
145
|
+
<td class="context-item-value"> [RW] </td>
|
146
|
+
<td class="context-item-desc"></td>
|
147
|
+
</tr>
|
148
|
+
<tr class="top-aligned-row context-row">
|
149
|
+
<td class="context-item-name">odd</td>
|
150
|
+
<td class="context-item-value"> [R] </td>
|
151
|
+
<td class="context-item-desc"></td>
|
152
|
+
</tr>
|
153
|
+
</table>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<!-- if method_list -->
|
160
|
+
<div id="methods">
|
161
|
+
<h3 class="section-bar">Public Class methods</h3>
|
162
|
+
|
163
|
+
<div id="method-M000184" class="method-detail">
|
164
|
+
<a name="M000184"></a>
|
165
|
+
|
166
|
+
<div class="method-heading">
|
167
|
+
<a href="#M000184" class="method-signature">
|
168
|
+
<span class="method-name">get_class</span><span class="method-args">(lang)</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
<p><a class="source-toggle" href="#"
|
174
|
+
onclick="toggleCode('M000184-source');return false;">[Source]</a></p>
|
175
|
+
<div class="method-source-code" id="M000184-source">
|
176
|
+
<pre>
|
177
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 641</span>
|
178
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_class</span>(<span class="ruby-identifier">lang</span>)
|
179
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@class_table</span>[<span class="ruby-identifier">lang</span>]
|
180
|
+
<span class="ruby-keyword kw">end</span>
|
181
|
+
</pre>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div id="method-M000175" class="method-detail">
|
187
|
+
<a name="M000175"></a>
|
188
|
+
|
189
|
+
<div class="method-heading">
|
190
|
+
<a href="#M000175" class="method-signature">
|
191
|
+
<span class="method-name">new</span><span class="method-args">(elem_rulesets=[], properties={})</span>
|
192
|
+
</a>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div class="method-description">
|
196
|
+
<p><a class="source-toggle" href="#"
|
197
|
+
onclick="toggleCode('M000175-source');return false;">[Source]</a></p>
|
198
|
+
<div class="method-source-code" id="M000175-source">
|
199
|
+
<pre>
|
200
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 448</span>
|
201
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">elem_rulesets</span>=[], <span class="ruby-identifier">properties</span>={})
|
202
|
+
<span class="ruby-ivar">@elem_rulesets</span> = <span class="ruby-identifier">elem_rulesets</span>
|
203
|
+
<span class="ruby-comment cmt">#@elem_ruleset_table = elem_rulesets.inject({}) { |table, ruleset| table[ruleset.name] = ruleset; table }</span>
|
204
|
+
<span class="ruby-ivar">@elem_ruleset_table</span> = {} ; <span class="ruby-identifier">elem_rulesets</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">ruleset</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@elem_ruleset_table</span>[<span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">ruleset</span> }
|
205
|
+
<span class="ruby-ivar">@elem_info_table</span> = {}
|
206
|
+
<span class="ruby-identifier">include_properties</span>(<span class="ruby-identifier">properties</span>) <span class="ruby-comment cmt"># @delspan and @dattr</span>
|
207
|
+
<span class="ruby-ivar">@odd</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:odd</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Config</span><span class="ruby-operator">::</span><span class="ruby-constant">PROPERTY_ODD</span> <span class="ruby-comment cmt"># "'odd'"</span>
|
208
|
+
<span class="ruby-ivar">@even</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:even</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Config</span><span class="ruby-operator">::</span><span class="ruby-constant">PROPERTY_EVEN</span> <span class="ruby-comment cmt"># "'even'"</span>
|
209
|
+
<span class="ruby-ivar">@filename</span> = <span class="ruby-keyword kw">nil</span>
|
210
|
+
<span class="ruby-keyword kw">end</span>
|
211
|
+
</pre>
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div id="method-M000183" class="method-detail">
|
217
|
+
<a name="M000183"></a>
|
218
|
+
|
219
|
+
<div class="method-heading">
|
220
|
+
<a href="#M000183" class="method-signature">
|
221
|
+
<span class="method-name">register_class</span><span class="method-args">(lang, klass)</span>
|
222
|
+
</a>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<div class="method-description">
|
226
|
+
<p><a class="source-toggle" href="#"
|
227
|
+
onclick="toggleCode('M000183-source');return false;">[Source]</a></p>
|
228
|
+
<div class="method-source-code" id="M000183-source">
|
229
|
+
<pre>
|
230
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 636</span>
|
231
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">register_class</span>(<span class="ruby-identifier">lang</span>, <span class="ruby-identifier">klass</span>)
|
232
|
+
<span class="ruby-ivar">@@class_table</span>[<span class="ruby-identifier">lang</span>] = <span class="ruby-identifier">klass</span>
|
233
|
+
<span class="ruby-keyword kw">end</span>
|
234
|
+
</pre>
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
240
|
+
|
241
|
+
<div id="method-M000182" class="method-detail">
|
242
|
+
<a name="M000182"></a>
|
243
|
+
|
244
|
+
<div class="method-heading">
|
245
|
+
<a href="#M000182" class="method-signature">
|
246
|
+
<span class="method-name">extract</span><span class="method-args">(elem_name, content_only=false)</span>
|
247
|
+
</a>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div class="method-description">
|
251
|
+
<p><a class="source-toggle" href="#"
|
252
|
+
onclick="toggleCode('M000182-source');return false;">[Source]</a></p>
|
253
|
+
<div class="method-source-code" id="M000182-source">
|
254
|
+
<pre>
|
255
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 623</span>
|
256
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extract</span>(<span class="ruby-identifier">elem_name</span>, <span class="ruby-identifier">content_only</span>=<span class="ruby-keyword kw">false</span>)
|
257
|
+
<span class="ruby-identifier">elem_info</span> = <span class="ruby-ivar">@elem_info_table</span>[<span class="ruby-identifier">elem_name</span>]
|
258
|
+
<span class="ruby-identifier">elem_info</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">"element '#{elem_name}' not found."</span>, <span class="ruby-keyword kw">nil</span>)
|
259
|
+
<span class="ruby-identifier">stmt_list</span> = []
|
260
|
+
<span class="ruby-identifier">expand_element_info</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">content_only</span>)
|
261
|
+
<span class="ruby-comment cmt">#stmt_list << build_print_stmt(etag_info, nil, nil)</span>
|
262
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">stmt_list</span>
|
263
|
+
<span class="ruby-keyword kw">end</span>
|
264
|
+
</pre>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div id="method-M000177" class="method-detail">
|
270
|
+
<a name="M000177"></a>
|
271
|
+
|
272
|
+
<div class="method-heading">
|
273
|
+
<a href="#M000177" class="method-signature">
|
274
|
+
<span class="method-name">get_element_info</span><span class="method-args">(name)</span>
|
275
|
+
</a>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div class="method-description">
|
279
|
+
<p><a class="source-toggle" href="#"
|
280
|
+
onclick="toggleCode('M000177-source');return false;">[Source]</a></p>
|
281
|
+
<div class="method-source-code" id="M000177-source">
|
282
|
+
<pre>
|
283
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 467</span>
|
284
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_element_info</span>(<span class="ruby-identifier">name</span>) <span class="ruby-comment cmt"># for ElementExpander module</span>
|
285
|
+
<span class="ruby-ivar">@elem_info_table</span>[<span class="ruby-identifier">name</span>]
|
286
|
+
<span class="ruby-keyword kw">end</span>
|
287
|
+
</pre>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
<div id="method-M000176" class="method-detail">
|
293
|
+
<a name="M000176"></a>
|
294
|
+
|
295
|
+
<div class="method-heading">
|
296
|
+
<a href="#M000176" class="method-signature">
|
297
|
+
<span class="method-name">get_element_ruleset</span><span class="method-args">(name)</span>
|
298
|
+
</a>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
<div class="method-description">
|
302
|
+
<p><a class="source-toggle" href="#"
|
303
|
+
onclick="toggleCode('M000176-source');return false;">[Source]</a></p>
|
304
|
+
<div class="method-source-code" id="M000176-source">
|
305
|
+
<pre>
|
306
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 462</span>
|
307
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_element_ruleset</span>(<span class="ruby-identifier">name</span>) <span class="ruby-comment cmt"># for ElementExpander module and Converter class</span>
|
308
|
+
<span class="ruby-ivar">@elem_ruleset_table</span>[<span class="ruby-identifier">name</span>]
|
309
|
+
<span class="ruby-keyword kw">end</span>
|
310
|
+
</pre>
|
311
|
+
</div>
|
312
|
+
</div>
|
313
|
+
</div>
|
314
|
+
|
315
|
+
<div id="method-M000181" class="method-detail">
|
316
|
+
<a name="M000181"></a>
|
317
|
+
|
318
|
+
<div class="method-heading">
|
319
|
+
<a href="#M000181" class="method-signature">
|
320
|
+
<span class="method-name">handle</span><span class="method-args">(directive_name, directive_arg, directive_str, stag_info, etag_info, cont_stmts, attr_info, append_exprs, stmt_list)</span>
|
321
|
+
</a>
|
322
|
+
</div>
|
323
|
+
|
324
|
+
<div class="method-description">
|
325
|
+
<p>
|
326
|
+
handle directives (‘stag’, ‘etag’,
|
327
|
+
‘elem’, ‘cont’(=’value’))
|
328
|
+
</p>
|
329
|
+
<p>
|
330
|
+
return true if directive name is one of ‘stag’,
|
331
|
+
‘etag’, ‘elem’, ‘cont’, and
|
332
|
+
‘value’, else return false.
|
333
|
+
</p>
|
334
|
+
<p><a class="source-toggle" href="#"
|
335
|
+
onclick="toggleCode('M000181-source');return false;">[Source]</a></p>
|
336
|
+
<div class="method-source-code" id="M000181-source">
|
337
|
+
<pre>
|
338
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 503</span>
|
339
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">directive_name</span>, <span class="ruby-identifier">directive_arg</span>, <span class="ruby-identifier">directive_str</span>, <span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>, <span class="ruby-identifier">cont_stmts</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>, <span class="ruby-identifier">stmt_list</span>)
|
340
|
+
<span class="ruby-identifier">d_name</span> = <span class="ruby-identifier">directive_name</span>
|
341
|
+
<span class="ruby-identifier">d_arg</span> = <span class="ruby-identifier">directive_arg</span>
|
342
|
+
<span class="ruby-identifier">d_str</span> = <span class="ruby-identifier">directive_str</span>
|
343
|
+
|
344
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">directive_name</span>
|
345
|
+
|
346
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>
|
347
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-operator">!</span><span class="ruby-identifier">attr_info</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">append_exprs</span>.<span class="ruby-identifier">empty?</span>
|
348
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>)
|
349
|
+
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">cont_stmts</span>)
|
350
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">etag_info</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">etag_info</span> <span class="ruby-comment cmt"># when empty-tag</span>
|
351
|
+
|
352
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:dummy</span>
|
353
|
+
<span class="ruby-comment cmt"># nothing</span>
|
354
|
+
|
355
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:id</span>, <span class="ruby-identifier">:mark</span>
|
356
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">directive_arg</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A(\w+)\z/</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">directive_arg</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A'(\w+)'\z/</span>
|
357
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">"'#{d_str}': invalid marking name."</span>, <span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
|
358
|
+
<span class="ruby-keyword kw">end</span>
|
359
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">$1</span>
|
360
|
+
<span class="ruby-identifier">elem_info</span> = <span class="ruby-constant">ElementInfo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>, <span class="ruby-identifier">cont_stmts</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>)
|
361
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@elem_info_table</span>[<span class="ruby-identifier">name</span>]
|
362
|
+
<span class="ruby-comment cmt">#unless Config::ALLOW_DUPLICATE_ID</span>
|
363
|
+
<span class="ruby-identifier">previous_linenum</span> = <span class="ruby-ivar">@elem_info_table</span>[<span class="ruby-identifier">name</span>].<span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>
|
364
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">"'#{d_str}': id '#{name}' is already used at line #{previous_linenum}."</span>, <span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
|
365
|
+
<span class="ruby-comment cmt">#end</span>
|
366
|
+
<span class="ruby-keyword kw">else</span>
|
367
|
+
<span class="ruby-ivar">@elem_info_table</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">elem_info</span>
|
368
|
+
<span class="ruby-keyword kw">end</span>
|
369
|
+
<span class="ruby-comment cmt">#stmt_list << ExpandStatement.new(:element, name) # lazy expantion</span>
|
370
|
+
<span class="ruby-identifier">expand_element_info</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>)
|
371
|
+
|
372
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:stag</span>, <span class="ruby-identifier">:Stag</span>, <span class="ruby-identifier">:STAG</span>
|
373
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>, <span class="ruby-identifier">d_name</span>, <span class="ruby-identifier">d_arg</span>)
|
374
|
+
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:stag</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Stag</span>)
|
375
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-constant">NativeExpression</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">d_arg</span>, <span class="ruby-identifier">flag_escape</span>)
|
376
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_expr_stmt</span>(<span class="ruby-identifier">expr</span>, <span class="ruby-identifier">stag_info</span>, <span class="ruby-keyword kw">nil</span>)
|
377
|
+
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">cont_stmts</span>)
|
378
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">etag_info</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>)
|
379
|
+
|
380
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:etag</span>, <span class="ruby-identifier">:Etag</span>, <span class="ruby-identifier">:ETAG</span>
|
381
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>, <span class="ruby-identifier">d_name</span>, <span class="ruby-identifier">d_arg</span>)
|
382
|
+
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:etag</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Etag</span>)
|
383
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-constant">NativeExpression</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">d_arg</span>, <span class="ruby-identifier">flag_escape</span>)
|
384
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>)
|
385
|
+
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">cont_stmts</span>)
|
386
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_expr_stmt</span>(<span class="ruby-identifier">expr</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">etag_info</span>)
|
387
|
+
|
388
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:elem</span>, <span class="ruby-identifier">:Elem</span>, <span class="ruby-identifier">:ELEM</span>
|
389
|
+
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:elem</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Elem</span>)
|
390
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-constant">NativeExpression</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">d_arg</span>, <span class="ruby-identifier">flag_escape</span>)
|
391
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_expr_stmt</span>(<span class="ruby-identifier">expr</span>, <span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>)
|
392
|
+
|
393
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:cont</span>, <span class="ruby-identifier">:Cont</span>, <span class="ruby-identifier">:CONT</span>, <span class="ruby-identifier">:value</span>, <span class="ruby-identifier">:Value</span>, <span class="ruby-identifier">:VALUE</span>
|
394
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>, <span class="ruby-identifier">d_name</span>, <span class="ruby-identifier">d_arg</span>)
|
395
|
+
<span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">tail_space</span> = <span class="ruby-identifier">etag_info</span>.<span class="ruby-identifier">head_space</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># delete spaces</span>
|
396
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">build_print_args</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>)
|
397
|
+
<span class="ruby-identifier">flag_escape</span> = (<span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:cont</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:value</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Cont</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Value</span>)
|
398
|
+
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">NativeExpression</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">d_arg</span>, <span class="ruby-identifier">flag_escape</span>)
|
399
|
+
<span class="ruby-comment cmt">#args << etag_info.tag_text</span>
|
400
|
+
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_info</span>.<span class="ruby-identifier">tag_text</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">etag_info</span>.<span class="ruby-identifier">tagname</span>
|
401
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">PrintStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>)
|
402
|
+
|
403
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:attr</span>, <span class="ruby-identifier">:Attr</span>, <span class="ruby-identifier">:ATTR</span>
|
404
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">d_arg</span> <span class="ruby-operator">=~</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mapping_pattern</span>() <span class="ruby-comment cmt"># ex. /\A'([-:\w]+)'\s+(.*)\z/</span>
|
405
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">"'#{d_str}': invalid attr pattern."</span>, <span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
|
406
|
+
<span class="ruby-keyword kw">end</span>
|
407
|
+
<span class="ruby-identifier">aname</span> = <span class="ruby-identifier">$1</span>; <span class="ruby-identifier">avalue</span> = <span class="ruby-identifier">$2</span>
|
408
|
+
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:attr</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Attr</span>)
|
409
|
+
<span class="ruby-identifier">attr_info</span>[<span class="ruby-identifier">aname</span>] = <span class="ruby-constant">NativeExpression</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">avalue</span>, <span class="ruby-identifier">flag_escape</span>)
|
410
|
+
|
411
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:append</span>, <span class="ruby-identifier">:Append</span>, <span class="ruby-identifier">:APPEND</span>
|
412
|
+
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:append</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Append</span>)
|
413
|
+
<span class="ruby-identifier">append_exprs</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">NativeExpression</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">d_arg</span>, <span class="ruby-identifier">flag_escape</span>)
|
414
|
+
|
415
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:replace_element_with_element</span>, <span class="ruby-identifier">:replace_element_with_content</span>,
|
416
|
+
<span class="ruby-identifier">:replace_content_with_element</span>, <span class="ruby-identifier">:replace_content_with_content</span>
|
417
|
+
<span class="ruby-identifier">arr</span> = <span class="ruby-identifier">d_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/_/</span>)
|
418
|
+
<span class="ruby-identifier">replace_cont</span> = <span class="ruby-identifier">arr</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'content'</span>
|
419
|
+
<span class="ruby-identifier">with_content</span> = <span class="ruby-identifier">arr</span>[<span class="ruby-value">3</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'content'</span>
|
420
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">d_arg</span>
|
421
|
+
<span class="ruby-comment cmt">#</span>
|
422
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>, <span class="ruby-identifier">d_name</span>, <span class="ruby-identifier">d_arg</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replace_cont</span>
|
423
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replace_cont</span>
|
424
|
+
<span class="ruby-comment cmt">#stmt_list << ExpandStatement.new(:element, name)</span>
|
425
|
+
<span class="ruby-identifier">elem_info</span> = <span class="ruby-ivar">@elem_info_table</span>[<span class="ruby-identifier">name</span>]
|
426
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">elem_info</span>
|
427
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">"'#{d_str}': element '#{name}' not found."</span>, <span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
|
428
|
+
<span class="ruby-keyword kw">end</span>
|
429
|
+
<span class="ruby-identifier">expand_element_info</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">with_content</span>)
|
430
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">etag_info</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replace_cont</span>
|
431
|
+
|
432
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:replace_element_with</span>, <span class="ruby-identifier">:replace_content_with</span>, <span class="ruby-identifier">:replace</span>, <span class="ruby-identifier">:placeholder</span>
|
433
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">d_arg</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A_?(element|content)\(["']?(\w+)["']?\)\z/</span>
|
434
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">"'#{d_str}': invalid #{d_name} format."</span>, <span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
|
435
|
+
<span class="ruby-keyword kw">end</span>
|
436
|
+
<span class="ruby-identifier">kind</span> = <span class="ruby-identifier">$1</span>
|
437
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">$2</span>
|
438
|
+
<span class="ruby-identifier">replace_cont</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:replace_content_with</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:placeholder</span>
|
439
|
+
<span class="ruby-identifier">with_content</span> = <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'content'</span>
|
440
|
+
<span class="ruby-comment cmt">#</span>
|
441
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>, <span class="ruby-identifier">d_name</span>, <span class="ruby-identifier">d_arg</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replace_cont</span>
|
442
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replace_cont</span>
|
443
|
+
<span class="ruby-comment cmt">#stmt_list << ExpandStatement.new(:element, name)</span>
|
444
|
+
<span class="ruby-identifier">elem_info</span> = <span class="ruby-ivar">@elem_info_table</span>[<span class="ruby-identifier">name</span>]
|
445
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">elem_info</span>
|
446
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">"'#{d_str}': element '#{name}' not found."</span>, <span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
|
447
|
+
<span class="ruby-keyword kw">end</span>
|
448
|
+
<span class="ruby-identifier">expand_element_info</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">with_content</span>)
|
449
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">etag_info</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replace_cont</span>
|
450
|
+
<span class="ruby-keyword kw">else</span>
|
451
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
452
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#case</span>
|
453
|
+
|
454
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
455
|
+
|
456
|
+
<span class="ruby-keyword kw">end</span>
|
457
|
+
</pre>
|
458
|
+
</div>
|
459
|
+
</div>
|
460
|
+
</div>
|
461
|
+
|
462
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
463
|
+
|
464
|
+
<div id="method-M000180" class="method-detail">
|
465
|
+
<a name="M000180"></a>
|
466
|
+
|
467
|
+
<div class="method-heading">
|
468
|
+
<a href="#M000180" class="method-signature">
|
469
|
+
<span class="method-name">directive_format</span><span class="method-args">()</span>
|
470
|
+
</a>
|
471
|
+
</div>
|
472
|
+
|
473
|
+
<div class="method-description">
|
474
|
+
<p>
|
475
|
+
.[abstract] directive format, which is used at has_directive?() method
|
476
|
+
</p>
|
477
|
+
<p><a class="source-toggle" href="#"
|
478
|
+
onclick="toggleCode('M000180-source');return false;">[Source]</a></p>
|
479
|
+
<div class="method-source-code" id="M000180-source">
|
480
|
+
<pre>
|
481
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 490</span>
|
482
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directive_format</span>
|
483
|
+
<span class="ruby-identifier">not_implemented</span>
|
484
|
+
<span class="ruby-comment cmt">#return '%s: %s'</span>
|
485
|
+
<span class="ruby-keyword kw">end</span>
|
486
|
+
</pre>
|
487
|
+
</div>
|
488
|
+
</div>
|
489
|
+
</div>
|
490
|
+
|
491
|
+
<div id="method-M000178" class="method-detail">
|
492
|
+
<a name="M000178"></a>
|
493
|
+
|
494
|
+
<div class="method-heading">
|
495
|
+
<a href="#M000178" class="method-signature">
|
496
|
+
<span class="method-name">directive_pattern</span><span class="method-args">()</span>
|
497
|
+
</a>
|
498
|
+
</div>
|
499
|
+
|
500
|
+
<div class="method-description">
|
501
|
+
<p>
|
502
|
+
.[abstract] directive pattern, which is used to detect directives.
|
503
|
+
</p>
|
504
|
+
<p><a class="source-toggle" href="#"
|
505
|
+
onclick="toggleCode('M000178-source');return false;">[Source]</a></p>
|
506
|
+
<div class="method-source-code" id="M000178-source">
|
507
|
+
<pre>
|
508
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 476</span>
|
509
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directive_pattern</span>
|
510
|
+
<span class="ruby-identifier">not_implemented</span>
|
511
|
+
<span class="ruby-comment cmt">#return /\A(\w+):\s*(.*)/</span>
|
512
|
+
<span class="ruby-keyword kw">end</span>
|
513
|
+
</pre>
|
514
|
+
</div>
|
515
|
+
</div>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
<div id="method-M000179" class="method-detail">
|
519
|
+
<a name="M000179"></a>
|
520
|
+
|
521
|
+
<div class="method-heading">
|
522
|
+
<a href="#M000179" class="method-signature">
|
523
|
+
<span class="method-name">mapping_pattern</span><span class="method-args">()</span>
|
524
|
+
</a>
|
525
|
+
</div>
|
526
|
+
|
527
|
+
<div class="method-description">
|
528
|
+
<p>
|
529
|
+
.[abstract] mapping pattern, which is used to parse ‘attr’
|
530
|
+
directive.
|
531
|
+
</p>
|
532
|
+
<p><a class="source-toggle" href="#"
|
533
|
+
onclick="toggleCode('M000179-source');return false;">[Source]</a></p>
|
534
|
+
<div class="method-source-code" id="M000179-source">
|
535
|
+
<pre>
|
536
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 483</span>
|
537
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mapping_pattern</span>
|
538
|
+
<span class="ruby-identifier">not_implemented</span>
|
539
|
+
<span class="ruby-comment cmt">#return /\A'([-:\w]+)'\s+(.*)/</span>
|
540
|
+
<span class="ruby-keyword kw">end</span>
|
541
|
+
</pre>
|
542
|
+
</div>
|
543
|
+
</div>
|
544
|
+
</div>
|
545
|
+
|
546
|
+
|
547
|
+
</div>
|
548
|
+
|
549
|
+
|
550
|
+
</div>
|
551
|
+
|
552
|
+
|
553
|
+
<div id="validator-badges">
|
554
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
</body>
|
558
|
+
</html>
|