From: Rob Kinyon <rob.kinyon@gmail.com>
Date: Fri, 2 Jun 2006 19:20:34 +0000 (+0000)
Subject:  r13918@rob-kinyons-powerbook58:  rob | 2006-06-02 10:04:04 -0400
X-Git-Tag: v0.27~9
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d5382a2d7082f732dac7c3cee3a188ab7eb51859;p=p5sagit%2FExcel-Template.git

 r13918@rob-kinyons-powerbook58:  rob | 2006-06-02 10:04:04 -0400
 Fixed a couple bugs and started the process of adding <image>
---

diff --git a/Build.PL b/Build.PL
new file mode 100644
index 0000000..2837695
--- /dev/null
+++ b/Build.PL
@@ -0,0 +1,50 @@
+use Module::Build;
+
+use strict;
+
+my $requires = {
+    'perl'              => '5.6.0',
+    'Test::More'        => 0.01,
+    'XML::Parser'       => 0.01,
+    'IO::Scalar'        => 0.01,
+    'File::Basename'    => 0.01,
+    'Spreadsheet::WriteExcel' => 0.42,
+    'Spreadsheet::WriteExcel::Utility' => 0.01,
+};
+
+if ($] < 5.008) {
+    eval { require Unicode::String; };
+    if ($@) {
+       print "Note: If you want to work with Unicode, you will need to install";
+       print "the optional module Unicode::String and set USE_UNICODE to true.";
+       my $resp = Module::Build->prompt( "Do you want to install it now?", "y");
+       if ( $resp =~ /y/i ) {
+           $requires->{'Unicode::String'} => '0.01';
+       }
+    } else {
+        print "You have Unicode::String installed. If you warn to use Unicode,";
+        print "You will need to set USE_UNICODE to true."
+    }
+}
+
+my $build = Module::Build->new(
+    module_name => 'Excel::Template',
+    license => 'perl',
+    requires => $requires,
+    optional => {
+    },
+    build_requires => {
+        'File::Path'      => '0.01',
+        'File::Temp'      => '0.01',
+        'Test::Deep'      => '0.095',
+        'Test::More'      => '0.47',
+        'Test::Exception' => '0.21',
+    },
+    create_makefile_pl => 'traditional',
+    add_to_cleanup => [
+        'META.yml', '*.bak', '*.gz', 'Makefile.PL', 'cover_db',
+    ],
+#    test_files => 't/??_*.t',
+);
+
+$build->create_build_script;
diff --git a/Changes b/Changes
index 24e2d51..63f260c 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl distribution Excel::Template
 
+0.26 Thu Jun 01 17:00:00 2005
+    - Fixed how widths are whitelisted to allow '.' for fractions
+
 0.25 Thu May 26 11:00:00 2005
     - Changed how the template file is opened to use 3-arg open() if available
 
diff --git a/MANIFEST b/MANIFEST
index 5a3bd7b..80cd782 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,5 +1,5 @@
+Build.PL
 MANIFEST
-MANIFEST.SKIP
 LICENSE
 README
 Todo
@@ -31,6 +31,7 @@ lib/Excel/Template/Container/Worksheet.pm
 lib/Excel/Template/Element/Backref.pm
 lib/Excel/Template/Element/Cell.pm
 lib/Excel/Template/Element/Formula.pm
+lib/Excel/Template/Element/Image.pm
 lib/Excel/Template/Element/Range.pm
 lib/Excel/Template/Element/Var.pm
 t/001_load.t
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
index af11f38..b008153 100644
--- a/MANIFEST.SKIP
+++ b/MANIFEST.SKIP
@@ -1,26 +1,19 @@
-\bRCS\b
-\bCVS\b
-,v$
-\B\.svn\b
-
-# Makemaker generated files and dirs.
-^MANIFEST\.
+^_build
+^Build$
+^blib
+~$
+\.bak$
+^MANIFEST\.SKIP$
+CVS
+\.svn
+cover_db
+\..*\.sw.?$
 ^Makefile$
 ^pm_to_blib$
-^blib/?
 ^MakeMaker-\d
 ^blibdirs$
-
-# Temp, old and emacs backup files.
-~$
 \.old$
 ^#.*#$
 ^\.#
