PageTemplate 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/CVS/Entries +10 -0
  2. data/CVS/Repository +1 -0
  3. data/CVS/Root +1 -0
  4. data/Changes +13 -0
  5. data/Changes~ +7 -0
  6. data/InstalledFiles +7 -0
  7. data/README.txt +1 -1
  8. data/Rakefile +1 -1
  9. data/Rakefile~ +54 -0
  10. data/TC_PageTemplate.rb +137 -19
  11. data/TC_PageTemplate.rb~ +965 -0
  12. data/doc/classes/BlockCommand.html +1 -1
  13. data/doc/classes/BlockCommand.src/M000004.html +1 -1
  14. data/doc/classes/BlockCommand.src/M000005.html +1 -1
  15. data/doc/classes/BlockCommand.src/M000006.html +1 -1
  16. data/doc/classes/BlockCommand.src/M000007.html +1 -1
  17. data/doc/classes/BlockCommand.src/M000008.html +1 -1
  18. data/doc/classes/Command.html +10 -10
  19. data/doc/classes/Command.src/{M000029.html → M000032.html} +0 -0
  20. data/doc/classes/Command.src/{M000030.html → M000033.html} +0 -0
  21. data/doc/classes/CommentCommand.html +146 -0
  22. data/doc/classes/CommentCommand.src/M000009.html +18 -0
  23. data/doc/classes/IfCommand.html +15 -15
  24. data/doc/classes/IfCommand.src/{M000039.html → M000042.html} +1 -1
  25. data/doc/classes/IfCommand.src/{M000040.html → M000043.html} +1 -1
  26. data/doc/classes/IfCommand.src/{M000041.html → M000044.html} +1 -1
  27. data/doc/classes/IfElseCommand.html +15 -15
  28. data/doc/classes/IfElseCommand.src/M000025.html +5 -6
  29. data/doc/classes/IfElseCommand.src/{M000024.html → M000026.html} +1 -1
  30. data/doc/classes/IfElseCommand.src/M000027.html +20 -0
  31. data/doc/classes/IncludeCommand.html +16 -23
  32. data/doc/classes/IncludeCommand.src/M000019.html +12 -4
  33. data/doc/classes/IncludeCommand.src/{M000018.html → M000020.html} +10 -5
  34. data/doc/classes/IncludeCommand.src/M000021.html +18 -0
  35. data/doc/classes/IncludeCommandError.html +118 -0
  36. data/doc/classes/LoopCommand.src/M000001.html +1 -1
  37. data/doc/classes/LoopCommand.src/M000002.html +11 -2
  38. data/doc/classes/LoopCommand.src/M000003.html +1 -1
  39. data/doc/classes/LoopElseCommand.html +15 -15
  40. data/doc/classes/LoopElseCommand.src/M000022.html +5 -6
  41. data/doc/classes/LoopElseCommand.src/{M000021.html → M000023.html} +1 -1
  42. data/doc/classes/LoopElseCommand.src/M000024.html +20 -0
  43. data/doc/classes/Namespace.html +42 -42
  44. data/doc/classes/Namespace.src/M000034.html +5 -5
  45. data/doc/classes/Namespace.src/M000035.html +4 -22
  46. data/doc/classes/Namespace.src/M000036.html +4 -7
  47. data/doc/classes/Namespace.src/M000037.html +5 -4
  48. data/doc/classes/Namespace.src/M000038.html +22 -4
  49. data/doc/classes/Namespace.src/M000039.html +21 -0
  50. data/doc/classes/Namespace.src/M000040.html +18 -0
  51. data/doc/classes/Namespace.src/{M000031.html → M000041.html} +4 -5
  52. data/doc/classes/PageTemplate.html +72 -44
  53. data/doc/classes/PageTemplate.src/M000010.html +31 -11
  54. data/doc/classes/PageTemplate.src/M000011.html +4 -4
  55. data/doc/classes/PageTemplate.src/M000012.html +15 -4
  56. data/doc/classes/PageTemplate.src/M000013.html +4 -4
  57. data/doc/classes/PageTemplate.src/M000014.html +4 -4
  58. data/doc/classes/PageTemplate.src/M000015.html +4 -4
  59. data/doc/classes/PageTemplate.src/M000016.html +4 -5
  60. data/doc/classes/PageTemplate.src/M000017.html +18 -0
  61. data/doc/classes/PageTemplate.src/M000018.html +19 -0
  62. data/doc/classes/Syntax/CachedParser.html +10 -10
  63. data/doc/classes/Syntax/CachedParser.src/{M000045.html → M000048.html} +1 -1
  64. data/doc/classes/Syntax/CachedParser.src/{M000046.html → M000049.html} +2 -1
  65. data/doc/classes/Syntax/Glossary.html +16 -10
  66. data/doc/classes/Syntax/Glossary.src/{M000047.html → M000050.html} +1 -1
  67. data/doc/classes/Syntax/Glossary.src/{M000048.html → M000051.html} +1 -1
  68. data/doc/classes/Syntax/Parser.html +31 -31
  69. data/doc/classes/Syntax/Parser.src/M000052.html +6 -5
  70. data/doc/classes/Syntax/Parser.src/M000053.html +20 -37
  71. data/doc/classes/Syntax/Parser.src/M000054.html +4 -93
  72. data/doc/classes/Syntax/Parser.src/{M000049.html → M000055.html} +5 -6
  73. data/doc/classes/Syntax/Parser.src/M000056.html +53 -0
  74. data/doc/classes/Syntax/Parser.src/M000057.html +111 -0
  75. data/doc/classes/Syntax.html +1 -1
  76. data/doc/classes/TextCommand.html +15 -15
  77. data/doc/classes/TextCommand.src/{M000042.html → M000045.html} +1 -1
  78. data/doc/classes/TextCommand.src/{M000043.html → M000046.html} +1 -1
  79. data/doc/classes/TextCommand.src/{M000044.html → M000047.html} +1 -1
  80. data/doc/classes/UnlessCommand.html +151 -0
  81. data/doc/classes/UnlessCommand.src/M000028.html +20 -0
  82. data/doc/classes/ValueCommand.html +15 -15
  83. data/doc/classes/ValueCommand.src/{M000026.html → M000029.html} +1 -1
  84. data/doc/classes/ValueCommand.src/{M000027.html → M000030.html} +1 -1
  85. data/doc/classes/ValueCommand.src/{M000028.html → M000031.html} +1 -1
  86. data/doc/created.rid +1 -1
  87. data/doc/files/README_txt.html +2 -2
  88. data/doc/files/lib/PageTemplate_rb.html +1 -1
  89. data/doc/fr_class_index.html +3 -0
  90. data/doc/fr_method_index.html +52 -49
  91. data/lib/CVS/Entries +2 -0
  92. data/lib/CVS/Repository +1 -0
  93. data/lib/CVS/Root +1 -0
  94. data/lib/PageTemplate.rb +103 -26
  95. data/lib/PageTemplate.rb~ +1004 -0
  96. data/pkg/PageTemplate-1.2.0.gem +0 -0
  97. data/tdata/CVS/Entries +28 -0
  98. data/tdata/CVS/Repository +1 -0
  99. data/tdata/CVS/Root +1 -0
  100. data/tdata/cm.txt +3 -0
  101. data/tdata/include.4.nf.out.txt +2 -0
  102. data/tdata/metadata.1.txt +5 -0
  103. data/tdata/metadata.2.txt +5 -0
  104. data/tdata/metadata.3.txt +5 -0
  105. data/tdata/metadata.4.txt +5 -0
  106. data/tdata/p/CVS/Entries +5 -0
  107. data/tdata/p/CVS/Repository +1 -0
  108. data/tdata/p/CVS/Root +1 -0
  109. data/tdata/p/CVS/b2.txt,t +0 -0
  110. data/tdata/p/b2.txt +4 -0
  111. data/tdata/p/b2.txt~ +4 -0
  112. metadata +70 -32
  113. data/doc/classes/IfElseCommand.src/M000023.html +0 -19
  114. data/doc/classes/IncludeCommand.src/M000017.html +0 -21
  115. data/doc/classes/LoopElseCommand.src/M000020.html +0 -19
  116. data/doc/classes/Namespace.src/M000032.html +0 -18
  117. data/doc/classes/Namespace.src/M000033.html +0 -18
  118. data/doc/classes/PageTemplate.src/M000009.html +0 -46
  119. data/doc/classes/Syntax/Parser.src/M000050.html +0 -35
  120. data/doc/classes/Syntax/Parser.src/M000051.html +0 -18
  121. data/lib/MANIFEST +0 -2
  122. data/pkg/PageTemplate-1.1.2.gem +0 -0
