PageTemplate 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. data/Changes +24 -0
  2. data/MANIFEST +0 -1
  3. data/README.txt +10 -8
  4. data/Rakefile +30 -9
  5. data/lib/PageTemplate/case.rb +72 -0
  6. data/lib/PageTemplate/commands.rb +500 -0
  7. data/lib/PageTemplate/parser.rb +373 -0
  8. data/lib/PageTemplate.rb +47 -991
  9. data/setup-usage.txt +129 -0
  10. data/setup.rb +1360 -0
  11. data/tdata/dummy.txt +2 -0
  12. data/test.rb +616 -0
  13. metadata +13 -169
  14. data/CVS/Entries +0 -10
  15. data/CVS/Repository +0 -1
  16. data/CVS/Root +0 -1
  17. data/Changes~ +0 -7
  18. data/InstalledFiles +0 -7
  19. data/Rakefile~ +0 -54
  20. data/TC_PageTemplate.rb +0 -974
  21. data/TC_PageTemplate.rb~ +0 -965
  22. data/config.save +0 -12
  23. data/doc/classes/BlockCommand.html +0 -229
  24. data/doc/classes/BlockCommand.src/M000004.html +0 -18
  25. data/doc/classes/BlockCommand.src/M000005.html +0 -25
  26. data/doc/classes/BlockCommand.src/M000006.html +0 -18
  27. data/doc/classes/BlockCommand.src/M000007.html +0 -23
  28. data/doc/classes/BlockCommand.src/M000008.html +0 -24
  29. data/doc/classes/Command.html +0 -167
  30. data/doc/classes/Command.src/M000032.html +0 -19
  31. data/doc/classes/Command.src/M000033.html +0 -18
  32. data/doc/classes/CommentCommand.html +0 -146
  33. data/doc/classes/CommentCommand.src/M000009.html +0 -18
  34. data/doc/classes/IfCommand.html +0 -193
  35. data/doc/classes/IfCommand.src/M000042.html +0 -19
  36. data/doc/classes/IfCommand.src/M000043.html +0 -20
  37. data/doc/classes/IfCommand.src/M000044.html +0 -20
  38. data/doc/classes/IfElseCommand.html +0 -189
  39. data/doc/classes/IfElseCommand.src/M000025.html +0 -19
  40. data/doc/classes/IfElseCommand.src/M000026.html +0 -23
  41. data/doc/classes/IfElseCommand.src/M000027.html +0 -20
  42. data/doc/classes/IncludeCommand.html +0 -171
  43. data/doc/classes/IncludeCommand.src/M000019.html +0 -26
  44. data/doc/classes/IncludeCommand.src/M000020.html +0 -28
  45. data/doc/classes/IncludeCommand.src/M000021.html +0 -18
  46. data/doc/classes/IncludeCommandError.html +0 -118
  47. data/doc/classes/LoopCommand.html +0 -197
  48. data/doc/classes/LoopCommand.src/M000001.html +0 -19
  49. data/doc/classes/LoopCommand.src/M000002.html +0 -42
  50. data/doc/classes/LoopCommand.src/M000003.html +0 -20
  51. data/doc/classes/LoopElseCommand.html +0 -190
  52. data/doc/classes/LoopElseCommand.src/M000022.html +0 -19
  53. data/doc/classes/LoopElseCommand.src/M000023.html +0 -23
  54. data/doc/classes/LoopElseCommand.src/M000024.html +0 -20
  55. data/doc/classes/Namespace.html +0 -297
  56. data/doc/classes/Namespace.src/M000034.html +0 -19
  57. data/doc/classes/Namespace.src/M000035.html +0 -18
  58. data/doc/classes/Namespace.src/M000036.html +0 -18
  59. data/doc/classes/Namespace.src/M000037.html +0 -19
  60. data/doc/classes/Namespace.src/M000038.html +0 -36
  61. data/doc/classes/Namespace.src/M000039.html +0 -21
  62. data/doc/classes/Namespace.src/M000040.html +0 -18
  63. data/doc/classes/Namespace.src/M000041.html +0 -18
  64. data/doc/classes/PageTemplate.html +0 -380
  65. data/doc/classes/PageTemplate.src/M000010.html +0 -49
  66. data/doc/classes/PageTemplate.src/M000011.html +0 -18
  67. data/doc/classes/PageTemplate.src/M000012.html +0 -29
  68. data/doc/classes/PageTemplate.src/M000013.html +0 -18
  69. data/doc/classes/PageTemplate.src/M000014.html +0 -18
  70. data/doc/classes/PageTemplate.src/M000015.html +0 -18
  71. data/doc/classes/PageTemplate.src/M000016.html +0 -18
  72. data/doc/classes/PageTemplate.src/M000017.html +0 -18
  73. data/doc/classes/PageTemplate.src/M000018.html +0 -19
  74. data/doc/classes/Syntax/CachedParser.html +0 -163
  75. data/doc/classes/Syntax/CachedParser.src/M000048.html +0 -19
  76. data/doc/classes/Syntax/CachedParser.src/M000049.html +0 -53
  77. data/doc/classes/Syntax/Glossary.html +0 -251
  78. data/doc/classes/Syntax/Glossary.src/M000050.html +0 -20
  79. data/doc/classes/Syntax/Glossary.src/M000051.html +0 -29
  80. data/doc/classes/Syntax/Parser.html +0 -261
  81. data/doc/classes/Syntax/Parser.src/M000052.html +0 -22
  82. data/doc/classes/Syntax/Parser.src/M000053.html +0 -36
  83. data/doc/classes/Syntax/Parser.src/M000054.html +0 -18
  84. data/doc/classes/Syntax/Parser.src/M000055.html +0 -21
  85. data/doc/classes/Syntax/Parser.src/M000056.html +0 -53
  86. data/doc/classes/Syntax/Parser.src/M000057.html +0 -111
  87. data/doc/classes/Syntax.html +0 -139
  88. data/doc/classes/TextCommand.html +0 -185
  89. data/doc/classes/TextCommand.src/M000045.html +0 -18
  90. data/doc/classes/TextCommand.src/M000046.html +0 -18
  91. data/doc/classes/TextCommand.src/M000047.html +0 -18
  92. data/doc/classes/UnlessCommand.html +0 -151
  93. data/doc/classes/UnlessCommand.src/M000028.html +0 -20
  94. data/doc/classes/ValueCommand.html +0 -186
  95. data/doc/classes/ValueCommand.src/M000029.html +0 -18
  96. data/doc/classes/ValueCommand.src/M000030.html +0 -18
  97. data/doc/classes/ValueCommand.src/M000031.html +0 -20
  98. data/doc/created.rid +0 -1
  99. data/doc/files/README_txt.html +0 -224
  100. data/doc/files/lib/PageTemplate_rb.html +0 -119
  101. data/doc/fr_class_index.html +0 -44
  102. data/doc/fr_file_index.html +0 -28
  103. data/doc/fr_method_index.html +0 -83
  104. data/doc/index.html +0 -24
  105. data/doc/rdoc-style.css +0 -208
  106. data/install.rb +0 -1015
  107. data/lib/CVS/Entries +0 -2
  108. data/lib/CVS/Repository +0 -1
  109. data/lib/CVS/Root +0 -1
  110. data/lib/PageTemplate.rb~ +0 -1004
  111. data/pkg/PageTemplate-1.2.0.gem +0 -0
  112. data/tdata/CVS/Entries +0 -28
  113. data/tdata/CVS/Repository +0 -1
  114. data/tdata/CVS/Root +0 -1
  115. data/tdata/cm.txt +0 -3
  116. data/tdata/complex.txt +0 -116
  117. data/tdata/i1.txt +0 -1
  118. data/tdata/i2.txt +0 -7
  119. data/tdata/ib1.txt +0 -7
  120. data/tdata/ib2.txt +0 -13
  121. data/tdata/ie1.txt +0 -4
  122. data/tdata/ie2.txt +0 -15
  123. data/tdata/include.1.txt +0 -1
  124. data/tdata/include.2.txt +0 -1
  125. data/tdata/include.3.txt +0 -1
  126. data/tdata/include.4.nf.out.txt +0 -2
  127. data/tdata/include.4.out.txt +0 -3
  128. data/tdata/include.4.txt +0 -2
  129. data/tdata/include.4a.txt +0 -1
  130. data/tdata/include.4b.txt +0 -2
  131. data/tdata/include.5.txt +0 -2
  132. data/tdata/l1.txt +0 -5
  133. data/tdata/l2.txt +0 -7
  134. data/tdata/metadata.1.txt +0 -5
  135. data/tdata/metadata.2.txt +0 -5
  136. data/tdata/metadata.3.txt +0 -5
  137. data/tdata/metadata.4.txt +0 -5
  138. data/tdata/nm.txt +0 -4
  139. data/tdata/p/CVS/Entries +0 -5
  140. data/tdata/p/CVS/Repository +0 -1
  141. data/tdata/p/CVS/Root +0 -1
  142. data/tdata/p/CVS/b2.txt,t +0 -0
  143. data/tdata/p/_b1.txt +0 -0
  144. data/tdata/p/b1.txt +0 -4
  145. data/tdata/p/b2.txt +0 -4
  146. data/tdata/p/b2.txt~ +0 -4
  147. data/tdata/p/cb1.txt +0 -4
  148. data/tdata/t.txt +0 -2
  149. data/tdata/v1.txt +0 -11
  150. data/tdata/v2.txt +0 -11
