Changeset 1616

Show
Ignore:
Timestamp:
08/24/05 06:51:12
Author:
miyagawa
Message:

0.04 release

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Template-Plugin-Comma/trunk/Changes

    r796 r1616  
    11Revision history for Perl extension Template::Plugin::Comma 
     2 
     30.04  Tue Aug 23 21:35:03 UTC 2005 
     4        * Fixed bug that '3.1415' gets translated to '3.1,415' 
     5          (Thanks to petek at bsod.net) 
    26 
    370.03  Thu Nov 14 13:47:51 JST 2002 
  • Template-Plugin-Comma/trunk/lib/Template/Plugin/Comma.pm

    r797 r1616  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = 0.03
     5$VERSION = 0.04
    66 
    77require Template::Plugin; 
     
    2020sub commify { 
    2121    local $_  = shift; 
    22     1 while s/([-+]?\d+)(\d{3})/$1,$2/
     22    1 while s/((?:\A|[^.0-9])[-+]?\d+)(\d{3})/$1,$2/s
    2323    return $_; 
    2424} 
  • Template-Plugin-Comma/trunk/t/01_comma.t

    r690 r1616  
    2626--expect-- 
    2727This item costs 1,000 yen. 
     28 
     29--test-- 
     30[% USE Comma -%] 
     31This item costs [% 123 | comma %] yen. 
     32--expect-- 
     33This item costs 123 yen. 
     34 
     35--test-- 
     36[% USE Comma -%] 
     37This item costs $[% 123.45 | comma %] USD. 
     38--expect-- 
     39This item costs $123.45 USD. 
     40 
     41--test-- 
     42[% USE Comma -%] 
     43This item costs $[% 123.4567 | comma %] USD. 
     44--expect-- 
     45This item costs $123.4567 USD. 
     46 
     47--test-- 
     48[% USE Comma -%] 
     49This item costs $[% 1234.56 | comma %] USD. 
     50--expect-- 
     51This item costs $1,234.56 USD. 
     52 
     53--test-- 
     54[% USE Comma -%] 
     55This item costs $[% 1234.5678 | comma %] USD. 
     56--expect-- 
     57This item costs $1,234.5678 USD. 
     58 
     59--test-- 
     60[% USE Comma %][% 123.45 | comma %] 
     61--expect-- 
     62123.45 
     63 
     64--test-- 
     65[% USE Comma %][% 1234.5678 | comma %] 
     66--expect-- 
     671,234.5678 
     68 
     69--test-- 
     70[% USE Comma %][% 1234567.8901 | comma %] 
     71--expect-- 
     721,234,567.8901 
     73 
     74--test-- 
     75[% USE Comma -%] 
     76[% FILTER comma -%] 
     77.31 
     78.3141592 
     790.3141592 
     803.141592 
     81314.1592 
     8231415.92653 
     833141592653.58 
     84314159265358 
     85[%- END %] 
     86--expect-- 
     87.31 
     88.3141592 
     890.3141592 
     903.141592 
     91314.1592 
     9231,415.92653 
     933,141,592,653.58 
     94314,159,265,358