@@ -95,8 +95,8 @@ CommandBlock for reuse later.
95
95
  <h3 class="section-bar">Methods</h3>
96
96
 
97
97
  <div class="name-list">
98
- <a href="#M000046">build</a>&nbsp;&nbsp;
99
- <a href="#M000045">new</a>&nbsp;&nbsp;
98
+ <a href="#M000049">build</a>&nbsp;&nbsp;
99
+ <a href="#M000048">new</a>&nbsp;&nbsp;
100
100
  </div>
101
101
  </div>
102
102
 
@@ -118,12 +118,12 @@ CommandBlock for reuse later.
118
118
  <div id="methods">
119
119
  <h3 class="section-bar">Public Class methods</h3>
120
120
 
121
- <div id="method-M000045" class="method-detail">
122
- <a name="M000045"></a>
121
+ <div id="method-M000048" class="method-detail">
122
+ <a name="M000048"></a>
123
123
 
124
124
  <div class="method-heading">
125
- <a href="CachedParser.src/M000045.html" target="Code" class="method-signature"
126
- onclick="popupCode('CachedParser.src/M000045.html');return false;">
125
+ <a href="CachedParser.src/M000048.html" target="Code" class="method-signature"
126
+ onclick="popupCode('CachedParser.src/M000048.html');return false;">
127
127
  <span class="method-name">new</span><span class="method-args">(glossary, path=Dir.getwd)</span>
