Changeset 1171

Show
Ignore:
Timestamp:
2008-09-19 20:21:28 (4 months ago)
Author:
gaspard
Message:

commit 6bcbe997497b51bc2a045f75ef0bcba6ba653297
Author: Gaspard Bucher <gaspard@teti.ch>

Better [with] tag that keeps the initial method unless 'method' attribute is used.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/parser/lib/parser.rb

    r1085 r1171  
    124124  # Hook called when replacing part of an included template with '<r:with part='main'>...</r:with>' 
    125125  def replace_with(obj) 
    126     @method   = 'void' # (replacer's method is always 'with') 
     126    # keep @method (obj's method is always 'with') 
    127127    @blocks   = obj.blocks.empty? ? @blocks : obj.blocks 
    128128    @params   = obj.params.empty? ? @params : obj.params 
  • trunk/lib/parser/lib/rules/zafu.rb

    r1124 r1171  
    295295          if $1 != @end_tag 
    296296            # error bad closing rtag 
    297             store "<span class='parser_error'>#{$&.gsub('<', '&lt;').gsub('>','&gt;')}</span>" 
     297            store "<span class='parser_error'>#{$&.gsub('<', '&lt;').gsub('>','&gt;')} should be &lt;/#{@end_tag}&gt;</span>" 
    298298          end 
    299299          leave 
  • trunk/lib/parser/test/parser/zafu.yml

    r1155 r1171  
    5353very_messy: 
    5454  src: "this <r: blah> </r:truc> whak" 
    55   res: "this <r: blah> <span class='parser_error'>&lt;/r:truc&gt;</span> whak" 
     55  res: "this <r: blah> <span class='parser_error'>&lt;/r:truc&gt; should be &lt;/r:void&gt;</span> whak" 
    5656 
    5757bad_closing_tag: 
    5858  src: "this <r:test>looks </r:truc> ok" 
    59   res: "this [test]looks <span class='parser_error'>&lt;/r:truc&gt;</span>[/test] ok" 
     59  res: "this [test]looks <span class='parser_error'>&lt;/r:truc&gt; should be &lt;/r:test&gt;</span>[/test] ok" 
    6060 
    6161do_tag: 
     
    142142  res: "named_with_do: [test {> :name=>'branding'}]<p id='branding'>...</p>[/test]" 
    143143 
     144include_named_keep_method: 
     145  src: "IKM: <r:include template='/named/with/do'><r:with part='branding'>blah</r:with></r:include>" 
     146  res: "IKM: named_with_do: [test {= :part=>'branding'} {> :name=>'branding'}]<p id='branding'>blah</p>[/test]" 
     147 
    144148include_set_method: 
    145   src: "IKD: <r:include template='/named/with/do'><r:with part='branding' method='hello'>blah</r:with></r:include>" 
    146   res: "IKD: named_with_do: <p id='branding'>hello world!</p>" 
     149  src: "ISM: <r:include template='/named/with/do'><r:with part='branding' method='hello'>blah</r:with></r:include>" 
     150  res: "ISM: named_with_do: <p id='branding'>hello world!</p>" 
    147151 
    148152include_part: 
  • trunk/test/helpers/zena_parser/ajax.yml

    r1154 r1171  
    199199  src: "<r:pages><li do='each'><span do='swap' attr='d_status' states='todo,done,alert'/></li></r:pages>" 
    200200  tem: "/<li id='list1_<%= var1.zip %>'><span>.*var1.can_write?.*tag_to_remote.*else.*var1.version.dyn\[\"status\"\]/" 
     201 
     202update_target: 
     203  src: "UT: <div id='foo' do='block'>...</div> <r:link update='foo'/>" 
     204  tem: "/UT: <div id='foo'>...</div><%= tag_to_remote.*dom_id=foo.*</a>/" 
     205   
     206include_update_target: 
     207  src: "IUT: <r:include template='/update/target'><r:with part='foo'><r:show attr='name'/></r:with></r:include>" 
     208  tem: "/IUT: UT: <div id='foo'><%= @node.name %></div><%= tag_to_remote.*dom_id=foo.*</a>" 
     209 
  • trunk/test/helpers/zena_parser/basic.yml

    r1168 r1171  
    777777 
    778778include_with: 
    779   src: "include_with: <r:include template='/name/title'><h1 do='with' part='title' do='show' attr='id'/>" 
     779  src: "include_with: <r:include template='/name/title'><h1 do='with' part='title' attr='id'/>" 
    780780  res: "include_with: title: <h1 id='lala'>22</h1>" 
    781781