Changeset 549
- Timestamp:
- 2007-05-21 11:29:50 (2 years ago)
- Files:
-
- trunk/db/init/base/skins/default/Node.html (modified) (1 diff)
- trunk/db/init/base/skins/default/Project.html (modified) (1 diff)
- trunk/db/init/base/skins/default/layout.html (modified) (1 diff)
- trunk/db/init/base/skins/default/title.html (deleted)
- trunk/lib/parser/lib/parser.rb (modified) (1 diff)
- trunk/lib/parser/test/zafu.yml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/db/init/base/skins/default/Node.html
r541 r549 15 15 </r:with> 16 16 <r:with part='body/container/content/main'> 17 <r:include template=' title.html'/>17 <r:include template='layout.html' part='body/container/content/main/title'/> 18 18 19 19 <r:summary text=''/> trunk/db/init/base/skins/default/Project.html
r548 r549 13 13 14 14 <r:home> 15 <r:include template='layout.html' part='body/container/ main/title'/>15 <r:include template='layout.html' part='body/container/content/main/title'/> 16 16 <r:summary text=''/> 17 17 <r:text/> 18 18 <r:else> 19 <r:include template='layout.html' part='body/container/ main/title'/>19 <r:include template='layout.html' part='body/container/content/main/title'/> 20 20 </r:else> 21 21 </r:home> trunk/db/init/base/skins/default/layout.html
r548 r549 50 50 <div id='content' do='content_for_layout' name='content'> 51 51 <div id='main' do='void' name='main'> 52 <div class='header' name='title'>52 <div class='header' do='void' name='title'> 53 53 <r:if kind_of='Document'><p class="document"><r:link format="data"><r:img mode='pv'/></r:link></p></r:if> 54 54 <h1 do='title' class='s30' status='true' actions='all'>this is the title</h1> trunk/lib/parser/lib/parser.rb
r548 r549 251 251 def find_part(path) 252 252 res = self 253 found = [] 253 254 path.split('/').reject {|e| e==''}.each do |name| 254 res.blocks.each do |b| 255 next if b.kind_of?(String) 256 if b.params[:name] == name 257 res = b 258 name = nil 259 break 260 end 261 end 262 return nil if name # block not found 255 if res = find_name(res.blocks, name) 256 found << name 257 else 258 return "<span class='parser_error'>'#{(found + [name]).join('/')}' not found in template '#{@params[:template]}'</span>" 259 end 263 260 end 264 261 res 262 end 263 264 def find_name(blocks, name) 265 blocks.each do |b| 266 next if b.kind_of?(String) 267 return b if b.params[:name] == name 268 next if b.params[:name] # bad name 269 if res = find_name(b.blocks,name) 270 return res 271 end 272 end 273 return nil 265 274 end 266 275 trunk/lib/parser/test/zafu.yml
r548 r549 95 95 96 96 named_parts: 97 src: "named_parts: <r:test name='start'>start from here to <r:hello name='sub'>sub</r:hello></r:test> ok." 98 res: "named_parts: [test {= :name=>'start'} {> :name=>'start'}]start from here to [hello {= :name=>'sub'}]sub[/hello][/test] ok." 97 src: "named_parts: <r:void><r:void name='lala'>lala</r:void> <r:test name='start'>start from here to <r:hello name='sub'>sub</r:hello></r:test></r:void> ok." 98 res: "named_parts: lala [test {= :name=>'start'} {> :name=>'start'}]start from here to [hello {= :name=>'sub'}]sub[/hello][/test] ok." 99 100 include_part: 101 src: "IP: <r:include template='/named/parts' part='start/sub'/> PI." 102 res: "IP: hello world! PI." 99 103 100 104 include_self: … … 102 106 res: "IS: I like sub hello world! and sub hello world!" 103 107 104 include_ part:105 src: "IP: <r:include template='/named/parts' part='st art/sub'/> PI."106 res: "IP: hello world!PI."108 include_bad_part: 109 src: "IP: <r:include template='/named/parts' part='strat/bus'/> PI." 110 res: "IP: <span class='parser_error'>'strat' not found in template '/named/parts'</span> PI." 107 111 108 112 include_context:
