aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stest.pl29
l---------t/test-site/src/bar/baz/du2html.xsl2
l---------t/test-site/src/bar/du2html.xsl2
-rw-r--r--t/test-site/src/common/document-listing.tt (renamed from t/test-site/common/document-listing.tt)0
-rw-r--r--t/test-site/src/common/du2html.xsl (renamed from t/test-site/common/du2html.xsl)0
-rw-r--r--t/test-site/src/common/reST.xsl (renamed from t/test-site/common/reST.xsl)0
l---------t/test-site/src/du2html.xsl2
l---------t/test-site/src/foo/du2html.xsl2
8 files changed, 24 insertions, 13 deletions
diff --git a/stest.pl b/stest.pl
index 0d48333..ac9b1a9 100644
--- a/stest.pl
+++ b/stest.pl
@@ -17,18 +17,23 @@ use Getopt::Long;
my $SRCPATH='src';
my $DSTPATH='dst';
my $DSTBASEURL='/';
+my @TMPLPATH=('common/');
{
-my $res=GetOptions('src|s=s'=>$SRCPATH,
- 'dst|d=s'=>$DSTPATH,
- 'url|u=s'=>$DSTBASEURL,
+my $res=GetOptions('src|s=s'=>\$SRCPATH,
+ 'dst|d=s'=>\$DSTPATH,
+ 'url|u=s'=>\$DSTBASEURL,
+ 'include|I=s'=>\@TMPLPATH,
);
exit 1 unless $res;
+$SRCPATH=~s{/+$}{};
+$DSTPATH=~s{/+$}{};
+$DSTBASEURL=~s{/*$}{/};
}
my $stash={};
my $template_provider=Template::Provider->new({
- INCLUDE_PATH=> 'common/',
+ INCLUDE_PATH=> \@TMPLPATH,
ABSOLUTE=>1,
RELATIVE=>1,
});
@@ -65,12 +70,15 @@ $fc->add_writer(qr{\.ya?ml$} =>
sub dstUriFor {
my ($name)=@_;
+ warn "dstUriFor($name)\n";
+ $name=~s{\.[^.]+\.[^.]+$}{.html};
$name=~s{^\Q$SRCPATH\E/}{$DSTBASEURL};
return $name;
}
sub isLang {
my ($lang,$name)=@_;
+ warn "isLang($lang,$name)\n";
return 1 if $name=~m{/$}; # assume that MultiViews on the server will work
return 1 if $name=~m{/document\.$lang(\.|$)};
return;
@@ -82,12 +90,15 @@ $stash->{isLang}=\&isLang;
sub expandTT {
my ($maker,$target,$deps,$matches)=@_;
+ warn "expandTT($target,@$deps,@$matches)\n";
+
my $tmpl=$fc->get($deps->[-1]);
my $vars={ path=> $matches->[0],
language => $matches->[1],
%$stash,
};
if (@$deps>1) {
+ warn "tagging as $deps->[0]\n";
$vars->{tagged}=$fc->get($deps->[0]);
}
push @{$template_provider->include_path},
@@ -206,6 +217,8 @@ my %docfiles=(
my $maker=Slay::Maker->new({
rules => [
+ ["$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],
["$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],
@@ -213,11 +226,9 @@ my $maker=Slay::Maker->new({
["$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],
+ ["$DSTPATH/(**)/document.(*).html",':',"$SRCPATH/_webcoso/tags.yml","$SRCPATH/\$1/document.\$2.du.xml",'=',\&du2html],
+ ["$DSTPATH/()document.(*).html",':',"$SRCPATH/_webcoso/tags.yml","$SRCPATH/document.\$2.du.xml",'=',\&du2html],
],
options => {
auto_create_dirs => 1,
@@ -239,7 +250,7 @@ my @targets=(fromTo("$SRCPATH/",
}),
fromTo("$SRCPATH/tags/",
{
- %tagfiles,
+ %docfiles,
transform=>sub{
my $src=shift;
$src=~s{\.[^.]+\.[^.]+$}{.html};
diff --git a/t/test-site/src/bar/baz/du2html.xsl b/t/test-site/src/bar/baz/du2html.xsl
index b6e8ebc..6737f0e 120000
--- a/t/test-site/src/bar/baz/du2html.xsl
+++ b/t/test-site/src/bar/baz/du2html.xsl
@@ -1 +1 @@
-../../../common/du2html.xsl \ No newline at end of file
+../../common/du2html.xsl \ No newline at end of file
diff --git a/t/test-site/src/bar/du2html.xsl b/t/test-site/src/bar/du2html.xsl
index 6737f0e..bea6032 120000
--- a/t/test-site/src/bar/du2html.xsl
+++ b/t/test-site/src/bar/du2html.xsl
@@ -1 +1 @@
-../../common/du2html.xsl \ No newline at end of file
+../common/du2html.xsl \ No newline at end of file
diff --git a/t/test-site/common/document-listing.tt b/t/test-site/src/common/document-listing.tt
index 729e08c..729e08c 100644
--- a/t/test-site/common/document-listing.tt
+++ b/t/test-site/src/common/document-listing.tt
diff --git a/t/test-site/common/du2html.xsl b/t/test-site/src/common/du2html.xsl
index d7a9b62..d7a9b62 100644
--- a/t/test-site/common/du2html.xsl
+++ b/t/test-site/src/common/du2html.xsl
diff --git a/t/test-site/common/reST.xsl b/t/test-site/src/common/reST.xsl
index 7db5de2..7db5de2 100644
--- a/t/test-site/common/reST.xsl
+++ b/t/test-site/src/common/reST.xsl
diff --git a/t/test-site/src/du2html.xsl b/t/test-site/src/du2html.xsl
index bea6032..4b848d0 120000
--- a/t/test-site/src/du2html.xsl
+++ b/t/test-site/src/du2html.xsl
@@ -1 +1 @@
-../common/du2html.xsl \ No newline at end of file
+common/du2html.xsl \ No newline at end of file
diff --git a/t/test-site/src/foo/du2html.xsl b/t/test-site/src/foo/du2html.xsl
index 6737f0e..bea6032 120000
--- a/t/test-site/src/foo/du2html.xsl
+++ b/t/test-site/src/foo/du2html.xsl
@@ -1 +1 @@
-../../common/du2html.xsl \ No newline at end of file
+../common/du2html.xsl \ No newline at end of file