128
128
  </a>
129
129
  </div>
@@ -134,12 +134,12 @@ CommandBlock for reuse later.
134
134
 
135
135
  <h3 class="section-bar">Public Instance methods</h3>
136
136
 
137
- <div id="method-M000046" class="method-detail">
138
- <a name="M000046"></a>
137
+ <div id="method-M000049" class="method-detail">
138
+ <a name="M000049"></a>
139
139
 
140
140
  <div class="method-heading">
141
- <a href="CachedParser.src/M000046.html" target="Code" class="method-signature"
142
- onclick="popupCode('CachedParser.src/M000046.html');return false;">
141
+ <a href="CachedParser.src/M000049.html" target="Code" class="method-signature"
142
+ onclick="popupCode('CachedParser.src/M000049.html');return false;">
143
143
  <span class="method-name">build</span><span class="method-args">(filename)</span>
144
144
  </a>
145
145
  </div>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 712</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 756</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">glossary</span>, <span class="ruby-identifier">path</span>=<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">getwd</span>)
15
15
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">glossary</span>, <span class="ruby-identifier">path</span>)
16
16
  <span class="ruby-comment cmt"># Create the cache directory if it does not exist.</span>
@@ -10,13 +10,14 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 717</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 761</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build</span>(<span class="ruby-identifier">filename</span>)
15
15
  <span class="ruby-comment cmt"># Determine the name of the cache file.</span>
16
16
  <span class="ruby-identifier">cacheFile</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">filename</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/_&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">filename</span>)
17
17
  <span class="ruby-identifier">saveCache</span> = <span class="ruby-keyword kw">false</span>
18
18
 
19
19
  <span class="ruby-comment cmt"># See if cache exists and is newer than source.</span>
20
+ <span class="ruby-identifier">cacheFile</span>.<span class="ruby-identifier">untaint</span>
20
21
  <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">cacheFile</span>)
21
22
  <span class="ruby-identifier">cacheStat</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">cacheFile</span>)
22
23
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cacheStat</span>.<span class="ruby-identifier">mtime</span> <span class="ruby-operator">&gt;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">filename</span>).<span class="ruby-identifier">mtime</span>
@@ -105,8 +105,8 @@ It also defines the syntax for the available markup directives:
105
105
  <h3 class="section-bar">Methods</h3>
106
106
 
107
107
  <div class="name-list">
108
- <a href="#M000048">lookup</a>&nbsp;&nbsp;
109
- <a href="#M000047">new</a>&nbsp;&nbsp;
108
+ <a href="#M000051">lookup</a>&nbsp;&nbsp;
109
+ <a href="#M000050">new</a>&nbsp;&nbsp;
110
110
  </div>
111
111
  </div>
112
112
 
@@ -146,12 +146,12 @@ It also defines the syntax for the available markup directives:
146
146
  <div id="methods">
147
147
  <h3 class="section-bar">Public Class methods</h3>
148
148
 
149
- <div id="method-M000047" class="method-detail">
150
- <a name="M000047"></a>
149
+ <div id="method-M000050" class="method-detail">
150
+ <a name="M000050"></a>
151
151
 
152
152
  <div class="method-heading">
153
- <a href="Glossary.src/M000047.html" target="Code" class="method-signature"
154
- onclick="popupCode('Glossary.src/M000047.html');return false;">
153
+ <a href="Glossary.src/M000050.html" target="Code" class="method-signature"
154
+ onclick="popupCode('Glossary.src/M000050.html');return false;">
155
155
  <span class="method-name">new</span><span class="method-args">(directive, glossary)</span>
156
156
  </a>
157
157
  </div>
@@ -183,6 +183,12 @@ href="Glossary.html">Syntax::Glossary</a> object:
183
183
  </li>
184
184
  <li>ifbranch
185
185
 
186
+ </li>
187
+ <li>unlessopen
188
+
189
+ </li>
190
+ <li>unlessclose
191
+
186
192
  </li>
187
193
  <li>loopopen
188
194
 
@@ -207,12 +213,12 @@ meaning.
207
213
 
208
214
  <h3 class="section-bar">Public Instance methods</h3>
209
215
 
210
- <div id="method-M000048" class="method-detail">
211
- <a name="M000048"></a>
216
+ <div id="method-M000051" class="method-detail">
217
+ <a name="M000051"></a>
212
218
 