-.swp$
-
-# Devel::Cover
-^cover_db/?
-^tags?
-
-# developer-only tests
-^t/dev_.*\.t$
+^\.DS_Store
+^__MACOSX
diff --git a/META.yml b/META.yml
deleted file mode 100644
index 44e0930..0000000
--- a/META.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Excel-Template
-version:      0.25
-version_from: lib/Excel/Template.pm
-installdirs:  site
-requires:
-    File::Basename:                0.01
-    IO::Scalar:                    0.01
-    Spreadsheet::WriteExcel:       0.42
-    Spreadsheet::WriteExcel::Utility: 0.01
-    Test::More:                    0.01
-    XML::Parser:                   0.01
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.21
diff --git a/Makefile.PL b/Makefile.PL
deleted file mode 100644
index 559544e..0000000
--- a/Makefile.PL
+++ /dev/null
@@ -1,44 +0,0 @@
-use strict;
-
-use ExtUtils::MakeMaker;
-{
-    no strict 'refs';
-
-    my $libscan = \&{"ExtUtils::MM_Any::libscan"};
-    *{"ExtUtils::MM_Any::libscan"} = sub {
-        return '' unless $libscan->(@_);
-        return '' if $_[1] =~ /\.swp$/;
-        return $_[1];
-    };
-}
-
-my $prereqs = {
-    'Test::More'              => 0.01,
-    'XML::Parser'             => 0.01,
-    'IO::Scalar'              => 0.01,
-    'File::Basename'          => 0.01,
-    'Spreadsheet::WriteExcel' => 0.42,
-    'Spreadsheet::WriteExcel::Utility' => 0.01,
-};
-
-# The assumption is Perl 5.8.0 and greater doesn't need Unicode::String.
-
-if ($] < 5.008)
-{
-    eval { require Unicode::String; };
-    if ($@)
-    {
-        print "Note: If you want to work with Unicode, you will need to install";
-        print "the optional module Unicode::String and set USE_UNICODE to true.";
-    }
-}
-
-WriteMakefile(
-    NAME         => 'Excel::Template',
-    VERSION_FROM => 'lib/Excel/Template.pm', # finds $VERSION
-    ABSTRACT     => 'Excel::Template',
-    PREREQ_PM    => $prereqs,
-    ($] >= 5.005 ?
-       (ABSTRACT_FROM => 'lib/Excel/Template.pm',
-        AUTHOR       => 'Rob Kinyon (rob.kinyon@gmail.com)') : ()),
-);
diff --git a/Todo b/Todo
index 7f0c03a..22d972f 100644
--- a/Todo
+++ b/Todo
@@ -16,7 +16,6 @@ Missing S::WE features:
     write_url_range
     write_date_time
     write_comment
-    insert_bitmap
     activate/select/set_first_sheet
     set_selection
     outline_settings
diff --git a/lib/Excel/Template.pm b/lib/Excel/Template.pm
index 2b3c45d..571eac2 100644
--- a/lib/Excel/Template.pm
+++ b/lib/Excel/Template.pm
@@ -6,7 +6,7 @@ BEGIN {
     use Excel::Template::Base;
     use vars qw ($VERSION @ISA);
 
-    $VERSION  = '0.25';
+    $VERSION  = '0.26';
     @ISA      = qw( Excel::Template::Base );
 }
 
