From a2c0093cd8a0e9633bba0a2e1a520a73c725a628 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 7 Jan 2009 14:39:04 +0000 Subject: i feed dei tag vanno! git-svn-id: svn://luxion/repos/WebCoso/trunk@405 fcb26f47-9200-0410-b104-b98ab5b095f3 --- lib/WebCoso/XSLT.pm | 12 ++++++++++-- t/test-site-output/feed.it.xml | 10 +++++----- t/test-site-output/tags/one/feed.it.xml | 6 ++++++ t/test-site/src/tags/one/feed.it.tt | 1 + t/test-site/src/tags/one/fillFeed.xsl | 1 + 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 t/test-site-output/tags/one/feed.it.xml create mode 120000 t/test-site/src/tags/one/feed.it.tt create mode 120000 t/test-site/src/tags/one/fillFeed.xsl diff --git a/lib/WebCoso/XSLT.pm b/lib/WebCoso/XSLT.pm index 09c5b3f..9cbeab0 100644 --- a/lib/WebCoso/XSLT.pm +++ b/lib/WebCoso/XSLT.pm @@ -7,6 +7,7 @@ use XML::LibXML; use XML::LibXSLT; use DateTime::Format::Strptime; use Log::Log4perl ':easy'; +use Data::Dumper; my $NS='http://webcoso.thenautilus.net/'; @@ -99,10 +100,17 @@ sub fillFeed { sub setXMLTagsSource { my ($self,$source)=@_; - $self->{tags_source}=$source; + # the weird copy seems to be needed, otherwise sometimes it looks empty + $self->{tags_source}=(defined $source) ? {%$source} : undef; + delete $self->{tags_document}; } sub getTagsXML { my ($self)=@_; + if (defined $self->{tags_document}) { + DEBUG('returing cached TagsXML'); + return $self->{tags_document} + } + DEBUG('building TagsXML'); my $doc=XML::LibXML::Document->new(); return $doc unless defined $self->{tags_source}; @@ -127,7 +135,7 @@ sub getTagsXML { } } } - return $doc; + return $self->{tags_document}=$doc; } { diff --git a/t/test-site-output/feed.it.xml b/t/test-site-output/feed.it.xml index df11489..099020e 100644 --- a/t/test-site-output/feed.it.xml +++ b/t/test-site-output/feed.it.xml @@ -1,12 +1,12 @@ -Gianni Ceccarellidakkar@thenautilus.nethttp://www.thenautilus.net/thenautilus.net2008-03-01T09:36:00+00002008-02-29T21:09:09+0000/bar/baz/
bar-baz italiano +Gianni Ceccarellidakkar@thenautilus.nethttp://www.thenautilus.net/thenautilus.net2008-03-01T09:37:45+00002007-09-09T11:18:59+0000/bar/baz/
bar-baz italiano

sticaz -

2008-02-29T21:09:09+0000/foo/
Pagina foo

foo -

2008-03-01T09:06:41+0000/bar/
bar (generato) +

2007-09-09T12:01:07+0000/bar/
bar (generato)
  • line 1
  • line 2
  • line 3

link: bar-baz italiano -

2008-03-01T09:36:00+0000/
Pagina principale -
+

2007-09-09T12:01:07+0000/
Pagina principale +
2008-01-02T13:55:03+0000/foo/
Pagina foo

foo +

diff --git a/t/test-site-output/tags/one/feed.it.xml b/t/test-site-output/tags/one/feed.it.xml new file mode 100644 index 0000000..42c77d0 --- /dev/null +++ b/t/test-site-output/tags/one/feed.it.xml @@ -0,0 +1,6 @@ + + +Gianni Ceccarellidakkar@thenautilus.nethttp://www.thenautilus.net/thenautilus.net2008-03-01T09:37:45+00002007-09-09T11:18:59+0000/bar/baz/
bar-baz italiano +

sticaz +

2008-01-02T13:55:03+0000/foo/
Pagina foo

foo +

diff --git a/t/test-site/src/tags/one/feed.it.tt b/t/test-site/src/tags/one/feed.it.tt new file mode 120000 index 0000000..7af7c9e --- /dev/null +++ b/t/test-site/src/tags/one/feed.it.tt @@ -0,0 +1 @@ +../../common/base-feed.tt \ No newline at end of file diff --git a/t/test-site/src/tags/one/fillFeed.xsl b/t/test-site/src/tags/one/fillFeed.xsl new file mode 120000 index 0000000..0ec1e81 --- /dev/null +++ b/t/test-site/src/tags/one/fillFeed.xsl @@ -0,0 +1 @@ +../../common/fillFeed.xsl \ No newline at end of file -- cgit v1.2.3