@@ -1,36 +0,0 @@
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>get (Namespace)</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 53</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>)
15
- <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>
16
-
17
- <span class="ruby-ivar">@nSpaces</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ns</span><span class="ruby-operator">|</span>
18
-
19
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">&quot;:#{key}&quot;</span>)
20
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;:#{key}&quot;</span>)
21
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">&quot;#{key}&quot;</span>)
22
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">key</span>)
23
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;[]&quot;</span>)
24
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">ns</span>[<span class="ruby-identifier">key</span>]
25
- <span class="ruby-keyword kw">end</span>
26
-
27
- <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>
28
- <span class="ruby-keyword kw">end</span>
29
-
30
- <span class="ruby-identifier">value</span> = <span class="ruby-ivar">@global</span>[<span class="ruby-identifier">key</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">value</span>
31
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Namespace #{key}: #{value}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
32
-
33
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">value</span>
34
- <span class="ruby-keyword kw">end</span></pre>
35
- </body>
36
- </html>
@@ -1,21 +0,0 @@
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>true? (Namespace)</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 78</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">true?</span>(<span class="ruby-identifier">flag</span>)
15
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">flag</span>)
16
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">value</span>
17
-
18
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">value</span>
19
- <span class="ruby-keyword kw">end</span></pre>
20
- </body>
21
- </html>
@@ -1,18 +0,0 @@
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>push (Namespace)</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 87</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push</span>(<span class="ruby-identifier">namespace</span>)
15
- <span class="ruby-ivar">@nSpaces</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">namespace</span>)
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,18 +0,0 @@
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>pop (Namespace)</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 94</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pop</span>
15
- <span class="ruby-ivar">@nSpaces</span>.<span class="ruby-identifier">pop</span>
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,380 +0,0 @@
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: PageTemplate</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">PageTemplate</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/PageTemplate_rb.html">
59
- lib/PageTemplate.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
- An object which parses text files littered with template directives and can
84
- produce text based on set parameters and the instructions contained within
85
- the text file. Each <a href="PageTemplate.html">PageTemplate</a> has its
86
- own <a href="Namespace.html">Namespace</a>, so there shouldn&#8217;t be any
87
- problems using it in a threaded environment.
88
- </p>
89
- <p>
90
- <a href="PageTemplate.html">PageTemplate</a> is the primary user Class for
91
- this package.
92
- </p>
93
-
94
- </div>
95
-
96
-
97
- </div>
98
-
99
- <div id="method-list">
100
- <h3 class="section-bar">Methods</h3>
101
-
102
- <div class="name-list">
103
- <a href="#M000016">[]</a>&nbsp;&nbsp;
104
- <a href="#M000015">[]=</a>&nbsp;&nbsp;
105
- <a href="#M000011">add_path</a>&nbsp;&nbsp;
106
- <a href="#M000018">clearFile</a>&nbsp;&nbsp;
107
- <a href="#M000014">getParameter</a>&nbsp;&nbsp;
108
- <a href="#M000012">load</a>&nbsp;&nbsp;
109
- <a href="#M000010">new</a>&nbsp;&nbsp;
110
- <a href="#M000017">output</a>&nbsp;&nbsp;
111
- <a href="#M000013">setParameter</a>&nbsp;&nbsp;
112
- </div>
113
- </div>
114
-
115
- </div>
116
-
117
-
118
- <!-- if includes -->
119
-
120
- <div id="section">
121
-
122
-
123
-
124
-
125
-
126
- <div id="attribute-list">
127
- <h3 class="section-bar">Attributes</h3>
128
-
129
- <div class="name-list">
130
- <table>
131
- <tr class="top-aligned-row context-row">
132
- <td class="context-item-name">file</td>
133
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
134
- <td class="context-item-desc"></td>
135
- </tr>
136
- <tr class="top-aligned-row context-row">
137
- <td class="context-item-name">parser</td>
138
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
139
- <td class="context-item-desc"></td>
140
- </tr>
141
- <tr class="top-aligned-row context-row">
142
- <td class="context-item-name">path</td>
143
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
144
- <td class="context-item-desc"></td>
145
- </tr>
146
- <tr class="top-aligned-row context-row">
147
- <td class="context-item-name">syntax</td>
148
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
149
- <td class="context-item-desc"></td>
150
- </tr>
151
- </table>
152
- </div>
153
- </div>
154
-
155
-
156
-
157
- <!-- if method_list -->
158
- <div id="methods">
159
- <h3 class="section-bar">Public Class methods</h3>
160
-
161
- <div id="method-M000010" class="method-detail">
162
- <a name="M000010"></a>
163
-
164
- <div class="method-heading">
165
- <a href="PageTemplate.src/M000010.html" target="Code" class="method-signature"
166
- onclick="popupCode('PageTemplate.src/M000010.html');return false;">
167
- <span class="method-name">new</span><span class="method-args">(args = {})</span>
168
- </a>
169
- </div>
170
-
171
- <div class="method-description">
172
- <p>
173
- Creates a new <a href="PageTemplate.html">PageTemplate</a> object, using
174
- <tt>args</tt> to provide optional initialization.
175
- </p>
176
- <h4>Possible Keys For Args</h4>
177
- <dl>
178
- <dt>:include_path</dt><dd>Additional directories that <a href="PageTemplate.html">PageTemplate</a>
179
- will look for template files in.
180
-
181
- <ul>
182
- <li>May be a string or Array
183
-
184
- </li>
185
- </ul>
186
- </dd>
187
- <dt>:filename</dt><dd>The name of a text file to use for a template.
188
-
189
- </dd>
190
- <dt>:syntax</dt><dd>A <a href="Syntax/Glossary.html">Syntax::Glossary</a> object, provided if
191
- the user wants
192
-
193
- </dd>
194
- </dl>
195
- <pre>
196
- an alternate syntax for template parse directives. If not
197
- provided, then Syntax::DEFAULT is used.
198
- </pre>
199
- <dl>
200
- <dt>:use_cache</dt><dd>If <tt>true</tt>, the <a href="PageTemplate.html">PageTemplate</a> object
201
- will use a <a href="Syntax/CachedParser.html">Syntax::CachedParser</a>
202
- which stores compiled template data to disk in the same directory as the
203
- template file itself. This cached template still needs you to provide a <a
204
- href="Namespace.html">Namespace</a> during output, though.
205
-
206
- </dd>
207
- </dl>
208
- </div>
209
- </div>
210
-
211
- <h3 class="section-bar">Public Instance methods</h3>
212
-
213
- <div id="method-M000016" class="method-detail">
214
- <a name="M000016"></a>
215
-
216
- <div class="method-heading">
217
- <a href="PageTemplate.src/M000016.html" target="Code" class="method-signature"
218
- onclick="popupCode('PageTemplate.src/M000016.html');return false;">
219
- <span class="method-name">[]</span><span class="method-args">(key)</span>
220
- </a>
221
- </div>
222
-
223
- <div class="method-description">
224
- <p>
225
- An alias for <a
226
- href="PageTemplate.html#M000014">PageTemplate.getParameter</a>(key)
227
- </p>
228
- </div>
229
- </div>
230
-
231
- <div id="method-M000015" class="method-detail">
232
- <a name="M000015"></a>
233
-
234
- <div class="method-heading">
235
- <a href="PageTemplate.src/M000015.html" target="Code" class="method-signature"
236
- onclick="popupCode('PageTemplate.src/M000015.html');return false;">
237
- <span class="method-name">[]=</span><span class="method-args">(key, value)</span>
238
- </a>
239
- </div>
240
-
241
- <div class="method-description">
242
- <p>
243
- An alias for <a
244
- href="PageTemplate.html#M000013">PageTemplate.setParameter</a>(key, value)
245
- </p>
246
- </div>
247
- </div>
248
-
249
- <div id="method-M000011" class="method-detail">
250
- <a name="M000011"></a>
251
-
252
- <div class="method-heading">
253
- <a href="PageTemplate.src/M000011.html" target="Code" class="method-signature"
254
- onclick="popupCode('PageTemplate.src/M000011.html');return false;">
255
- <span class="method-name">add_path</span><span class="method-args">(path)</span>
256
- </a>
257
- </div>
258
-
259
- <div class="method-description">
260
- <p>
261
- Add a path to the search path for loading includes.
262
- </p>
263
- </div>
264
- </div>
265
-
266
- <div id="method-M000018" class="method-detail">
267
- <a name="M000018"></a>
268
-
269
- <div class="method-heading">
270
- <a href="PageTemplate.src/M000018.html" target="Code" class="method-signature"
271
- onclick="popupCode('PageTemplate.src/M000018.html');return false;">
272
- <span class="method-name">clearFile</span><span class="method-args">()</span>
273
- </a>
274
- </div>
275
-
276
- <div class="method-description">
277
- <p>
278
- Remove all template data from the <a
279
- href="PageTemplate.html">PageTemplate</a>, but leave the <a
280
- href="Namespace.html">Namespace</a> intact.
281
- </p>
282
- </div>
283
- </div>
284
-
285
- <div id="method-M000014" class="method-detail">
286
- <a name="M000014"></a>
287
-
288
- <div class="method-heading">
289
- <a href="PageTemplate.src/M000014.html" target="Code" class="method-signature"
290
- onclick="popupCode('PageTemplate.src/M000014.html');return false;">
291
- <span class="method-name">getParameter</span><span class="method-args">(name)</span>
292
- </a>
293
- </div>
294
-
295
- <div class="method-description">
296
- <p>
297
- Get the value associated with <tt>name</tt> from the namespace. Returns nil
298
- if the value is not set.
299
- </p>
300
- </div>
301
- </div>
302
-
303
- <div id="method-M000012" class="method-detail">
304
- <a name="M000012"></a>
305
-
306
- <div class="method-heading">
307
- <a href="PageTemplate.src/M000012.html" target="Code" class="method-signature"
308
- onclick="popupCode('PageTemplate.src/M000012.html');return false;">
309
- <span class="method-name">load</span><span class="method-args">(file)</span>
310
- </a>
311
- </div>
312
-
313
- <div class="method-description">
314
- <p>
315
- Open <tt>file</tt> and parse its contents so they will be ready for
316
- template generation.
317
- </p>
318
- </div>
319
- </div>
320
-
321
- <div id="method-M000017" class="method-detail">
322
- <a name="M000017"></a>
323
-
324
- <div class="method-heading">
325
- <a href="PageTemplate.src/M000017.html" target="Code" class="method-signature"
326
- onclick="popupCode('PageTemplate.src/M000017.html');return false;">
327
- <span class="method-name">output</span><span class="method-args">()</span>
328
- </a>
329
- </div>
330
-
331
- <div class="method-description">
332
- <p>
333
- Returns the text result of stepping through the compiled template. Returns
334
- nil if there is no compiled content (usually indicates that a file has not
335
- been loaded yet).
336
- </p>
337
- <p>
338
- *NOTE:* This checks the <a
339
- href="PageTemplate.html">PageTemplate</a>&#8217;s namespace each time it is
340
- called, so you can generate different custom pages without reloading the
341
- template page.
342
- </p>
343
- </div>
344
- </div>
345
-
346
- <div id="method-M000013" class="method-detail">
347
- <a name="M000013"></a>
348
-
349
- <div class="method-heading">
350
- <a href="PageTemplate.src/M000013.html" target="Code" class="method-signature"
351
- onclick="popupCode('PageTemplate.src/M000013.html');return false;">
352
- <span class="method-name">setParameter</span><span class="method-args">(name, value)</span>
353
- </a>
354
- </div>
355
-
356
- <div class="method-description">
357
- <p>
358
- Set the namespace&#8217;s <tt>name</tt> to <tt>value</tt>.
359
- </p>
360
- <p>
361
- If you need to reset a flag or loop variable to a false value, the easiest
362
- way is to do just that: <tt>template.setParameter(&quot;myflag&quot;,
363
- false)</tt>
364
- </p>
365
- </div>
366
- </div>
367
-
368
-
369
- </div>
370
-
371
-
372
- </div>
373
-
374
-
375
- <div id="validator-badges">
376
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
377
- </div>
378
-
379
- </body>
380
- </html>
@@ -1,49 +0,0 @@
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>new (PageTemplate)</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 837</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span> = {})
15
-
16
- <span class="ruby-ivar">@source</span> = []
17
- <span class="ruby-ivar">@params</span> = <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">new</span>()
18
-
19
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'syntax'</span>]
20
- <span class="ruby-ivar">@syntax</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'syntax'</span>]
21
- <span class="ruby-keyword kw">else</span>
22
- <span class="ruby-ivar">@syntax</span> = <span class="ruby-constant">Syntax</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT</span>
23
- <span class="ruby-keyword kw">end</span>
24
-
25
- <span class="ruby-ivar">@path</span> = [ <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">getwd</span>() ]
26
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pathInfo</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'include_path'</span>]
27
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pathInfo</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>
28
- <span class="ruby-ivar">@path</span> = <span class="ruby-ivar">@path</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">pathInfo</span>
29
- <span class="ruby-keyword kw">else</span>
30
- <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">pathInfo</span>)
31
- <span class="ruby-keyword kw">end</span>
32
- <span class="ruby-keyword kw">end</span>
33
-
34
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'use_cache'</span>]
35
- <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">Syntax</span><span class="ruby-operator">::</span><span class="ruby-constant">CachedParser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@syntax</span>, <span class="ruby-ivar">@path</span>)
36
- <span class="ruby-keyword kw">else</span>
37
- <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">Syntax</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@syntax</span>, <span class="ruby-ivar">@path</span>)
38
- <span class="ruby-keyword kw">end</span>
39
-
40
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'filename'</span>]
41
- <span class="ruby-ivar">@file</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'filename'</span>]
42
- <span class="ruby-identifier">load</span>(<span class="ruby-ivar">@file</span>)
43
- <span class="ruby-keyword kw">else</span>
44
- <span class="ruby-ivar">@file</span> = <span class="ruby-keyword kw">nil</span>
45
- <span class="ruby-keyword kw">end</span>
46
-
47
- <span class="ruby-keyword kw">end</span></pre>
48
- </body>
49
- </html>
@@ -1,18 +0,0 @@
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>add_path (PageTemplate)</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 873</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_path</span>(<span class="ruby-identifier">path</span>)
15
- <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">path</span>)
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,29 +0,0 @@
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>load (PageTemplate)</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 879</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>)
15
- <span class="ruby-identifier">clearFile</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">file</span>) <span class="ruby-keyword kw">then</span>
17
- <span class="ruby-ivar">@file</span> = <span class="ruby-identifier">file</span>
18
- <span class="ruby-keyword kw">else</span>
19
- <span class="ruby-identifier">filepath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@path</span>, <span class="ruby-identifier">file</span>)
20
- <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">filepath</span>) <span class="ruby-keyword kw">then</span>
21
- <span class="ruby-ivar">@file</span> = <span class="ruby-identifier">filepath</span>
22
- <span class="ruby-keyword kw">else</span>
23
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Cannot find #{file} in include path&quot;</span>
24
- <span class="ruby-keyword kw">end</span>
25
- <span class="ruby-keyword kw">end</span>
26
- <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">build</span>(<span class="ruby-ivar">@file</span>)
27
- <span class="ruby-keyword kw">end</span></pre>
28
- </body>
29
- </html>
@@ -1,18 +0,0 @@
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>setParameter (PageTemplate)</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 898</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setParameter</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
15
- <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,18 +0,0 @@
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>getParameter (PageTemplate)</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 904</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getParameter</span>(<span class="ruby-identifier">name</span>)
15
- <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">name</span>)
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,18 +0,0 @@
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>[]= (PageTemplate)</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 909</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
15
- <span class="ruby-identifier">setParameter</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>