213
219
  <div class="method-heading">
214
- <a href="Glossary.src/M000048.html" target="Code" class="method-signature"
215
- onclick="popupCode('Glossary.src/M000048.html');return false;">
220
+ <a href="Glossary.src/M000051.html" target="Code" class="method-signature"
221
+ onclick="popupCode('Glossary.src/M000051.html');return false;">
216
222
  <span class="method-name">lookup</span><span class="method-args">(text)</span>
217
223
  </a>
218
224
  </div>
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 390</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 422</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">directive</span>, <span class="ruby-identifier">glossary</span>)
15
15
  <span class="ruby-ivar">@directive</span> = <span class="ruby-identifier">directive</span>
16
16
  <span class="ruby-identifier">checkGlossary</span>(<span class="ruby-identifier">glossary</span>)
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 403</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 435</span>
14
14
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lookup</span>(<span class="ruby-identifier">text</span>)
15
15
  <span class="ruby-identifier">command</span> = <span class="ruby-keyword kw">nil</span>
16
16
  <span class="ruby-identifier">variable</span> = <span class="ruby-keyword kw">nil</span>
@@ -93,12 +93,12 @@ of text into a series of Commands.
93
93
  <h3 class="section-bar">Methods</h3>
94
94
 
95
95
  <div class="name-list">
96
- <a href="#M000050">build</a>&nbsp;&nbsp;
97
- <a href="#M000054">compile</a>&nbsp;&nbsp;
98
- <a href="#M000049">new</a>&nbsp;&nbsp;
99
- <a href="#M000051">output</a>&nbsp;&nbsp;
100
- <a href="#M000053">parse</a>&nbsp;&nbsp;
101
- <a href="#M000052">reset</a>&nbsp;&nbsp;
96
+ <a href="#M000053">build</a>&nbsp;&nbsp;
97
+ <a href="#M000057">compile</a>&nbsp;&nbsp;
98
+ <a href="#M000052">new</a>&nbsp;&nbsp;
99
+ <a href="#M000054">output</a>&nbsp;&nbsp;
100
+ <a href="#M000056">parse</a>&nbsp;&nbsp;
101
+ <a href="#M000055">reset</a>&nbsp;&nbsp;
102
102
  </div>
103
103
  </div>
104
104
 
@@ -133,12 +133,12 @@ of text into a series of Commands.
133
133
  <div id="methods">
134
134
  <h3 class="section-bar">Public Class methods</h3>
135
135
 
136
- <div id="method-M000049" class="method-detail">
137
- <a name="M000049"></a>
136
+ <div id="method-M000052" class="method-detail">
137
+ <a name="M000052"></a>
138
138
 
139
139
  <div class="method-heading">
140
- <a href="Parser.src/M000049.html" target="Code" class="method-signature"
141
- onclick="popupCode('Parser.src/M000049.html');return false;">
140
+ <a href="Parser.src/M000052.html" target="Code" class="method-signature"
141
+ onclick="popupCode('Parser.src/M000052.html');return false;">
142
142
  <span class="method-name">new</span><span class="method-args">(glossary, path=Dir.getwd)</span>
143
143
  </a>
144
144
  </div>
@@ -149,12 +149,12 @@ of text into a series of Commands.
149
149
 
150
150
  <h3 class="section-bar">Public Instance methods</h3>
151
151
 
152
- <div id="method-M000050" class="method-detail">
153
- <a name="M000050"></a>
152
+ <div id="method-M000053" class="method-detail">
153
+ <a name="M000053"></a>
154
154
 
155
155
  <div class="method-heading">
156
- <a href="Parser.src/M000050.html" target="Code" class="method-signature"
157
- onclick="popupCode('Parser.src/M000050.html');return false;">
156
+ <a href="Parser.src/M000053.html" target="Code" class="method-signature"
157
+ onclick="popupCode('Parser.src/M000053.html');return false;">
158
158
  <span class="method-name">build</span><span class="method-args">(filename)</span>
159
159
  </a>
160
160
  </div>
@@ -167,12 +167,12 @@ href="../PageTemplate.html">PageTemplate</a> directives.
167
167
  </div>
168
168
  </div>
169
169
 
170
- <div id="method-M000054" class="method-detail">
171
- <a name="M000054"></a>
170
+ <div id="method-M000057" class="method-detail">
171
+ <a name="M000057"></a>
172
172
 
173
173
  <div class="method-heading">
174
- <a href="Parser.src/M000054.html" target="Code" class="method-signature"
175
- onclick="popupCode('Parser.src/M000054.html');return false;">
174
+ <a href="Parser.src/M000057.html" target="Code" class="method-signature"
175
+ onclick="popupCode('Parser.src/M000057.html');return false;">
176
176
  <span class="method-name">compile</span><span class="method-args">(lines, filename = &quot;?&quot;)</span>
