diff options
author | dakkar <dakkar@luxion> | 2008-01-02 12:50:03 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2008-01-02 12:50:03 +0000 |
commit | 3ca3fc205d3741a86282566fc932f3cc347fc6fb (patch) | |
tree | b9e36492fc14f132617553dc3d5e904a20bf0243 | |
parent | argh! (diff) | |
download | WebCoso-3ca3fc205d3741a86282566fc932f3cc347fc6fb.tar.gz WebCoso-3ca3fc205d3741a86282566fc932f3cc347fc6fb.tar.bz2 WebCoso-3ca3fc205d3741a86282566fc932f3cc347fc6fb.zip |
testing new dir structure
git-svn-id: svn://luxion/repos/WebCoso/trunk@316 fcb26f47-9200-0410-b104-b98ab5b095f3
-rw-r--r-- | stest.pl | 69 | ||||
-rw-r--r-- | t/test-site/common/document-listing.tt | 2 | ||||
l--------- | t/test-site/src/tags/one/document-listing.tt (renamed from t/test-site/tags/one/document-listing.tt) | 0 | ||||
-rw-r--r-- | t/test-site/src/tags/one/document.en.rest.tt (renamed from t/test-site/tags/one/document.en.rest.tt) | 0 | ||||
-rw-r--r-- | t/test-site/src/tags/one/document.it.rest.tt (renamed from t/test-site/tags/one/document.it.rest.tt) | 0 | ||||
l--------- | t/test-site/src/tags/one/du2html.xsl (renamed from t/test-site/tags/du2html.xsl) | 0 | ||||
l--------- | t/test-site/src/tags/three/bis/document-listing.tt (renamed from t/test-site/tags/three/bis/document-listing.tt) | 0 | ||||
-rw-r--r-- | t/test-site/src/tags/three/bis/document.en.rest.tt (renamed from t/test-site/tags/three/bis/document.en.rest.tt) | 0 | ||||
-rw-r--r-- | t/test-site/src/tags/three/bis/document.it.rest.tt (renamed from t/test-site/tags/three/bis/document.it.rest.tt) | 0 | ||||
l--------- | t/test-site/src/tags/three/bis/du2html.xsl (renamed from t/test-site/tags/three/bis/du2html.xsl) | 0 | ||||
l--------- | t/test-site/src/tags/three/document-listing.tt (renamed from t/test-site/tags/three/document-listing.tt) | 0 | ||||
-rw-r--r-- | t/test-site/src/tags/three/document.en.rest.tt (renamed from t/test-site/tags/three/document.en.rest.tt) | 0 | ||||
-rw-r--r-- | t/test-site/src/tags/three/document.it.rest.tt (renamed from t/test-site/tags/three/document.it.rest.tt) | 0 | ||||
l--------- | t/test-site/src/tags/three/du2html.xsl (renamed from t/test-site/tags/one/du2html.xsl) | 0 | ||||
l--------- | t/test-site/src/tags/two/document-listing.tt (renamed from t/test-site/tags/two/document-listing.tt) | 0 | ||||
-rw-r--r-- | t/test-site/src/tags/two/document.en.rest.tt (renamed from t/test-site/tags/two/document.en.rest.tt) | 0 | ||||
-rw-r--r-- | t/test-site/src/tags/two/document.it.rest.tt (renamed from t/test-site/tags/two/document.it.rest.tt) | 0 | ||||
l--------- | t/test-site/src/tags/two/du2html.xsl (renamed from t/test-site/tags/three/du2html.xsl) | 0 | ||||
l--------- | t/test-site/tags/two/du2html.xsl | 1 |
19 files changed, 51 insertions, 21 deletions
@@ -12,6 +12,19 @@ use Text::Restructured::Writer::LibXML; use XML::LibXML; use XML::LibXSLT; use YAML::Syck; +use Getopt::Long; + +my $SRCPATH='src'; +my $DSTPATH='dst'; +my $DSTBASEURL='/'; + +{ +my $res=GetOptions('src|s=s'=>$SRCPATH, + 'dst|d=s'=>$DSTPATH, + 'url|u=s'=>$DSTBASEURL, + ); +exit 1 unless $res; +} my $stash={}; my $template_provider=Template::Provider->new({ @@ -50,6 +63,22 @@ $fc->add_writer(qr{\.ya?ml$} => sub { DumpFile($_[0],$_[1]) }); +sub dstUriFor { + my ($name)=@_; + $name=~s{^\Q$SRCPATH\E/}{$DSTBASEURL}; + return $name; +} + +sub isLang { + my ($lang,$name)=@_; + return 1 if $name=~m{/$}; # assume that MultiViews on the server will work + return 1 if $name=~m{/document\.$lang(\.|$)}; + return; +} + +$stash->{dstUriFor}=\&dstUriFor; +$stash->{isLang}=\&isLang; + sub expandTT { my ($maker,$target,$deps,$matches)=@_; @@ -171,22 +200,24 @@ sub keepEarliest { return @ret; } -my %files=(files=>sub{m{^document\.} and ($File::Next::dir !~ m{/\.svn/})}); +my %docfiles=( + files=>sub{m{^document\.} and ($File::Next::dir !~ m{/\.svn/})}, + dirs=>sub{!m{^(tags|_webcoso)$}}); my $maker=Slay::Maker->new({ rules => [ - ['src/(**)/document.(*).rest.txt',':',ifExists('src/$1/document.$2.rest.tt'),'=',\&expandTT], - ['src/(**)/document.(*).du.xml',':',ifExists('src/$1/document.$2.rest.txt'),'=',\&parseRST], - ['src/()document.(*).rest.txt',':',ifExists('src/document.$2.rest.tt'),'=',\&expandTT], - ['src/()document.(*).du.xml',':',ifExists('src/document.$2.rest.txt'),'=',\&parseRST], - ['deps/tags.yml',':',fromTo('src/',{%files,transform=>sub{my $s=shift;$s=~s{\.[^.]+\.[^.]+$}{.du.xml};$s}}),'=',\&getTags], - #['deps/changes.xml',':',keepEarliest(fromTo('src/',{%files})),'=',\&getChanges], - - ['tags/(**)/document.(*).rest.txt',':','deps/tags.yml',ifExists('tags/$1/document.$2.rest.tt'),'=',\&expandTT], - ['tags/(**)/document.(*).du.xml',':','deps/tags.yml',ifExists('tags/$1/document.$2.rest.txt'),'=',\&parseRST], - ['dtags/(**)/document.(*).html',':','deps/tags.yml','tags/$1/document.$2.du.xml','=',\&du2html], - ['dst/(**)/document.(*).html',':','deps/tags.yml','src/$1/document.$2.du.xml','=',\&du2html], - ['dst/()document.(*).html',':','deps/tags.yml','src/document.$2.du.xml','=',\&du2html], + ["$SRCPATH/(**)/document.(*).rest.txt",':',ifExists("$SRCPATH/\$1/document.\$2.rest.tt"),'=',\&expandTT], + ["$SRCPATH/(**)/document.(*).du.xml",':',ifExists("$SRCPATH/\$1/document.\$2.rest.txt"),'=',\&parseRST], + ["$SRCPATH/()document.(*).rest.txt",':',ifExists("$SRCPATH/document.\$2.rest.tt"),'=',\&expandTT], + ["$SRCPATH/()document.(*).du.xml",':',ifExists("$SRCPATH/document.\$2.rest.txt"),'=',\&parseRST], + ["$SRCPATH/_webcoso/tags.yml",':',fromTo("$SRCPATH/",{%docfiles,transform=>sub{my $s=shift;$s=~s{\.[^.]+\.[^.]+$}{.du.xml};$s}}),'=',\&getTags], + #["$SRCPATH/_webcoso/changes.xml",':',keepEarliest(fromTo("$SRCPATH/",{%docfiles})),'=',\&getChanges], + + ["$SRCPATH/tags/(**)/document.(*).rest.txt",':',"$SRCPATH/_webcoso/tags.yml",ifExists("$SRCPATH/tags/\$1/document.\$2.rest.tt"),'=',\&expandTT], + ["$SRCPATH/tags/(**)/document.(*).du.xml",':',"$SRCPATH/_webcoso/tags.yml",ifExists("$SRCPATH/tags/\$1/document.\$2.rest.txt"),'=',\&parseRST], + ["$DSTPATH/tags/(**)/document.(*).html",':',"$SRCPATH/_webcoso/tags.yml","$SRCPATH/tags/\$1/document.\$2.du.xml",'=',\&du2html], + ["$DESTPATH/(**)/document.(*).html",':',"$SRCPATH/_webcoso/tags.yml","$SRCPATH/\$1/document.\$2.du.xml",'=',\&du2html], + ["$DESTPATH/()document.(*).html",':',"$SRCPATH/_webcoso/tags.yml","$SRCPATH/document.\$2.du.xml",'=',\&du2html], ], options => { auto_create_dirs => 1, @@ -196,23 +227,23 @@ my $maker=Slay::Maker->new({ }, }); -my @targets=(fromTo('src/', +my @targets=(fromTo("$SRCPATH/", { - %files, + %docfiles, transform=>sub{ my $src=shift; $src=~s{\.[^.]+\.[^.]+$}{.html}; - $src=~s{^src/}{dst/}; + $src=~s{^\Q$SRCPATH\E/}{$DSTPATH/}; return $src; }, }), - fromTo('tags/', + fromTo("$SRCPATH/tags/", { - %files, + %tagfiles, transform=>sub{ my $src=shift; $src=~s{\.[^.]+\.[^.]+$}{.html}; - $src=~s{^tags/}{dtags/}; + $src=~s{^\Q$SRCPATH\E/tags/}{$DSTPATH/tags/}; return $src; }, })); diff --git a/t/test-site/common/document-listing.tt b/t/test-site/common/document-listing.tt index ec3adbb..729e08c 100644 --- a/t/test-site/common/document-listing.tt +++ b/t/test-site/common/document-listing.tt @@ -1,3 +1,3 @@ [% FOR doc IN tagged.$path %] -* `<[% doc %]>`_ +[% IF isLang(language,doc) %]* `<[% dstUriFor(doc) %]>`_[% END %] [% END %] diff --git a/t/test-site/tags/one/document-listing.tt b/t/test-site/src/tags/one/document-listing.tt index 9444be1..9444be1 120000 --- a/t/test-site/tags/one/document-listing.tt +++ b/t/test-site/src/tags/one/document-listing.tt diff --git a/t/test-site/tags/one/document.en.rest.tt b/t/test-site/src/tags/one/document.en.rest.tt index 6435637..6435637 100644 --- a/t/test-site/tags/one/document.en.rest.tt +++ b/t/test-site/src/tags/one/document.en.rest.tt diff --git a/t/test-site/tags/one/document.it.rest.tt b/t/test-site/src/tags/one/document.it.rest.tt index 0dae4f0..0dae4f0 100644 --- a/t/test-site/tags/one/document.it.rest.tt +++ b/t/test-site/src/tags/one/document.it.rest.tt diff --git a/t/test-site/tags/du2html.xsl b/t/test-site/src/tags/one/du2html.xsl index 6737f0e..6737f0e 120000 --- a/t/test-site/tags/du2html.xsl +++ b/t/test-site/src/tags/one/du2html.xsl diff --git a/t/test-site/tags/three/bis/document-listing.tt b/t/test-site/src/tags/three/bis/document-listing.tt index b2b2ee2..b2b2ee2 120000 --- a/t/test-site/tags/three/bis/document-listing.tt +++ b/t/test-site/src/tags/three/bis/document-listing.tt diff --git a/t/test-site/tags/three/bis/document.en.rest.tt b/t/test-site/src/tags/three/bis/document.en.rest.tt index 3b5629c..3b5629c 100644 --- a/t/test-site/tags/three/bis/document.en.rest.tt +++ b/t/test-site/src/tags/three/bis/document.en.rest.tt diff --git a/t/test-site/tags/three/bis/document.it.rest.tt b/t/test-site/src/tags/three/bis/document.it.rest.tt index 330b121..330b121 100644 --- a/t/test-site/tags/three/bis/document.it.rest.tt +++ b/t/test-site/src/tags/three/bis/document.it.rest.tt diff --git a/t/test-site/tags/three/bis/du2html.xsl b/t/test-site/src/tags/three/bis/du2html.xsl index b6e8ebc..b6e8ebc 120000 --- a/t/test-site/tags/three/bis/du2html.xsl +++ b/t/test-site/src/tags/three/bis/du2html.xsl diff --git a/t/test-site/tags/three/document-listing.tt b/t/test-site/src/tags/three/document-listing.tt index 9444be1..9444be1 120000 --- a/t/test-site/tags/three/document-listing.tt +++ b/t/test-site/src/tags/three/document-listing.tt diff --git a/t/test-site/tags/three/document.en.rest.tt b/t/test-site/src/tags/three/document.en.rest.tt index ac13056..ac13056 100644 --- a/t/test-site/tags/three/document.en.rest.tt +++ b/t/test-site/src/tags/three/document.en.rest.tt diff --git a/t/test-site/tags/three/document.it.rest.tt b/t/test-site/src/tags/three/document.it.rest.tt index bcd13ef..bcd13ef 100644 --- a/t/test-site/tags/three/document.it.rest.tt +++ b/t/test-site/src/tags/three/document.it.rest.tt diff --git a/t/test-site/tags/one/du2html.xsl b/t/test-site/src/tags/three/du2html.xsl index 6737f0e..6737f0e 120000 --- a/t/test-site/tags/one/du2html.xsl +++ b/t/test-site/src/tags/three/du2html.xsl diff --git a/t/test-site/tags/two/document-listing.tt b/t/test-site/src/tags/two/document-listing.tt index 9444be1..9444be1 120000 --- a/t/test-site/tags/two/document-listing.tt +++ b/t/test-site/src/tags/two/document-listing.tt diff --git a/t/test-site/tags/two/document.en.rest.tt b/t/test-site/src/tags/two/document.en.rest.tt index 5b5579a..5b5579a 100644 --- a/t/test-site/tags/two/document.en.rest.tt +++ b/t/test-site/src/tags/two/document.en.rest.tt diff --git a/t/test-site/tags/two/document.it.rest.tt b/t/test-site/src/tags/two/document.it.rest.tt index 3291828..3291828 100644 --- a/t/test-site/tags/two/document.it.rest.tt +++ b/t/test-site/src/tags/two/document.it.rest.tt diff --git a/t/test-site/tags/three/du2html.xsl b/t/test-site/src/tags/two/du2html.xsl index 6737f0e..6737f0e 120000 --- a/t/test-site/tags/three/du2html.xsl +++ b/t/test-site/src/tags/two/du2html.xsl diff --git a/t/test-site/tags/two/du2html.xsl b/t/test-site/tags/two/du2html.xsl deleted file mode 120000 index 6737f0e..0000000 --- a/t/test-site/tags/two/du2html.xsl +++ /dev/null @@ -1 +0,0 @@ -../../common/du2html.xsl
\ No newline at end of file |