PageTemplate 2.1.7 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes +15 -0
- data/doc/classes/PageTemplate.html +203 -0
- data/doc/classes/PageTemplate.src/M000001.html +18 -0
- data/doc/classes/PageTemplate/BlockCommand.html +230 -0
- data/doc/classes/PageTemplate/BlockCommand.src/M000020.html +18 -0
- data/doc/classes/PageTemplate/BlockCommand.src/M000021.html +18 -0
- data/doc/classes/PageTemplate/BlockCommand.src/M000022.html +18 -0
- data/doc/classes/PageTemplate/BlockCommand.src/M000023.html +21 -0
- data/doc/classes/PageTemplate/BlockCommand.src/M000024.html +18 -0
- data/doc/classes/PageTemplate/CaseCommand.html +252 -0
- data/doc/classes/PageTemplate/CaseCommand.src/M000085.html +22 -0
- data/doc/classes/PageTemplate/CaseCommand.src/M000086.html +22 -0
- data/doc/classes/PageTemplate/CaseCommand.src/M000087.html +19 -0
- data/doc/classes/PageTemplate/CaseCommand.src/M000088.html +19 -0
- data/doc/classes/PageTemplate/CaseCommand.src/M000089.html +23 -0
- data/doc/classes/PageTemplate/CaseCommand.src/M000090.html +23 -0
- data/doc/classes/PageTemplate/Command.html +199 -0
- data/doc/classes/PageTemplate/Command.src/M000045.html +19 -0
- data/doc/classes/PageTemplate/Command.src/M000046.html +18 -0
- data/doc/classes/PageTemplate/CommentCommand.html +187 -0
- data/doc/classes/PageTemplate/CommentCommand.src/M000028.html +18 -0
- data/doc/classes/PageTemplate/CommentCommand.src/M000029.html +18 -0
- data/doc/classes/PageTemplate/CommentCommand.src/M000030.html +18 -0
- data/doc/classes/PageTemplate/DefaultGlossary.html +121 -0
- data/doc/classes/PageTemplate/DefaultPreprocessor.html +232 -0
- data/doc/classes/PageTemplate/DefaultPreprocessor.src/M000074.html +18 -0
- data/doc/classes/PageTemplate/DefaultPreprocessor.src/M000075.html +18 -0
- data/doc/classes/PageTemplate/DefaultPreprocessor.src/M000076.html +20 -0
- data/doc/classes/PageTemplate/DefaultPreprocessor.src/M000077.html +22 -0
- data/doc/classes/PageTemplate/DefaultPreprocessor.src/M000078.html +18 -0
- data/doc/classes/PageTemplate/DefineCommand.html +166 -0
- data/doc/classes/PageTemplate/DefineCommand.src/M000079.html +19 -0
- data/doc/classes/PageTemplate/DefineCommand.src/M000080.html +19 -0
- data/doc/classes/PageTemplate/FileSource.html +222 -0
- data/doc/classes/PageTemplate/FileSource.src/M000016.html +28 -0
- data/doc/classes/PageTemplate/FileSource.src/M000017.html +32 -0
- data/doc/classes/PageTemplate/FileSource.src/M000018.html +20 -0
- data/doc/classes/PageTemplate/FileSource.src/M000019.html +30 -0
- data/doc/classes/PageTemplate/FilterCommand.html +181 -0
- data/doc/classes/PageTemplate/FilterCommand.src/M000065.html +20 -0
- data/doc/classes/PageTemplate/FilterCommand.src/M000066.html +18 -0
- data/doc/classes/PageTemplate/FilterCommand.src/M000067.html +29 -0
- data/doc/classes/PageTemplate/HTGlossary.html +113 -0
- data/doc/classes/PageTemplate/IfCommand.html +261 -0
- data/doc/classes/PageTemplate/IfCommand.src/M000059.html +24 -0
- data/doc/classes/PageTemplate/IfCommand.src/M000060.html +22 -0
- data/doc/classes/PageTemplate/IfCommand.src/M000061.html +19 -0
- data/doc/classes/PageTemplate/IfCommand.src/M000062.html +20 -0
- data/doc/classes/PageTemplate/IfCommand.src/M000063.html +22 -0
- data/doc/classes/PageTemplate/IfCommand.src/M000064.html +36 -0
- data/doc/classes/PageTemplate/IncludeCommand.html +203 -0
- data/doc/classes/PageTemplate/IncludeCommand.src/M000039.html +18 -0
- data/doc/classes/PageTemplate/IncludeCommand.src/M000040.html +18 -0
- data/doc/classes/PageTemplate/IncludeCommand.src/M000041.html +35 -0
- data/doc/classes/PageTemplate/LoopCommand.html +260 -0
- data/doc/classes/PageTemplate/LoopCommand.src/M000011.html +24 -0
- data/doc/classes/PageTemplate/LoopCommand.src/M000012.html +20 -0
- data/doc/classes/PageTemplate/LoopCommand.src/M000013.html +22 -0
- data/doc/classes/PageTemplate/LoopCommand.src/M000014.html +77 -0
- data/doc/classes/PageTemplate/LoopCommand.src/M000015.html +21 -0
- data/doc/classes/PageTemplate/Namespace.html +163 -0
- data/doc/classes/PageTemplate/Namespace.src/M000057.html +20 -0
- data/doc/classes/PageTemplate/Namespace.src/M000058.html +22 -0
- data/doc/classes/PageTemplate/NamespaceItem.html +333 -0
- data/doc/classes/PageTemplate/NamespaceItem.src/M000002.html +18 -0
- data/doc/classes/PageTemplate/NamespaceItem.src/M000004.html +19 -0
- data/doc/classes/PageTemplate/NamespaceItem.src/M000006.html +84 -0
- data/doc/classes/PageTemplate/NamespaceItem.src/M000008.html +18 -0
- data/doc/classes/PageTemplate/NamespaceItem.src/M000009.html +22 -0
- data/doc/classes/PageTemplate/NamespaceItem.src/M000010.html +31 -0
- data/doc/classes/PageTemplate/Parser.html +369 -0
- data/doc/classes/PageTemplate/Parser.src/M000031.html +18 -0
- data/doc/classes/PageTemplate/Parser.src/M000032.html +32 -0
- data/doc/classes/PageTemplate/Parser.src/M000033.html +18 -0
- data/doc/classes/PageTemplate/Parser.src/M000034.html +30 -0
- data/doc/classes/PageTemplate/Parser.src/M000035.html +66 -0
- data/doc/classes/PageTemplate/Parser.src/M000036.html +18 -0
- data/doc/classes/PageTemplate/Parser.src/M000037.html +18 -0
- data/doc/classes/PageTemplate/Parser.src/M000038.html +19 -0
- data/doc/classes/PageTemplate/Preprocessor.html +123 -0
- data/doc/classes/PageTemplate/Source.html +165 -0
- data/doc/classes/PageTemplate/Source.src/M000055.html +18 -0
- data/doc/classes/PageTemplate/Source.src/M000056.html +18 -0
- data/doc/classes/PageTemplate/StackableCommand.html +205 -0
- data/doc/classes/PageTemplate/StackableCommand.src/M000081.html +17 -0
- data/doc/classes/PageTemplate/StackableCommand.src/M000082.html +18 -0
- data/doc/classes/PageTemplate/StackableCommand.src/M000083.html +18 -0
- data/doc/classes/PageTemplate/StackableCommand.src/M000084.html +18 -0
- data/doc/classes/PageTemplate/StringSource.html +163 -0
- data/doc/classes/PageTemplate/StringSource.src/M000053.html +23 -0
- data/doc/classes/PageTemplate/StringSource.src/M000054.html +18 -0
- data/doc/classes/PageTemplate/SyntaxGlossary.html +263 -0
- data/doc/classes/PageTemplate/SyntaxGlossary.src/M000047.html +22 -0
- data/doc/classes/PageTemplate/SyntaxGlossary.src/M000048.html +24 -0
- data/doc/classes/PageTemplate/SyntaxGlossary.src/M000049.html +18 -0
- data/doc/classes/PageTemplate/SyntaxGlossary.src/M000050.html +21 -0
- data/doc/classes/PageTemplate/SyntaxGlossary.src/M000051.html +21 -0
- data/doc/classes/PageTemplate/SyntaxGlossary.src/M000052.html +22 -0
- data/doc/classes/PageTemplate/Template.html +208 -0
- data/doc/classes/PageTemplate/Template.src/M000071.html +19 -0
- data/doc/classes/PageTemplate/Template.src/M000072.html +18 -0
- data/doc/classes/PageTemplate/Template.src/M000073.html +29 -0
- data/doc/classes/PageTemplate/TextCommand.html +185 -0
- data/doc/classes/PageTemplate/TextCommand.src/M000068.html +18 -0
- data/doc/classes/PageTemplate/TextCommand.src/M000069.html +18 -0
- data/doc/classes/PageTemplate/TextCommand.src/M000070.html +18 -0
- data/doc/classes/PageTemplate/UnknownCommand.html +191 -0
- data/doc/classes/PageTemplate/UnknownCommand.src/M000025.html +24 -0
- data/doc/classes/PageTemplate/UnknownCommand.src/M000026.html +18 -0
- data/doc/classes/PageTemplate/UnknownCommand.src/M000027.html +18 -0
- data/doc/classes/PageTemplate/ValueCommand.html +206 -0
- data/doc/classes/PageTemplate/ValueCommand.src/M000042.html +19 -0
- data/doc/classes/PageTemplate/ValueCommand.src/M000043.html +27 -0
- data/doc/classes/PageTemplate/ValueCommand.src/M000044.html +21 -0
- data/doc/created.rid +1 -0
- data/doc/files/README_txt.html +225 -0
- data/doc/files/lib/PageTemplate/case_rb.html +115 -0
- data/doc/files/lib/PageTemplate/commands_rb.html +111 -0
- data/doc/files/lib/PageTemplate/htglossary_rb.html +110 -0
- data/doc/files/lib/PageTemplate/parser_rb.html +111 -0
- data/doc/files/lib/PageTemplate_rb.html +139 -0
- data/doc/fr_class_index.html +52 -0
- data/doc/fr_file_index.html +32 -0
- data/doc/fr_method_index.html +116 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/PageTemplate.rb +1 -1
- data/lib/PageTemplate/commands.rb +49 -5
- data/lib/PageTemplate/parser.rb +57 -10
- data/tdata/include.txt +3 -0
- data/tdata/include2.txt +3 -0
- data/tdata/variable.txt +1 -0
- data/test.rb +83 -6
- metadata +159 -2
@@ -0,0 +1,18 @@
|
|
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>clear (PageTemplate::NamespaceItem)</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/parser.rb, line 26</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
|
15
|
+
<span class="ruby-ivar">@values</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
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>set (PageTemplate::NamespaceItem)</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/parser.rb, line 33</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-ivar">@values</span> <span class="ruby-operator">||=</span> {}
|
16
|
+
<span class="ruby-ivar">@values</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,84 @@
|
|
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 (PageTemplate::NamespaceItem)</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/parser.rb, line 54</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">val</span>,<span class="ruby-identifier">clean_rescue</span>=<span class="ruby-keyword kw">true</span>)
|
15
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">args</span>
|
16
|
+
<span class="ruby-ivar">@values</span> <span class="ruby-operator">||=</span> {}
|
17
|
+
<span class="ruby-ivar">@object</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">nil</span>
|
18
|
+
|
19
|
+
<span class="ruby-identifier">clean_rescue</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">args</span>[<span class="ruby-value str">'raise_on_error'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">clean_rescue</span>
|
20
|
+
|
21
|
+
<span class="ruby-identifier">val</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/[#{Regexp.escape(parser.method_separators)}]/</span>,<span class="ruby-value str">'.'</span>)
|
22
|
+
|
23
|
+
<span class="ruby-identifier">key</span>, <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">val</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\./</span>, <span class="ruby-value">2</span>)
|
24
|
+
|
25
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">case</span>
|
26
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">key</span>)
|
27
|
+
<span class="ruby-ivar">@values</span>[<span class="ruby-identifier">key</span>]
|
28
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@object</span>
|
29
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">val</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@parent</span>
|
30
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
31
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:has_key?</span>)
|
32
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">key</span>)
|
33
|
+
<span class="ruby-ivar">@values</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-ivar">@object</span>[<span class="ruby-identifier">key</span>]
|
34
|
+
<span class="ruby-keyword kw">else</span>
|
35
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">val</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@parent</span>
|
36
|
+
<span class="ruby-keyword kw">nil</span>
|
37
|
+
<span class="ruby-keyword kw">end</span>
|
38
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">sym</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_sym</span>)
|
39
|
+
<span class="ruby-ivar">@values</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">sym</span>)
|
40
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'__ITEM__'</span>
|
41
|
+
<span class="ruby-ivar">@object</span>
|
42
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-ivar">@parent</span>
|
43
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">val</span>)
|
44
|
+
<span class="ruby-keyword kw">else</span>
|
45
|
+
<span class="ruby-keyword kw">nil</span>
|
46
|
+
<span class="ruby-keyword kw">end</span>
|
47
|
+
|
48
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rest</span>
|
49
|
+
<span class="ruby-identifier">names</span> = [<span class="ruby-identifier">key</span>]
|
50
|
+
<span class="ruby-identifier">rest</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\./</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
51
|
+
<span class="ruby-identifier">names</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">i</span>
|
52
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">names</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'.'</span>)
|
53
|
+
<span class="ruby-keyword kw">begin</span>
|
54
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>)
|
55
|
+
<span class="ruby-ivar">@values</span>[<span class="ruby-identifier">name</span>]
|
56
|
+
<span class="ruby-keyword kw">else</span>
|
57
|
+
<span class="ruby-ivar">@values</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">case</span>
|
58
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>)
|
59
|
+
<span class="ruby-ivar">@values</span>[<span class="ruby-identifier">name</span>]
|
60
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:has_key?</span>) <span class="ruby-comment cmt"># Hash</span>
|
61
|
+
<span class="ruby-identifier">value</span>[<span class="ruby-identifier">i</span>]
|
62
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:[]</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\d+$/</span> <span class="ruby-comment cmt"># Array</span>
|
63
|
+
<span class="ruby-identifier">value</span>[<span class="ruby-identifier">i</span>.<span class="ruby-identifier">to_i</span>]
|
64
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">i</span>) <span class="ruby-comment cmt"># Just a method</span>
|
65
|
+
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">i</span>)
|
66
|
+
<span class="ruby-keyword kw">else</span>
|
67
|
+
<span class="ruby-keyword kw">nil</span>
|
68
|
+
<span class="ruby-keyword kw">end</span>
|
69
|
+
<span class="ruby-keyword kw">end</span>
|
70
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NoMethodError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">er</span>
|
71
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
72
|
+
<span class="ruby-keyword kw">end</span>
|
73
|
+
<span class="ruby-keyword kw">end</span>
|
74
|
+
<span class="ruby-keyword kw">end</span>
|
75
|
+
<span class="ruby-identifier">value</span>
|
76
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
77
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">clean_rescue</span>
|
78
|
+
<span class="ruby-node">"[ Error: #{e.message} ]"</span>
|
79
|
+
<span class="ruby-keyword kw">else</span>
|
80
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
81
|
+
<span class="ruby-keyword kw">end</span>
|
82
|
+
<span class="ruby-keyword kw">end</span></pre>
|
83
|
+
</body>
|
84
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>delete (PageTemplate::NamespaceItem)</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/parser.rb, line 126</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
15
|
+
<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
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>parser (PageTemplate::NamespaceItem)</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/parser.rb, line 132</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parser</span>
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@parent</span>
|
16
|
+
<span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">parser</span>
|
17
|
+
<span class="ruby-keyword kw">else</span>
|
18
|
+
<span class="ruby-constant">Parser</span>.<span class="ruby-identifier">recent_parser</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
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? (PageTemplate::NamespaceItem)</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/parser.rb, line 143</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">args</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">args</span>
|
16
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">flag</span>,<span class="ruby-keyword kw">false</span>)
|
17
|
+
<span class="ruby-keyword kw">case</span>
|
18
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">val</span>
|
19
|
+
<span class="ruby-keyword kw">false</span>
|
20
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'empty_is_true'</span>]
|
21
|
+
<span class="ruby-keyword kw">true</span>
|
22
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:empty?</span>)
|
23
|
+
<span class="ruby-operator">!</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">empty?</span>
|
24
|
+
<span class="ruby-keyword kw">else</span>
|
25
|
+
<span class="ruby-keyword kw">true</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">er</span>
|
28
|
+
<span class="ruby-keyword kw">false</span>
|
29
|
+
<span class="ruby-keyword kw">end</span></pre>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,369 @@
|
|
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::Parser</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::Parser</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/PageTemplate/parser_rb.html">
|
59
|
+
lib/PageTemplate/parser.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
|
+
The big ass parser that does all the dirty work of turning templates into
|
84
|
+
compiled commands.
|
85
|
+
</p>
|
86
|
+
<p>
|
87
|
+
<a href="Parser.html#M000032">Parser.new</a>() accepts a hash as an
|
88
|
+
argument, and looks for these keys: (with defaults)
|
89
|
+
</p>
|
90
|
+
<pre>
|
91
|
+
'namespace' => A namespace object. (A new namespace)
|
92
|
+
'glossary' => A SyntaxGlossary class singleton. (DefaultGlossary)
|
93
|
+
'preprocessor' => The preprocessor. (DefaultPreprocessor)
|
94
|
+
'default_processor' => The processor. (:process)
|
95
|
+
'source' => The Source for templates. (FileSource)
|
96
|
+
</pre>
|
97
|
+
<p>
|
98
|
+
Once the parser is created, it can compile and parse any number of
|
99
|
+
templates.
|
100
|
+
</p>
|
101
|
+
<p>
|
102
|
+
It can be treated as a one-template item by using <a
|
103
|
+
href="Parser.html#M000033">Parser#load</a>(template), and calling <a
|
104
|
+
href="Parser.html#M000038">Parser.output</a>
|
105
|
+
</p>
|
106
|
+
<p>
|
107
|
+
To create separate generated templates from the same engine, use <a
|
108
|
+
href="Parser.html#M000035">Parser#parse</a>, or <a
|
109
|
+
href="Parser.html#M000033">Parser#load</a>. (It will still keep the most
|
110
|
+
recent one it’s <a href="Parser.html#M000033">load</a>‘d, but
|
111
|
+
that will not affect previously parsed or loaded)
|
112
|
+
</p>
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div id="method-list">
|
120
|
+
<h3 class="section-bar">Methods</h3>
|
121
|
+
|
122
|
+
<div class="name-list">
|
123
|
+
<a href="#M000037">clearCommands</a>
|
124
|
+
<a href="#M000034">compile</a>
|
125
|
+
<a href="#M000033">load</a>
|
126
|
+
<a href="#M000032">new</a>
|
127
|
+
<a href="#M000038">output</a>
|
128
|
+
<a href="#M000035">parse</a>
|
129
|
+
<a href="#M000036">parser</a>
|
130
|
+
<a href="#M000031">recent_parser</a>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
</div>
|
135
|
+
|
136
|
+
|
137
|
+
<!-- if includes -->
|
138
|
+
<div id="includes">
|
139
|
+
<h3 class="section-bar">Included Modules</h3>
|
140
|
+
|
141
|
+
<div id="includes-list">
|
142
|
+
<span class="include-name"><a href="NamespaceItem.html">NamespaceItem</a></span>
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div id="section">
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<div id="attribute-list">
|
153
|
+
<h3 class="section-bar">Attributes</h3>
|
154
|
+
|
155
|
+
<div class="name-list">
|
156
|
+
<table>
|
157
|
+
<tr class="top-aligned-row context-row">
|
158
|
+
<td class="context-item-name">args</td>
|
159
|
+
<td class="context-item-value"> [R] </td>
|
160
|
+
<td class="context-item-desc"></td>
|
161
|
+
</tr>
|
162
|
+
<tr class="top-aligned-row context-row">
|
163
|
+
<td class="context-item-name">commands</td>
|
164
|
+
<td class="context-item-value"> [R] </td>
|
165
|
+
<td class="context-item-desc"></td>
|
166
|
+
</tr>
|
167
|
+
<tr class="top-aligned-row context-row">
|
168
|
+
<td class="context-item-name">default_processor</td>
|
169
|
+
<td class="context-item-value"> [R] </td>
|
170
|
+
<td class="context-item-desc"></td>
|
171
|
+
</tr>
|
172
|
+
<tr class="top-aligned-row context-row">
|
173
|
+
<td class="context-item-name">glossary</td>
|
174
|
+
<td class="context-item-value"> [R] </td>
|
175
|
+
<td class="context-item-desc"></td>
|
176
|
+
</tr>
|
177
|
+
<tr class="top-aligned-row context-row">
|
178
|
+
<td class="context-item-name">method_separators</td>
|
179
|
+
<td class="context-item-value"> [R] </td>
|
180
|
+
<td class="context-item-desc"></td>
|
181
|
+
</tr>
|
182
|
+
<tr class="top-aligned-row context-row">
|
183
|
+
<td class="context-item-name">namespace</td>
|
184
|
+
<td class="context-item-value"> [R] </td>
|
185
|
+
<td class="context-item-desc"></td>
|
186
|
+
</tr>
|
187
|
+
<tr class="top-aligned-row context-row">
|
188
|
+
<td class="context-item-name">preprocessor</td>
|
189
|
+
<td class="context-item-value"> [R] </td>
|
190
|
+
<td class="context-item-desc"></td>
|
191
|
+
</tr>
|
192
|
+
<tr class="top-aligned-row context-row">
|
193
|
+
<td class="context-item-name">source</td>
|
194
|
+
<td class="context-item-value"> [R] </td>
|
195
|
+
<td class="context-item-desc"></td>
|
196
|
+
</tr>
|
197
|
+
</table>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<!-- if method_list -->
|
204
|
+
<div id="methods">
|
205
|
+
<h3 class="section-bar">Public Class methods</h3>
|
206
|
+
|
207
|
+
<div id="method-M000032" class="method-detail">
|
208
|
+
<a name="M000032"></a>
|
209
|
+
|
210
|
+
<div class="method-heading">
|
211
|
+
<a href="Parser.src/M000032.html" target="Code" class="method-signature"
|
212
|
+
onclick="popupCode('Parser.src/M000032.html');return false;">
|
213
|
+
<span class="method-name">new</span><span class="method-args">(args = {})</span>
|
214
|
+
</a>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class="method-description">
|
218
|
+
<p>
|
219
|
+
<a href="Parser.html#M000032">Parser.new</a>() accepts a hash as an
|
220
|
+
argument, and looks for these keys: (with defaults)
|
221
|
+
</p>
|
222
|
+
<pre>
|
223
|
+
'namespace' => A namespace object. (A new namespace)
|
224
|
+
'glossary' => A SyntaxGlossary object. (a dup of DEFAULTGLOSSARY)
|
225
|
+
'preprocessor' => The preprocessor. (DefaultPreprocessor)
|
226
|
+
'default_processor' => The processor. (:process)
|
227
|
+
'source' => The Source for templates. (FileSource)
|
228
|
+
</pre>
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
<div id="method-M000031" class="method-detail">
|
233
|
+
<a name="M000031"></a>
|
234
|
+
|
235
|
+
<div class="method-heading">
|
236
|
+
<a href="Parser.src/M000031.html" target="Code" class="method-signature"
|
237
|
+
onclick="popupCode('Parser.src/M000031.html');return false;">
|
238
|
+
<span class="method-name">recent_parser</span><span class="method-args">()</span>
|
239
|
+
</a>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div class="method-description">
|
243
|
+
<p>
|
244
|
+
This is corny, but <a href="Parser.html#M000031">recent_parser</a> returns
|
245
|
+
the most recently created <a href="Parser.html">Parser</a>.
|
246
|
+
</p>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
251
|
+
|
252
|
+
<div id="method-M000037" class="method-detail">
|
253
|
+
<a name="M000037"></a>
|
254
|
+
|
255
|
+
<div class="method-heading">
|
256
|
+
<a href="Parser.src/M000037.html" target="Code" class="method-signature"
|
257
|
+
onclick="popupCode('Parser.src/M000037.html');return false;">
|
258
|
+
<span class="method-name">clearCommands</span><span class="method-args">()</span>
|
259
|
+
</a>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
<div class="method-description">
|
263
|
+
<p>
|
264
|
+
Not really of any point, but clears the saved commands.
|
265
|
+
</p>
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div id="method-M000034" class="method-detail">
|
270
|
+
<a name="M000034"></a>
|
271
|
+
|
272
|
+
<div class="method-heading">
|
273
|
+
<a href="Parser.src/M000034.html" target="Code" class="method-signature"
|
274
|
+
onclick="popupCode('Parser.src/M000034.html');return false;">
|
275
|
+
<span class="method-name">compile</span><span class="method-args">(name)</span>
|
276
|
+
</a>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<div class="method-description">
|
280
|
+
<p>
|
281
|
+
Load <tt>name</tt> from a template, but do not save it.
|
282
|
+
</p>
|
283
|
+
</div>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
<div id="method-M000033" class="method-detail">
|
287
|
+
<a name="M000033"></a>
|
288
|
+
|
289
|
+
<div class="method-heading">
|
290
|
+
<a href="Parser.src/M000033.html" target="Code" class="method-signature"
|
291
|
+
onclick="popupCode('Parser.src/M000033.html');return false;">
|
292
|
+
<span class="method-name">load</span><span class="method-args">(name)</span>
|
293
|
+
</a>
|
294
|
+
</div>
|
295
|
+
|
296
|
+
<div class="method-description">
|
297
|
+
<p>
|
298
|
+
Load <tt>name</tt> from a template, and save it to allow this parser to use
|
299
|
+
it for output.
|
300
|
+
</p>
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
|
304
|
+
<div id="method-M000038" class="method-detail">
|
305
|
+
<a name="M000038"></a>
|
306
|
+
|
307
|
+
<div class="method-heading">
|
308
|
+
<a href="Parser.src/M000038.html" target="Code" class="method-signature"
|
309
|
+
onclick="popupCode('Parser.src/M000038.html');return false;">
|
310
|
+
<span class="method-name">output</span><span class="method-args">(*args)</span>
|
311
|
+
</a>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
<div class="method-description">
|
315
|
+
<p>
|
316
|
+
If any commands are loaded and saved, return a string of it.
|
317
|
+
</p>
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
<div id="method-M000035" class="method-detail">
|
322
|
+
<a name="M000035"></a>
|
323
|
+
|
324
|
+
<div class="method-heading">
|
325
|
+
<a href="Parser.src/M000035.html" target="Code" class="method-signature"
|
326
|
+
onclick="popupCode('Parser.src/M000035.html');return false;">
|
327
|
+
<span class="method-name">parse</span><span class="method-args">(body)</span>
|
328
|
+
</a>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
<div class="method-description">
|
332
|
+
<p>
|
333
|
+
Compile a <a href="Template.html">Template</a> (<a
|
334
|
+
href="BlockCommand.html">BlockCommand</a>) from a string. Does not save the
|
335
|
+
commands.
|
336
|
+
</p>
|
337
|
+
</div>
|
338
|
+
</div>
|
339
|
+
|
340
|
+
<div id="method-M000036" class="method-detail">
|
341
|
+
<a name="M000036"></a>
|
342
|
+
|
343
|
+
<div class="method-heading">
|
344
|
+
<a href="Parser.src/M000036.html" target="Code" class="method-signature"
|
345
|
+
onclick="popupCode('Parser.src/M000036.html');return false;">
|
346
|
+
<span class="method-name">parser</span><span class="method-args">()</span>
|
347
|
+
</a>
|
348
|
+
</div>
|
349
|
+
|
350
|
+
<div class="method-description">
|
351
|
+
<p>
|
352
|
+
But redefine parser
|
353
|
+
</p>
|
354
|
+
</div>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
|
358
|
+
</div>
|
359
|
+
|
360
|
+
|
361
|
+
</div>
|
362
|
+
|
363
|
+
|
364
|
+
<div id="validator-badges">
|
365
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
</body>
|
369
|
+
</html>
|