177
177
  </a>
178
178
  </div>
@@ -188,12 +188,12 @@ contains the original <tt>source</tt>.
188
188
  </div>
189
189
  </div>
190
190
 
191
- <div id="method-M000051" class="method-detail">
192
- <a name="M000051"></a>
191
+ <div id="method-M000054" class="method-detail">
192
+ <a name="M000054"></a>
193
193
 
194
194
  <div class="method-heading">
195
- <a href="Parser.src/M000051.html" target="Code" class="method-signature"
196
- onclick="popupCode('Parser.src/M000051.html');return false;">
195
+ <a href="Parser.src/M000054.html" target="Code" class="method-signature"
196
+ onclick="popupCode('Parser.src/M000054.html');return false;">
197
197
  <span class="method-name">output</span><span class="method-args">(namespace = nil)</span>
198
198
  </a>
199
199
  </div>
@@ -207,12 +207,12 @@ href="Parser.html">Parser</a>&#8217;s internal compiled CommandBlock, using
207
207
  </div>
208
208
  </div>
209
209
 
210
- <div id="method-M000053" class="method-detail">
211
- <a name="M000053"></a>
210
+ <div id="method-M000056" class="method-detail">
211
+ <a name="M000056"></a>
212
212
 
213
213
  <div class="method-heading">
214
- <a href="Parser.src/M000053.html" target="Code" class="method-signature"
215
- onclick="popupCode('Parser.src/M000053.html');return false;">
214
+ <a href="Parser.src/M000056.html" target="Code" class="method-signature"
215
+ onclick="popupCode('Parser.src/M000056.html');return false;">
216
216
  <span class="method-name">parse</span><span class="method-args">(source, filename = &quot;?&quot;)</span>
217
217
  </a>
218
218
  </div>
@@ -220,7 +220,7 @@ href="Parser.html">Parser</a>&#8217;s internal compiled CommandBlock, using
220
220
  <div class="method-description">
221
221
  <p>
222
222
  Turn an array of strings <tt>source</tt> into a series of directives that
223
- can be handled by <a href="Parser.html#M000054">Parser#compile</a>.
223
+ can be handled by <a href="Parser.html#M000057">Parser#compile</a>.
224
224
  </p>
225
225
  <p>
226
226
  If provided, <tt>filename</tt> is assumed to be the name of the file which
@@ -229,12 +229,12 @@ contains the original <tt>source</tt>.
229
229
  </div>
230
230
  </div>
231
231
 
232
- <div id="method-M000052" class="method-detail">
233
- <a name="M000052"></a>
232
+ <div id="method-M000055" class="method-detail">
233
+ <a name="M000055"></a>
234
234
 
235
235
  <div class="method-heading">
236
- <a href="Parser.src/M000052.html" target="Code" class="method-signature"
237
- onclick="popupCode('Parser.src/M000052.html');return false;">
236
+ <a href="Parser.src/M000055.html" target="Code" class="method-signature"
237
+ onclick="popupCode('Parser.src/M000055.html');return false;">
238
238
  <span class="method-name">reset</span><span class="method-args">()</span>
239
239
  </a>
240
240
  </div>
@@ -5,17 +5,18 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>reset (Syntax::Parser)</title>
8
+ <title>new (Syntax::Parser)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 513</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 515</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">glossary</span>, <span class="ruby-identifier">path</span>=<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">getwd</span>)
15
+ <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span>
16
+ <span class="ruby-ivar">@syntax</span> = <span class="ruby-identifier">glossary</span>
17
+ <span class="ruby-ivar">@commands</span> = <span class="ruby-keyword kw">nil</span>
15
18
  <span class="ruby-ivar">@lastFile</span> = <span class="ruby-keyword kw">nil</span>
16
19
  <span class="ruby-ivar">@mTime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">0</span>)
17
- <span class="ruby-ivar">@commands</span> = <span class="ruby-keyword kw">nil</span>
18
- <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
19
20
  <span class="ruby-keyword kw">end</span></pre>
20
21
  </body>
21
22
  </html>
