From 1675ca4721614067f8ad493d6958e2ea1d8a51e0 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Tue, 19 Nov 2013 12:55:24 +0000 Subject: make output a bit more stable --- fixdates.sh | 12 ++++++++++++ lib/WebCoso/XSLT.pm | 19 ++++++++++--------- t/test-site-output/bar/baz/document.en.html | 18 +++++++++--------- t/test-site-output/bar/baz/document.it.html | 18 +++++++++--------- t/test-site-output/bar/document.en.html | 18 +++++++++--------- t/test-site-output/bar/document.it.html | 18 +++++++++--------- t/test-site-output/document.en.html | 18 +++++++++--------- t/test-site-output/document.it.html | 18 +++++++++--------- t/test-site-output/en-only/document.en.html | 18 +++++++++--------- t/test-site-output/feed.it.xml | 9 ++++++++- t/test-site-output/foo/document.en.html | 18 +++++++++--------- t/test-site-output/foo/document.it.html | 18 +++++++++--------- t/test-site-output/tags/one/document.en.html | 22 +++++++++++----------- t/test-site-output/tags/one/document.it.html | 22 +++++++++++----------- t/test-site-output/tags/one/feed.en.xml | 8 ++++---- t/test-site-output/tags/three/bis/document.en.html | 18 +++++++++--------- t/test-site-output/tags/three/bis/document.it.html | 18 +++++++++--------- t/test-site-output/tags/three/document.en.html | 18 +++++++++--------- t/test-site-output/tags/three/document.it.html | 18 +++++++++--------- t/test-site-output/tags/two/document.en.html | 22 +++++++++++----------- t/test-site-output/tags/two/document.it.html | 22 +++++++++++----------- 21 files changed, 195 insertions(+), 175 deletions(-) create mode 100755 fixdates.sh diff --git a/fixdates.sh b/fixdates.sh new file mode 100755 index 0000000..fc7f32a --- /dev/null +++ b/fixdates.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +thisdir="$(cd "$(dirname "$0")";pwd)" +cd "$thisdir" +git ls-files -z | \ +while read -d $'\0' filename; do + date="$(git log -n 1 --pretty='format:%ct' -- "$filename")" + if [[ -n "$date" ]]; then + echo "updating <$filename> to date <$date>" + touch -d @"$date" "$filename" + fi +done diff --git a/lib/WebCoso/XSLT.pm b/lib/WebCoso/XSLT.pm index e5ca549..36c22f3 100644 --- a/lib/WebCoso/XSLT.pm +++ b/lib/WebCoso/XSLT.pm @@ -125,15 +125,15 @@ sub getTagsXML { $doc->setDocumentElement($de); return $doc unless defined $self->{tags_source}; - my ($tagname,$doclist); - while (($tagname,$doclist)=each %{$self->{tags_source}}) { + for my $tagname (sort keys %{$self->{tags_source}}) { + my $doclist = $self->{tags_source}{$tagname}; my $te=$doc->createElementNS($NS,'wc:tag'); $te->setAttribute('name',$tagname); $de->appendChild($te); my %docs; push @{$docs{WebCoso::Common::dstUriFor($_)}},WebCoso::Common::langOf($_) for @$doclist; - my ($docurl,$langs); - while (($docurl,$langs)=each %docs) { + for my $docurl (sort keys %docs) { + my $langs = $docs{$docurl}; my $dle=$doc->createElementNS($NS,'wc:doc'); $dle->setAttribute('uri',$docurl||'ERRORE'); $te->appendChild($dle); @@ -170,15 +170,15 @@ sub getChangesXML { $doc->setDocumentElement($de); return $doc unless defined $self->{changes_source}; - my ($docpath,$dates); - while (($docpath,$dates)=each %{$self->{changes_source}}) { + for my $docpath (sort keys %{$self->{changes_source}}) { + my $dates = $self->{changes_source}{$docpath}; my $te=$doc->createElementNS($NS,'wc:document'); $te->setAttribute('path',$docpath); $te->setAttribute('uri',WebCoso::Common::dstUriFor($docpath)); $te->setAttribute('lang',WebCoso::Common::langOf($docpath)); $de->appendChild($te); - my ($type,$value); - while (($type,$value)=each %$dates) { + for my $type (sort keys %$dates) { + my $value = $dates->{$type}; my $dle=$doc->createElementNS($NS,$name_map{$type}); $dle->appendTextNode($format->format_datetime($value)); $te->appendChild($dle); @@ -194,7 +194,8 @@ sub getDatesXML { my $de=$doc->createElementNS($NS,'wc:dates'); $doc->setDocumentElement($de); - while (my ($k,$v)=each %$dates) { + for my $k (sort keys %$dates) { + my $v = $dates->{$k}; my $d=$doc->createElementNS($NS,$name_map{$k}); $d->appendTextNode($format->format_datetime($v)); $de->appendChild($d); diff --git a/t/test-site-output/bar/baz/document.en.html b/t/test-site-output/bar/baz/document.en.html index ae0aa6f..c9f5424 100644 --- a/t/test-site-output/bar/baz/document.en.html +++ b/t/test-site-output/bar/baz/document.en.html @@ -6,24 +6,24 @@

Category 'one'
Category 'three/bis'
Category 'two' -
Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:12
+ Ultima modifica: 2007-09-09 11:18:59 diff --git a/t/test-site-output/bar/baz/document.it.html b/t/test-site-output/bar/baz/document.it.html index 23d8ddc..cc1f764 100644 --- a/t/test-site-output/bar/baz/document.it.html +++ b/t/test-site-output/bar/baz/document.it.html @@ -6,22 +6,22 @@

Categoria 'uno'
Categoria 'three/bis'
Categoria 'two' -
Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:12
+ Ultima modifica: 2007-09-09 11:18:59 diff --git a/t/test-site-output/bar/document.en.html b/t/test-site-output/bar/document.en.html index 011ec36..077eaed 100644 --- a/t/test-site-output/bar/document.en.html +++ b/t/test-site-output/bar/document.en.html @@ -9,24 +9,24 @@

Category 'one'
Category 'three/bis'
Category 'two' -
Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:12
+ Ultima modifica: 2007-09-09 12:01:07 diff --git a/t/test-site-output/bar/document.it.html b/t/test-site-output/bar/document.it.html index 4d90b58..dc09594 100644 --- a/t/test-site-output/bar/document.it.html +++ b/t/test-site-output/bar/document.it.html @@ -9,22 +9,22 @@

Categoria 'uno'
Categoria 'three/bis'
Categoria 'two' -
Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:12
+ Ultima modifica: 2007-09-09 12:01:07 diff --git a/t/test-site-output/document.en.html b/t/test-site-output/document.en.html index f7754d8..ff91fdf 100644 --- a/t/test-site-output/document.en.html +++ b/t/test-site-output/document.en.html @@ -6,24 +6,24 @@
  • bar!
  • baz
  • Category 'one'
    Category 'three/bis'
    Category 'two' -
    Creato: 2008-03-01 10:04:00 - Ultima modifica: 2009-01-08 16:41:12
    + Ultima modifica: 2008-03-01 09:37:45 diff --git a/t/test-site-output/document.it.html b/t/test-site-output/document.it.html index 1ab3037..453d829 100644 --- a/t/test-site-output/document.it.html +++ b/t/test-site-output/document.it.html @@ -5,22 +5,22 @@
    Categoria 'uno'
    Categoria 'three/bis'
    Categoria 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:12
    + Ultima modifica: 2007-09-09 12:01:07 diff --git a/t/test-site-output/en-only/document.en.html b/t/test-site-output/en-only/document.en.html index 57424a8..a0da7f0 100644 --- a/t/test-site-output/en-only/document.en.html +++ b/t/test-site-output/en-only/document.en.html @@ -6,24 +6,24 @@

    Category 'one'
    Category 'three/bis'
    Category 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:12
    + Ultima modifica: 2009-01-08 16:34:23 diff --git a/t/test-site-output/feed.it.xml b/t/test-site-output/feed.it.xml index f25dad1..7e6e07e 100644 --- a/t/test-site-output/feed.it.xml +++ b/t/test-site-output/feed.it.xml @@ -8,5 +8,12 @@
  • line 3
  • link: bar-baz italiano

    tag:thenautilus.net,2007-09-09T12:01:07+0000
    Pagina principale -
    tag:thenautilus.net,2008-01-02T13:55:03+0000
    Pagina foo

    foo +

    tag:thenautilus.net,2008-01-02T12:50:03+0000
    Categoria 'two' +
    tag:thenautilus.net,2008-01-02T12:50:03+0000
    Categoria 'three' +
    tag:thenautilus.net,2008-01-02T12:50:03+0000
    Categoria 'uno' +
    tag:thenautilus.net,2008-01-02T12:50:03+0000
    Categoria 'three/bis' +
    tag:thenautilus.net,2008-01-02T13:55:03+0000
    Pagina foo

    foo

    diff --git a/t/test-site-output/foo/document.en.html b/t/test-site-output/foo/document.en.html index 034312c..38712de 100644 --- a/t/test-site-output/foo/document.en.html +++ b/t/test-site-output/foo/document.en.html @@ -6,24 +6,24 @@

    Category 'one'
    Category 'three/bis'
    Category 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:12
    + Ultima modifica: 2007-09-09 11:18:59 diff --git a/t/test-site-output/foo/document.it.html b/t/test-site-output/foo/document.it.html index 89addc4..21adbd4 100644 --- a/t/test-site-output/foo/document.it.html +++ b/t/test-site-output/foo/document.it.html @@ -4,22 +4,22 @@

    Categoria 'uno'
    Categoria 'three/bis'
    Categoria 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:12
    + Ultima modifica: 2008-01-02 13:55:03 diff --git a/t/test-site-output/tags/one/document.en.html b/t/test-site-output/tags/one/document.en.html index e5b67cf..821af6f 100644 --- a/t/test-site-output/tags/one/document.en.html +++ b/t/test-site-output/tags/one/document.en.html @@ -2,29 +2,29 @@ Category 'one'
    Category 'one'
    Category 'three/bis'
    Category 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:13
    + Ultima modifica: 2008-01-02 12:50:03 diff --git a/t/test-site-output/tags/one/document.it.html b/t/test-site-output/tags/one/document.it.html index 04638d9..06db89a 100644 --- a/t/test-site-output/tags/one/document.it.html +++ b/t/test-site-output/tags/one/document.it.html @@ -2,26 +2,26 @@ Categoria 'uno'
    Categoria 'uno'
    Categoria 'three/bis'
    Categoria 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:13
    + Ultima modifica: 2008-01-02 12:50:03 diff --git a/t/test-site-output/tags/one/feed.en.xml b/t/test-site-output/tags/one/feed.en.xml index f15a29a..da78a62 100644 --- a/t/test-site-output/tags/one/feed.en.xml +++ b/t/test-site-output/tags/one/feed.en.xml @@ -1,7 +1,7 @@ -Gianni Ceccarellidakkar@thenautilus.nethttp://www.thenautilus.net/thenautilus.net2009-01-08T16:34:23+0000tag:thenautilus.net,2007-09-09T11:18:59+0000
    foo page -

    foo -

    tag:thenautilus.net,2007-09-09T11:18:59+0000
    bar-baz english +Gianni Ceccarellidakkar@thenautilus.nethttp://www.thenautilus.net/thenautilus.net2009-01-08T16:34:23+0000tag:thenautilus.net,2007-09-09T11:18:59+0000
    bar-baz english

    sticaz -

    +

    tag:thenautilus.net,2007-09-09T11:18:59+0000
    foo page +

    foo +

    diff --git a/t/test-site-output/tags/three/bis/document.en.html b/t/test-site-output/tags/three/bis/document.en.html index 3c5d929..7129c23 100644 --- a/t/test-site-output/tags/three/bis/document.en.html +++ b/t/test-site-output/tags/three/bis/document.en.html @@ -6,24 +6,24 @@
    Category 'one'
    Category 'three/bis'
    Category 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:13
    + Ultima modifica: 2008-01-02 12:50:03 diff --git a/t/test-site-output/tags/three/bis/document.it.html b/t/test-site-output/tags/three/bis/document.it.html index dbcb95b..0da1b11 100644 --- a/t/test-site-output/tags/three/bis/document.it.html +++ b/t/test-site-output/tags/three/bis/document.it.html @@ -6,22 +6,22 @@
    Categoria 'uno'
    Categoria 'three/bis'
    Categoria 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:13
    + Ultima modifica: 2008-01-02 12:50:03 diff --git a/t/test-site-output/tags/three/document.en.html b/t/test-site-output/tags/three/document.en.html index 9f41824..761b035 100644 --- a/t/test-site-output/tags/three/document.en.html +++ b/t/test-site-output/tags/three/document.en.html @@ -5,24 +5,24 @@
    Category 'one'
    Category 'three/bis'
    Category 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:13
    + Ultima modifica: 2008-01-02 12:50:03 diff --git a/t/test-site-output/tags/three/document.it.html b/t/test-site-output/tags/three/document.it.html index 32b8d28..947b3d7 100644 --- a/t/test-site-output/tags/three/document.it.html +++ b/t/test-site-output/tags/three/document.it.html @@ -5,22 +5,22 @@
    Categoria 'uno'
    Categoria 'three/bis'
    Categoria 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:13
    + Ultima modifica: 2008-01-02 12:50:03 diff --git a/t/test-site-output/tags/two/document.en.html b/t/test-site-output/tags/two/document.en.html index 4bdcbe8..a683243 100644 --- a/t/test-site-output/tags/two/document.en.html +++ b/t/test-site-output/tags/two/document.en.html @@ -2,30 +2,30 @@ Category 'two'

    Category 'two' -

    Category 'one'
    Category 'three/bis'
    Category 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:13
    + Ultima modifica: 2008-01-02 12:50:03 diff --git a/t/test-site-output/tags/two/document.it.html b/t/test-site-output/tags/two/document.it.html index 3b38758..f1ea5ac 100644 --- a/t/test-site-output/tags/two/document.it.html +++ b/t/test-site-output/tags/two/document.it.html @@ -2,26 +2,26 @@ Categoria 'two'

    Categoria 'two' -

    Categoria 'uno' +
    Categoria 'uno'
    Categoria 'three/bis'
    Categoria 'two' -
    Creato: 1970-01-01 00:00:00 - Ultima modifica: 2009-01-08 16:41:13
    + Ultima modifica: 2008-01-02 12:50:03 -- cgit v1.2.3