diff options
author | dakkar <dakkar@luxion> | 2009-01-07 14:39:04 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2009-01-07 14:39:04 +0000 |
commit | a2c0093cd8a0e9633bba0a2e1a520a73c725a628 (patch) | |
tree | 42b3ff84031330afb0843e0395fbbe4e7416ee5d | |
parent | pulizia dei path, ma non va proprio bene (diff) | |
download | WebCoso-a2c0093cd8a0e9633bba0a2e1a520a73c725a628.tar.gz WebCoso-a2c0093cd8a0e9633bba0a2e1a520a73c725a628.tar.bz2 WebCoso-a2c0093cd8a0e9633bba0a2e1a520a73c725a628.zip |
i feed dei tag vanno!
git-svn-id: svn://luxion/repos/WebCoso/trunk@405 fcb26f47-9200-0410-b104-b98ab5b095f3
-rw-r--r-- | lib/WebCoso/XSLT.pm | 12 | ||||
-rw-r--r-- | t/test-site-output/feed.it.xml | 10 | ||||
-rw-r--r-- | t/test-site-output/tags/one/feed.it.xml | 6 | ||||
l--------- | t/test-site/src/tags/one/feed.it.tt | 1 | ||||
l--------- | t/test-site/src/tags/one/fillFeed.xsl | 1 |
5 files changed, 23 insertions, 7 deletions
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 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE a:feed PUBLIC "" ""> -<a:feed xmlns:a="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" xml:base="http://www.thenautilus.net/"><a:author><a:name>Gianni Ceccarelli</a:name><a:email>dakkar@thenautilus.net</a:email></a:author><a:id>http://www.thenautilus.net/</a:id><a:link rel="alternate" type="text/html" href="http://www.thenautilus.net/"/><a:title type="text">thenautilus.net</a:title><a:updated>2008-03-01T09:36:00+0000</a:updated><a:entry><a:id/><a:updated>2008-02-29T21:09:09+0000</a:updated><a:link rel="alternate" type="text/html">/bar/baz/</a:link><a:title type="xhtml"><div xml:base="/bar/baz/">bar-baz italiano +<a:feed xmlns:a="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" xml:base="http://www.thenautilus.net/"><a:author><a:name>Gianni Ceccarelli</a:name><a:email>dakkar@thenautilus.net</a:email></a:author><a:id>http://www.thenautilus.net/</a:id><a:link rel="alternate" type="text/html" href="http://www.thenautilus.net/"/><a:title type="text">thenautilus.net</a:title><a:updated>2008-03-01T09:37:45+0000</a:updated><a:entry><a:id/><a:updated>2007-09-09T11:18:59+0000</a:updated><a:link rel="alternate" type="text/html">/bar/baz/</a:link><a:title type="xhtml"><div xml:base="/bar/baz/">bar-baz italiano </div></a:title><a:content type="xhtml"><div xml:base="/bar/baz/"><p>sticaz -</p></div></a:content></a:entry><a:entry><a:id/><a:updated>2008-02-29T21:09:09+0000</a:updated><a:link rel="alternate" type="text/html">/foo/</a:link><a:title type="xhtml"><div xml:base="/foo/">Pagina <em>foo</em></div></a:title><a:content type="xhtml"><div xml:base="/foo/"><p>foo -</p></div></a:content></a:entry><a:entry><a:id/><a:updated>2008-03-01T09:06:41+0000</a:updated><a:link rel="alternate" type="text/html">/bar/</a:link><a:title type="xhtml"><div xml:base="/bar/">bar (generato) +</p></div></a:content><a:category term="one" label="Categoria 'uno'"/><a:category term="three/bis" label="Categoria 'three/bis'"/></a:entry><a:entry><a:id/><a:updated>2007-09-09T12:01:07+0000</a:updated><a:link rel="alternate" type="text/html">/bar/</a:link><a:title type="xhtml"><div xml:base="/bar/">bar (generato) </div></a:title><a:content type="xhtml"><div xml:base="/bar/"><ul><li>line 1 </li><li>line 2 </li><li>line 3 </li></ul><p>link: <a href="baz/">bar-baz italiano -</a></p></div></a:content></a:entry><a:entry><a:id/><a:updated>2008-03-01T09:36:00+0000</a:updated><a:link rel="alternate" type="text/html">/</a:link><a:title type="xhtml"><div xml:base="/">Pagina principale -</div></a:title><a:content type="xhtml"><div xml:base="/"><ul><li><a href="foo/">Pagina <em>foo</em></a></li><li><a href="bar/">bar!</a></li><li><a href="bar/baz/">baz</a></li></ul></div></a:content></a:entry></a:feed> +</a></p></div></a:content><a:category term="two" label="Categoria 'two'"/></a:entry><a:entry><a:id/><a:updated>2007-09-09T12:01:07+0000</a:updated><a:link rel="alternate" type="text/html">/</a:link><a:title type="xhtml"><div xml:base="/">Pagina principale +</div></a:title><a:content type="xhtml"><div xml:base="/"><ul><li><a href="foo/">Pagina <em>foo</em></a></li><li><a href="bar/">bar!</a></li><li><a href="bar/baz/">baz</a></li></ul></div></a:content></a:entry><a:entry><a:id/><a:updated>2008-01-02T13:55:03+0000</a:updated><a:link rel="alternate" type="text/html">/foo/</a:link><a:title type="xhtml"><div xml:base="/foo/">Pagina <em>foo</em></div></a:title><a:content type="xhtml"><div xml:base="/foo/"><p>foo +</p></div></a:content><a:category term="one" label="Categoria 'uno'"/><a:category term="two" label="Categoria 'two'"/></a:entry></a:feed> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE a:feed PUBLIC "" ""> +<a:feed xmlns:a="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" xml:base="http://www.thenautilus.net/"><a:author><a:name>Gianni Ceccarelli</a:name><a:email>dakkar@thenautilus.net</a:email></a:author><a:id>http://www.thenautilus.net/</a:id><a:link rel="alternate" type="text/html" href="http://www.thenautilus.net/tags/one/"/><a:title type="text">thenautilus.net</a:title><a:updated>2008-03-01T09:37:45+0000</a:updated><a:entry><a:id/><a:updated>2007-09-09T11:18:59+0000</a:updated><a:link rel="alternate" type="text/html">/bar/baz/</a:link><a:title type="xhtml"><div xml:base="/bar/baz/">bar-baz italiano +</div></a:title><a:content type="xhtml"><div xml:base="/bar/baz/"><p>sticaz +</p></div></a:content><a:category term="one" label="Categoria 'uno'"/><a:category term="three/bis" label="Categoria 'three/bis'"/></a:entry><a:entry><a:id/><a:updated>2008-01-02T13:55:03+0000</a:updated><a:link rel="alternate" type="text/html">/foo/</a:link><a:title type="xhtml"><div xml:base="/foo/">Pagina <em>foo</em></div></a:title><a:content type="xhtml"><div xml:base="/foo/"><p>foo +</p></div></a:content><a:category term="one" label="Categoria 'uno'"/><a:category term="two" label="Categoria 'two'"/></a:entry></a:feed> 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 |