@@ -5,49 +5,32 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>parse (Syntax::Parser)</title>
8
+ <title>build (Syntax::Parser)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 525</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">filename</span> = <span class="ruby-value str">&quot;?&quot;</span>)
15
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{filename}: Parsing ...&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
16
-
17
- <span class="ruby-comment cmt"># Translate source into listing of text and directives</span>
18
- <span class="ruby-identifier">lineNo</span> = <span class="ruby-value">1</span>
19
- <span class="ruby-identifier">parsed</span> = []
20
- <span class="ruby-identifier">source</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
21
- <span class="ruby-comment cmt"># split into plain text and directives</span>
22
- <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">line</span>
23
- <span class="ruby-identifier">dirMatch</span> = <span class="ruby-ivar">@syntax</span>.<span class="ruby-identifier">directive</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">line</span>)
24
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dirMatch</span>
25
- <span class="ruby-identifier">matchText</span> = <span class="ruby-identifier">dirMatch</span>[<span class="ruby-value">1</span>]
26
- <span class="ruby-identifier">pre</span> = <span class="ruby-identifier">dirMatch</span>.<span class="ruby-identifier">pre_match</span>
27
- <span class="ruby-identifier">directive</span> = <span class="ruby-ivar">@syntax</span>.<span class="ruby-identifier">lookup</span>(<span class="ruby-identifier">matchText</span>)
28
- <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">lineNo</span>, <span class="ruby-identifier">pre</span>]
29
-
30
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">directive</span>
31
- <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">lineNo</span>, <span class="ruby-identifier">directive</span>]
32
- <span class="ruby-keyword kw">else</span>
33
- <span class="ruby-comment cmt"># Unrecognized directives are treated as</span>
34
- <span class="ruby-comment cmt"># plain text.</span>
35
- <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">lineNo</span>, <span class="ruby-identifier">dirMatch</span>[<span class="ruby-value">0</span>]]
36
- <span class="ruby-keyword kw">end</span>
37
-
38
- <span class="ruby-identifier">fragment</span> = <span class="ruby-identifier">dirMatch</span>.<span class="ruby-identifier">post_match</span>
39
- <span class="ruby-identifier">line</span> = <span class="ruby-identifier">fragment</span>
40
- <span class="ruby-keyword kw">else</span>
41
- <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">lineNo</span>, <span class="ruby-identifier">line</span>]
42
- <span class="ruby-keyword kw">break</span>
43
- <span class="ruby-keyword kw">end</span>
44
- <span class="ruby-keyword kw">end</span>
45
- <span class="ruby-identifier">lineNo</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 524</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build</span>(<span class="ruby-identifier">filename</span>)
15
+ <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">untaint</span>
16
+ <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">filename</span>)
17
+ <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">filename</span>)
18
+ <span class="ruby-keyword kw">else</span>
19
+ <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@path</span>, <span class="ruby-identifier">filename</span>))
20
+ <span class="ruby-keyword kw">end</span>
21
+
22
+ <span class="ruby-comment cmt"># If this is a new file, or the file has been changed,</span>
23
+ <span class="ruby-comment cmt"># parse and compile.</span>
24
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filename</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@lastFile</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">mtime</span> <span class="ruby-operator">&lt;</span> <span class="ruby-ivar">@mTime</span>
25
+ <span class="ruby-identifier">reset</span>
26
+ <span class="ruby-identifier">source</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">readlines</span>
27
+ <span class="ruby-identifier">parsed</span> = <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">filename</span>)
28
+ <span class="ruby-ivar">@commands</span> = <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">parsed</span>, <span class="ruby-identifier">filename</span>)
29
+ <span class="ruby-ivar">@lastFile</span> = <span class="ruby-identifier">filename</span>
30
+ <span class="ruby-ivar">@mTime</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">mtime</span>
46
31
  <span class="ruby-keyword kw">end</span>
47
32
 
48
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{filename}: #{@parsed.length} directives&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
49
-
50
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parsed</span>
33
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@commands</span>
51
34
  <span class="ruby-keyword kw">end</span></pre>
52
35
  </body>
53
36
  </html>
