Changeset 549

Show
Ignore:
Timestamp:
2007-05-21 11:29:50 (2 years ago)
Author:
gaspard
Message:

[change] removed 'title.html' template and fixed parser to include 'part'

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/db/init/base/skins/default/Node.html

    r541 r549  
    1515  </r:with> 
    1616  <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'/> 
    1818     
    1919    <r:summary text=''/> 
  • trunk/db/init/base/skins/default/Project.html

    r548 r549  
    1313     
    1414    <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'/> 
    1616      <r:summary text=''/> 
    1717      <r:text/> 
    1818      <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'/> 
    2020      </r:else> 
    2121    </r:home> 
  • trunk/db/init/base/skins/default/layout.html

    r548 r549  
    5050    <div id='content' do='content_for_layout' name='content'> 
    5151      <div id='main' do='void' name='main'> 
    52         <div class='header' name='title'> 
     52        <div class='header' do='void' name='title'> 
    5353          <r:if kind_of='Document'><p class="document"><r:link format="data"><r:img mode='pv'/></r:link></p></r:if> 
    5454          <h1 do='title' class='s30' status='true' actions='all'>this is the title</h1> 
  • trunk/lib/parser/lib/parser.rb

    r548 r549  
    251251  def find_part(path) 
    252252    res    = self 
     253    found  = [] 
    253254    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 
    263260    end 
    264261    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 
    265274  end 
    266275   
  • trunk/lib/parser/test/zafu.yml

    r548 r549  
    9595 
    9696named_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 
     100include_part: 
     101  src: "IP: <r:include template='/named/parts' part='start/sub'/> PI." 
     102  res: "IP: hello world! PI." 
    99103 
    100104include_self: 
     
    102106  res: "IS: I like sub hello world! and sub hello world!" 
    103107 
    104 include_part: 
    105   src: "IP: <r:include template='/named/parts' part='start/sub'/> PI." 
    106   res: "IP: hello world! PI." 
     108include_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." 
    107111 
    108112include_context: