From d885a1f0c89a56714f0db7c0e4d8dbf9f30a5ea9 Mon Sep 17 00:00:00 2001 From: tetragon Date: Thu, 4 Oct 2007 18:22:07 +0000 Subject: Add support for named format tags (such as foo) git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1700 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Template/ODS.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'LedgerSMB/Template') diff --git a/LedgerSMB/Template/ODS.pm b/LedgerSMB/Template/ODS.pm index c2d8f75c..08df87a7 100644 --- a/LedgerSMB/Template/ODS.pm +++ b/LedgerSMB/Template/ODS.pm @@ -745,6 +745,12 @@ sub _format_handler { unshift @style_stack, $style_table{$mystyle}; } +sub _named_format { + my ($name, $t, $format) = @_; + $format->{att}{$name} = 1; + &_format_handler($t, $format); +} + sub _format_cleanup_handler { my ($t, $format) = @_; shift @style_stack; @@ -762,9 +768,19 @@ sub _ods_process { cell => \&_cell_handler, formula => \&_formula_handler, format => \&_format_handler, + bold => sub { &_named_format('bold', @_) }, + hidden => sub { &_named_format('hidden', @_) }, + italic => sub { &_named_format('italic', @_) }, + shadow => sub { &_named_format('shadow', @_) }, + strikeout => sub { &_named_format('strikeout', @_) }, }, twig_handlers => { format => \&_format_cleanup_handler, + bold => \&_format_cleanup_handler, + hidden => \&_format_cleanup_handler, + italic => \&_format_cleanup_handler, + shadow => \&_format_cleanup_handler, + strikeout => \&_format_cleanup_handler, } ); $parser->parse($template); -- cgit v1.2.3