@@ -5,103 +5,14 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>compile (Syntax::Parser)</title>
8
+ <title>output (Syntax::Parser)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 568</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">lines</span>, <span class="ruby-identifier">filename</span> = <span class="ruby-value str">&quot;?&quot;</span>)
15
-
16
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{filename}: Compiling ...&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
17
- <span class="ruby-comment cmt"># Translate listing of text and directives into a BlockCommand</span>
18
- <span class="ruby-identifier">commands</span> = <span class="ruby-constant">BlockCommand</span>.<span class="ruby-identifier">new</span>()
19
- <span class="ruby-identifier">max</span> = <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">length</span>
20
- <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
21
- <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">max</span>
22
- <span class="ruby-identifier">line</span> = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">i</span>]
23
- <span class="ruby-identifier">type</span> = <span class="ruby-identifier">line</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">class</span>
24
- <span class="ruby-identifier">command</span> = <span class="ruby-keyword kw">nil</span>
25
- <span class="ruby-comment cmt">#puts &quot;#{filename}/#{line[0]}: #{type} -- #{line}&quot;</span>
26
-
27
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span>
28
- <span class="ruby-identifier">command</span> = <span class="ruby-constant">TextCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">line</span>[<span class="ruby-value">1</span>])
29
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
30
- <span class="ruby-identifier">directive</span> = <span class="ruby-identifier">line</span>[<span class="ruby-value">1</span>][<span class="ruby-value">0</span>]
31
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">line</span>[<span class="ruby-value">1</span>][<span class="ruby-value">1</span>]
32
- <span class="ruby-identifier">print</span> <span class="ruby-node">&quot;(#{directive} #{value}) &quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
33
-
34
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">directive</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;value&quot;</span>
35
- <span class="ruby-identifier">command</span> = <span class="ruby-constant">ValueCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>)
36
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">directive</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;include&quot;</span>
37
- <span class="ruby-identifier">command</span> = <span class="ruby-constant">IncludeCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>, <span class="ruby-ivar">@path</span>)
38
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">directive</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(\w+?)open$/</span>
39
- <span class="ruby-identifier">mainBlock</span> = <span class="ruby-keyword kw">nil</span>
40
- <span class="ruby-identifier">branchBlock</span> = <span class="ruby-keyword kw">nil</span>
41
- <span class="ruby-identifier">close</span> = <span class="ruby-keyword kw">nil</span>
42
- <span class="ruby-identifier">branch</span> = <span class="ruby-keyword kw">nil</span>
43
-
44
- <span class="ruby-identifier">block</span> = <span class="ruby-identifier">$1</span>
45
- <span class="ruby-identifier">startIndex</span> = <span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
46
- <span class="ruby-identifier">closers</span> = <span class="ruby-identifier">findClose</span>(<span class="ruby-identifier">lines</span>[<span class="ruby-identifier">startIndex</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>],
47
- <span class="ruby-identifier">startIndex</span>, <span class="ruby-identifier">block</span>)
48
-
49
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">closers</span>[<span class="ruby-value str">'close'</span>]
50
- <span class="ruby-identifier">close</span> = <span class="ruby-identifier">closers</span>[<span class="ruby-value str">'close'</span>]
51
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">closers</span>[<span class="ruby-value str">'branch'</span>]
52
- <span class="ruby-identifier">branch</span> = <span class="ruby-identifier">closers</span>[<span class="ruby-value str">'branch'</span>]
53
- <span class="ruby-identifier">mainLines</span> = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">startIndex</span><span class="ruby-operator">...</span><span class="ruby-identifier">branch</span>]
54
- <span class="ruby-identifier">mainBlock</span> = <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">mainLines</span>)
55
- <span class="ruby-identifier">branchLines</span> = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">branch</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-identifier">close</span>]
56
- <span class="ruby-identifier">branchBlock</span> = <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">branchLines</span>)
57
- <span class="ruby-keyword kw">else</span>
58
- <span class="ruby-identifier">mainLines</span> = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">startIndex</span><span class="ruby-operator">...</span><span class="ruby-identifier">close</span>]
59
- <span class="ruby-identifier">mainBlock</span> = <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">mainLines</span>)
60
- <span class="ruby-keyword kw">end</span>
61
- <span class="ruby-keyword kw">else</span>
62
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{@file}:#{line[0]} - &quot;</span> <span class="ruby-operator">+</span>
63
- <span class="ruby-node">&quot;#{block} #{value} doesn't close&quot;</span>
64
- <span class="ruby-keyword kw">end</span>
65
-
66
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;if&quot;</span>
67
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mainBlock</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">branchBlock</span>
68
- <span class="ruby-identifier">command</span> = <span class="ruby-constant">IfElseCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>,
69
- <span class="ruby-identifier">mainBlock</span>, <span class="ruby-identifier">branchBlock</span>)
70
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">mainBlock</span>
71
- <span class="ruby-identifier">command</span> = <span class="ruby-constant">IfCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">mainBlock</span>)
72
- <span class="ruby-keyword kw">end</span>
73
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">block</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;loop&quot;</span>
74
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mainBlock</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">branchBlock</span>
75
- <span class="ruby-identifier">command</span> = <span class="ruby-constant">LoopElseCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>,
76
- <span class="ruby-identifier">mainBlock</span>, <span class="ruby-identifier">branchBlock</span>)
77
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">mainBlock</span>
78
- <span class="ruby-identifier">command</span> = <span class="ruby-constant">LoopCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">mainBlock</span>)
79
- <span class="ruby-keyword kw">end</span>
80
- <span class="ruby-keyword kw">else</span>
81
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{filename}: #{line[0]} - &quot;</span> <span class="ruby-operator">+</span>
82
- <span class="ruby-node">&quot;Unrecognized block type '#{block}'&quot;</span>
83
- <span class="ruby-keyword kw">end</span>
84
-
85
- <span class="ruby-comment cmt"># Skip to the line after the block closer.</span>
86
- <span class="ruby-identifier">i</span> = <span class="ruby-identifier">close</span>
87
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-value str">%Q[
88
- ifbranch ifclose loopbranch loopclose
89
- ]</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">directive</span>)
90
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{@file}:#{line[0]} - #{directive}&quot;</span> <span class="ruby-operator">+</span>
91
- <span class="ruby-value str">&quot; without corresponding opening directive&quot;</span>
92
- <span class="ruby-keyword kw">else</span>
93
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{@file}:#{line[0]} - Unknown command #{directive}&quot;</span>
94
- <span class="ruby-keyword kw">end</span>
95
- <span class="ruby-keyword kw">else</span>
96
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{@file}: Unknown instruction in line #{line}&quot;</span>
97
- <span class="ruby-keyword kw">end</span>
98
-
99
- <span class="ruby-identifier">commands</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">command</span>)
100
- <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
101
- <span class="ruby-keyword kw">end</span>
102
-
103
- <span class="ruby-comment cmt"># Return compiled BlockCommand</span>
104
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">commands</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 548</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output</span>(<span class="ruby-identifier">namespace</span> = <span class="ruby-keyword kw">nil</span>)
15
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@commands</span>.<span class="ruby-identifier">output</span>(<span class="ruby-identifier">namespace</span>)
105
16
  <span class="ruby-keyword kw">end</span></pre>
