Changeset 9209

Show
Ignore:
Timestamp:
09/08/08 11:00:01 (2 months ago)
Author:
hannes
Message:

Merge branch 'earl-skins'

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • helma-ng/trunk/apps/demo/skins/continuation.html

    r9153 r9209  
    5858 
    5959<% subskin 'step3' ---------------------------------------------------------------------- %> 
    60 You said: <h3><% message prefix="&raquo;" suffix="&laquo;" %></h3> 
     60You said: <h3><% message | wrap "&laquo;" "&raquo;" %></h3> 
    6161 
    6262<p><a href="http://dev.helma.org/ng/helma.continuation">Learn more about continuations</a> in Helma NG</p> 
  • helma-ng/trunk/apps/storage/skins/index.html

    r9153 r9209  
    33<% subskin 'content' %> 
    44<h1><% title %></h1> 
    5 <% message prefix="<p>" suffix="</p>" %> 
     5<% message | prefix "<p>" | suffix "</p>" %> 
    66 
    77<h3>Add a new book</h3> 
  • helma-ng/trunk/modules/helma/filters.js

    r8969 r9209  
    207207   } 
    208208} 
     209 
     210(function() { 
     211    var isVisible = function(str) { 
     212        return str !== undefined && str != null && str != ''; 
     213    } 
     214 
     215    /** 
     216     * Returns a default string if the given string was empty, undefined 
     217     * or null. 
     218     */ 
     219    this.default_filter = function(input, filter) { 
     220        return isVisible(input) ? 
     221                input : 
     222                filter.getParameter(0); 
     223    } 
     224 
     225    /** 
     226     * Prepends a prefix if the given string is not empty, undefined or null. 
     227     */ 
     228    this.prefix_filter = function(input, filter) { 
     229        return isVisible(input) ? 
     230                (filter.getParameter(0) || '') + input : 
     231                input; 
     232    } 
     233 
     234    /** 
     235     * Appends a suffix if the given string is not empty, undefined or null. 
     236     */ 
     237    this.suffix_filter = function(input, filter) { 
     238        return isVisible(input) ? 
     239                input + (filter.getParameter(0) || '') : 
     240                input; 
     241    } 
     242 
     243    /** 
     244     * Wraps a non-empty string with a prefix and suffix string. 
     245     */ 
     246    this.wrap_filter = function(input, filter) { 
     247        return isVisible(input) ? 
     248                (filter.getParameter(0) || '') 
     249                        + input 
     250                        + (filter.getParameter(1) || '') : 
     251                input; 
     252    } 
     253})(); 
  • helma-ng/trunk/modules/helma/skin.js

    r9181 r9209  
    153153            filter = filter.filter; 
    154154        } 
    155         if (visibleValue || wroteSomething) { 
    156             res.buffer.insert(length, macro.getParameter('prefix') || ''); 
    157             if (visibleValue) { 
    158                 res.write(value); 
    159             } 
    160             res.write(macro.getParameter('suffix') || ''); 
    161         } else { 
    162             res.write(macro.getParameter('default') || ''); 
     155        if (visibleValue) { 
     156            res.write(value); 
    163157        } 
    164158    };