diff --git a/lib/Excel/Template/Element/Cell.pm b/lib/Excel/Template/Element/Cell.pm
index 3e5bb3c..9444fc3 100755
--- a/lib/Excel/Template/Element/Cell.pm
+++ b/lib/Excel/Template/Element/Cell.pm
@@ -84,7 +84,7 @@ sub render
     # Apply the cell width to the current column
     if (my $width = $context->get($self, 'WIDTH'))
     {
-        $width =~ s/\D//g;
+        $width =~ s/[^\d.]//g;
         $width *= 1;
         if ($width > 0)
         {
diff --git a/lib/Excel/Template/Element/Image.pm b/lib/Excel/Template/Element/Image.pm
new file mode 100644
index 0000000..5d9c97b
--- /dev/null
+++ b/lib/Excel/Template/Element/Image.pm
@@ -0,0 +1,47 @@
+package Excel::Template::Element::Image;
+
+use strict;
+
+BEGIN {
+    use vars qw(@ISA);
+    @ISA = qw(Excel::Template::Element);
+
+    use Excel::Template::Element;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Excel::Template::Element::Image - Excel::Template::Element::Image
+
+=head1 PURPOSE
+
+To insert an image into the worksheet
+
+=head1 NODE NAME
+
+CELL
+
+=head1 INHERITANCE
+
+L<ELEMENT|Excel::Template::Element>
+
+=head1 DEPENDENCIES
+
+None
+
+=head1 USAGE
+
+  <image path="/Some/Full/Path"/>
+
+=head1 AUTHOR
+
+Rob Kinyon (rob.kinyon@gmail.com)
+
+=head1 SEE ALSO
+
+Nothing
+
+=cut
diff --git a/lib/Excel/Template/Format.pm b/lib/Excel/Template/Format.pm
index fe18f21..778c49d 100644
--- a/lib/Excel/Template/Format.pm
+++ b/lib/Excel/Template/Format.pm
@@ -53,7 +53,7 @@ sub _retrieve_key { $_[0]{ $_[1] } }
         $params{lc $_} = delete $params{$_} for keys %params;
 
         my @parts = (
-            (map { !!$params{$_} } @_boolean_formats),
+            (map { $params{$_} ? 1 : '' } @_boolean_formats),
             (map { $params{$_} ? $params{$_} + 0 : '' } @_integer_formats),
             (map { $params{$_} || '' } @_string_formats),
         );
@@ -72,11 +72,11 @@ sub _retrieve_key { $_[0]{ $_[1] } }
         my @string_parts  = splice @key_parts, 0, scalar( @_string_formats );
 
         my %params;
-        $params{ $_boolean_formats[$_] } = !!1
+        $params{ $_boolean_formats[$_] } = ~~1
             for grep { $boolean_parts[$_] } 0 .. $#_boolean_formats;
 
         $params{ $_integer_formats[$_] } = $integer_parts[$_]
-            for grep { defined $integer_parts[$_] } 0 .. $#_integer_formats;
+            for grep { defined $integer_parts[$_] && length $integer_parts[$_] } 0 .. $#_integer_formats;
 
         $params{ $_string_formats[$_] } = $string_parts[$_]
             for grep { $string_parts[$_] } 0 .. $#_string_formats;
diff --git a/t/014.xml b/t/014.xml
index 82eeb54..3af4178 100644
--- a/t/014.xml
+++ b/t/014.xml
@@ -2,6 +2,7 @@
   <worksheet name="heightwidth">
     <row height="30">
       <cell width="10" text="1" />
+      <cell width="0.5" text="1" />
     </row>
   </worksheet>
 </workbook>
diff --git a/t/014_heightwidth.t b/t/014_heightwidth.t
index 413dea2..b919183 100644
--- a/t/014_heightwidth.t
+++ b/t/014_heightwidth.t
@@ -25,5 +25,7 @@ Spreadsheet::WriteExcel::Worksheet::new( '' )
 Spreadsheet::WriteExcel::Worksheet::set_row( '0', '30' )
 Spreadsheet::WriteExcel::Worksheet::set_column( '0', '0', '10' )
 Spreadsheet::WriteExcel::Worksheet::write( '0', '0', '1', '1' )
+Spreadsheet::WriteExcel::Worksheet::set_column( '1', '1', '0.5' )
+Spreadsheet::WriteExcel::Worksheet::write( '0', '1', '1', '1' )
 Spreadsheet::WriteExcel::close( '' )
 __END_EXPECTED__
diff --git a/tags b/tags
deleted file mode 100644
index 3b04887..0000000
--- a/tags
+++ /dev/null
@@ -1,112 +0,0 @@
-!_TAG_FILE_FORMAT	2	/extended format; --format=1 will not append ;" to lines/
-!_TAG_FILE_SORTED	1	/0=unsorted, 1=sorted, 2=foldcase/
-!_TAG_PROGRAM_AUTHOR	Darren Hiebert	/dhiebert@users.sourceforge.net/
-!_TAG_PROGRAM_NAME	Exuberant Ctags	//
-!_TAG_PROGRAM_URL	http://ctags.sourceforge.net	/official site/
-!_TAG_PROGRAM_VERSION	5.5.4	//
-PROPERTY	lib/Excel/Template/Format.pm	/^        PROPERTY:$/;"	l
-RENDER_BIG	lib/Excel/Template.pm	/^use constant RENDER_BIG => 'big';$/;"	c
-RENDER_NML	lib/Excel/Template.pm	/^use constant RENDER_NML => 'normal';$/;"	c
-RENDER_XML	lib/Excel/Template.pm	/^use constant RENDER_XML => 'xml';$/;"	c
-UNIVERSAL	lib/Excel/Template/Container.pm	/^            UNIVERSAL::isa($self->{ELEMENTS}, 'ARRAY');$/;"	l
-UNIVERSAL	lib/Excel/Template/TextObject.pm	/^            UNIVERSAL::isa($self->{STACK}, 'ARRAY');$/;"	l
-_assign	lib/Excel/Template/Format.pm	/^    sub _assign { $_Formats{$_[0]} = $_[1]; $_Formats{$_[1]} = $_[0] }$/;"	s
-_conditional_passes	lib/Excel/Template/Container/Conditional.pm	/^sub _conditional_passes$/;"	s
-_create	lib/Excel/Template/Factory.pm	/^sub _create$/;"	s
-_create_node	lib/Excel/Template/Factory.pm	/^sub _create_node$/;"	s
-_do_globals	lib/Excel/Template/Iterator.pm	/^sub _do_globals$/;"	s
-_do_page	lib/Excel/Template/Container.pm	/^sub _do_page$/;"	s
-_find_param_in_map	lib/Excel/Template/Context.pm	/^sub _find_param_in_map$/;"	s
-_get_text	lib/Excel/Template/Element/Cell.pm	/^sub _get_text$/;"	s
-_key_to_params	lib/Excel/Template/Format.pm	/^    sub _key_to_params$/;"	s
-_load_class	lib/Excel/Template/Factory.pm	/^sub _load_class$/;"	s
-_make_iterator	lib/Excel/Template/Container/Loop.pm	/^sub _make_iterator$/;"	s
-_params_to_key	lib/Excel/Template/Format.pm	/^    sub _params_to_key$/;"	s
-_prepare_output	lib/Excel/Template.pm	/^sub _prepare_output$/;"	s
-_retrieve_key	lib/Excel/Template/Format.pm	/^    sub _retrieve_key { $_Formats{ $_[0] } }$/;"	s
-active_format	lib/Excel/Template/Context.pm	/^sub active_format$/;"	s
-active_worksheet	lib/Excel/Template/Context.pm	/^sub active_worksheet$/;"	s
-add_format	t/Spreadsheet/WriteExcel.pm	/^sub add_format {$/;"	s
-add_reference	lib/Excel/Template/Context.pm	/^sub add_reference$/;"	s
-add_worksheet	t/Spreadsheet/WriteExcel.pm	/^sub add_worksheet {$/;"	s
-begin_page	lib/Excel/Template/Container.pm	/^sub begin_page { _do_page 'begin_page', @_ }$/;"	s
-blank_format	lib/Excel/Template/Format.pm	/^sub blank_format$/;"	s
-can_continue	lib/Excel/Template/Iterator.pm	/^sub can_continue$/;"	s
-close	t/Spreadsheet/WriteExcel.pm	/^sub close {$/;"	s
-copy	lib/Excel/Template/Format.pm	/^    sub copy$/;"	s
-deltas	lib/Excel/Template/Base.pm	/^sub deltas$/;"	s
-deltas	lib/Excel/Template/Container/Row.pm	/^sub deltas$/;"	s
-deltas	lib/Excel/Template/Element/Cell.pm	/^sub deltas$/;"	s
-end_page	lib/Excel/Template/Container.pm	/^sub end_page   { _do_page 'end_page', @_   }$/;"	s
-enter_scope	lib/Excel/Template/Base.pm	/^sub enter_scope { ($_[1])->enter_scope($_[0]) }$/;"	s
-enter_scope	lib/Excel/Template/Context.pm	/^sub enter_scope$/;"	s
-enter_scope	lib/Excel/Template/Iterator.pm	/^sub enter_scope$/;"	s
-exit_scope	lib/Excel/Template/Base.pm	/^sub exit_scope { ($_[1])->exit_scope(@_[0, 2]) }$/;"	s
-exit_scope	lib/Excel/Template/Context.pm	/^sub exit_scope$/;"	s
-exit_scope	lib/Excel/Template/Iterator.pm	/^sub exit_scope$/;"	s
-get	lib/Excel/Template/Context.pm	/^sub get$/;"	s
-get_all_references	lib/Excel/Template/Context.pm	/^sub get_all_references$/;"	s
-get_calls	t/mock.pm	/^sub get_calls { @calls }$/;"	s
-get_last_reference	lib/Excel/Template/Context.pm	/^sub get_last_reference$/;"	s
-is_embedded	lib/Excel/Template/Base.pm	/^sub is_embedded { Excel::Template::Factory::is_embedded(@_) }$/;"	s
-is_embedded	lib/Excel/Template/Factory.pm	/^sub is_embedded$/;"	s
-isa	lib/Excel/Template/Base.pm	/^sub isa { Excel::Template::Factory::isa(@_) }$/;"	s
-isa	lib/Excel/Template/Factory.pm	/^sub isa$/;"	s
-iterate_over_children	lib/Excel/Template/Container.pm	/^sub iterate_over_children$/;"	s
-max	lib/Excel/Template/Element/Range.pm	/^sub max { $_[0] > $_[1] ? $_[0] : $_[1] }$/;"	s
-min	lib/Excel/Template/Element/Range.pm	/^sub min { $_[0] < $_[1] ? $_[0] : $_[1] }$/;"	s
-more_params	lib/Excel/Template/Iterator.pm	/^sub more_params$/;"	s
-new	lib/Excel/Template.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Base.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container/Bold.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container/Hidden.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container/Italic.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container/Locked.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container/Loop.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container/Outline.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container/Shadow.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Container/Strikeout.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Context.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Element/Cell.pm	/^sub new$/;"	s
-new	lib/Excel/Template/Iterator.pm	/^sub new$/;"	s
-new	lib/Excel/Template/TextObject.pm	/^sub new$/;"	s
-new	t/Spreadsheet/WriteExcel.pm	/^sub new {$/;"	s
-new	t/Spreadsheet/WriteExcel/Big.pm	/^sub new {$/;"	s
-new	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub new {$/;"	s
-new	t/Spreadsheet/WriteExcelXML.pm	/^sub new {$/;"	s
-new_worksheet	lib/Excel/Template/Context.pm	/^sub new_worksheet$/;"	s
-next	lib/Excel/Template/Iterator.pm	/^sub next$/;"	s
-output	lib/Excel/Template.pm	/^sub output$/;"	s
-param	lib/Excel/Template.pm	/^sub param$/;"	s
-param	lib/Excel/Template/Context.pm	/^sub param$/;"	s
-parse_xml	lib/Excel/Template.pm	/^sub parse_xml$/;"	s
-register	lib/Excel/Template.pm	/^sub register { shift; Excel::Template::Factory->register(@_) }$/;"	s
-register	lib/Excel/Template/Factory.pm	/^    sub register$/;"	s
-render	lib/Excel/Template/Base.pm	/^sub render$/;"	s
-render	lib/Excel/Template/Container.pm	/^sub render { $_[0]->iterate_over_children($_[1]) }$/;"	s
-render	lib/Excel/Template/Container/Conditional.pm	/^sub render$/;"	s
-render	lib/Excel/Template/Container/Format.pm	/^sub render$/;"	s
-render	lib/Excel/Template/Container/Loop.pm	/^sub render$/;"	s
-render	lib/Excel/Template/Container/Row.pm	/^sub render$/;"	s
-render	lib/Excel/Template/Container/Worksheet.pm	/^sub render$/;"	s
-render	lib/Excel/Template/Element/Cell.pm	/^sub render$/;"	s
-render	lib/Excel/Template/Element/Formula.pm	/^sub render { $_[0]->SUPER::render( $_[1], 'write_formula' ) }$/;"	s
-render	t/Register_018.pm	/^sub render$/;"	s
-reset	t/mock.pm	/^sub reset { @calls = (); }$/;"	s
-resolve	lib/Excel/Template/Base.pm	/^sub resolve$/;"	s
-resolve	lib/Excel/Template/Context.pm	/^sub resolve$/;"	s
-resolve	lib/Excel/Template/Element/Backref.pm	/^sub resolve$/;"	s
-resolve	lib/Excel/Template/Element/Range.pm	/^sub resolve$/;"	s
-resolve	lib/Excel/Template/Element/Var.pm	/^sub resolve { ($_[1])->param($_[1]->resolve($_[0], 'NAME')) }$/;"	s
-resolve	lib/Excel/Template/TextObject.pm	/^sub resolve$/;"	s
-set_column	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub set_column {$/;"	s
-set_row	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub set_row {$/;"	s
-use_unicode	lib/Excel/Template/Context.pm	/^sub use_unicode { $_[0]->{UNICODE} && 1 }$/;"	s
-write	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub write {$/;"	s
-write_blank	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub write_blank {$/;"	s
-write_file	lib/Excel/Template.pm	/^sub write_file$/;"	s
-write_formula	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub write_formula {$/;"	s
-write_number	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub write_number {$/;"	s
-write_string	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub write_string {$/;"	s
-write_url	t/Spreadsheet/WriteExcel/Worksheet.pm	/^sub write_url {$/;"	s