106
17
  </body>
107
18
  </html>
@@ -5,18 +5,17 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>new (Syntax::Parser)</title>
8
+ <title>reset (Syntax::Parser)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 476</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">glossary</span>, <span class="ruby-identifier">path</span>=<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">getwd</span>)
15
- <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span>
16
- <span class="ruby-ivar">@syntax</span> = <span class="ruby-identifier">glossary</span>
17
- <span class="ruby-ivar">@commands</span> = <span class="ruby-keyword kw">nil</span>
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 553</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
18
15
  <span class="ruby-ivar">@lastFile</span> = <span class="ruby-keyword kw">nil</span>
19
16
  <span class="ruby-ivar">@mTime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-value">0</span>)
17
+ <span class="ruby-ivar">@commands</span> = <span class="ruby-keyword kw">nil</span>
18
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
20
19
  <span class="ruby-keyword kw">end</span></pre>
21
20
  </body>
22
21
  </html>
@@ -0,0 +1,53 @@
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>
7
+ <head>
8
+ <title>parse (Syntax::Parser)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/PageTemplate.rb, line 565</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">filename</span> = <span class="ruby-value str">&quot;?&quot;</span>)
15
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{filename}: Parsing ...&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
16
+
17
+ <span class="ruby-comment cmt"># Translate source into listing of text and directives</span>
18
+ <span class="ruby-identifier">lineNo</span> = <span class="ruby-value">1</span>
19
+ <span class="ruby-identifier">parsed</span> = []
20
+ <span class="ruby-identifier">source</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
21
+ <span class="ruby-comment cmt"># split into plain text and directives</span>
22
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">line</span>
23
+ <span class="ruby-identifier">dirMatch</span> = <span class="ruby-ivar">@syntax</span>.<span class="ruby-identifier">directive</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">line</span>)
24
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dirMatch</span>
25
+ <span class="ruby-identifier">matchText</span> = <span class="ruby-identifier">dirMatch</span>[<span class="ruby-value">1</span>]
26
+ <span class="ruby-identifier">pre</span> = <span class="ruby-identifier">dirMatch</span>.<span class="ruby-identifier">pre_match</span>
27
+ <span class="ruby-identifier">directive</span> = <span class="ruby-ivar">@syntax</span>.<span class="ruby-identifier">lookup</span>(<span class="ruby-identifier">matchText</span>)
28
+ <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">lineNo</span>, <span class="ruby-identifier">pre</span>]
29
+
30
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">directive</span>
31
+ <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">lineNo</span>, <span class="ruby-identifier">directive</span>]
32
+ <span class="ruby-keyword kw">else</span>
33
+ <span class="ruby-comment cmt"># Unrecognized directives are treated as</span>
34
+ <span class="ruby-comment cmt"># plain text.</span>
35
+ <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">lineNo</span>, <span class="ruby-identifier">dirMatch</span>[<span class="ruby-value">0</span>]]
36
+ <span class="ruby-keyword kw">end</span>
37
+
38
+ <span class="ruby-identifier">fragment</span> = <span class="ruby-identifier">dirMatch</span>.<span class="ruby-identifier">post_match</span>
39
+ <span class="ruby-identifier">line</span> = <span class="ruby-identifier">fragment</span>
40
+ <span class="ruby-keyword kw">else</span>
41
+ <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">lineNo</span>, <span class="ruby-identifier">line</span>]
42
+ <span class="ruby-keyword kw">break</span>
43
+ <span class="ruby-keyword kw">end</span>
44
+ <span class="ruby-keyword kw">end</span>
45
+ <span class="ruby-identifier">lineNo</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
46
+ <span class="ruby-keyword kw">end</span>
47
+
48
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{filename}: #{@parsed.length} directives&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
49
+
50
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parsed</span>
51
+ <span class="ruby-keyword kw">end</span></pre>
52
+ </body>
53
+ </html>