From 4f2a71b17f45958d8926841ad54045f9e3fcdf1c Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 2 Jan 2008 13:18:25 +0000 Subject: new directory structure works git-svn-id: svn://luxion/repos/WebCoso/trunk@317 fcb26f47-9200-0410-b104-b98ab5b095f3 --- stest.pl | 29 ++- t/test-site/common/document-listing.tt | 3 - t/test-site/common/du2html.xsl | 27 -- t/test-site/common/reST.xsl | 393 ----------------------------- t/test-site/src/bar/baz/du2html.xsl | 2 +- t/test-site/src/bar/du2html.xsl | 2 +- t/test-site/src/common/document-listing.tt | 3 + t/test-site/src/common/du2html.xsl | 27 ++ t/test-site/src/common/reST.xsl | 393 +++++++++++++++++++++++++++++ t/test-site/src/du2html.xsl | 2 +- t/test-site/src/foo/du2html.xsl | 2 +- 11 files changed, 447 insertions(+), 436 deletions(-) delete mode 100644 t/test-site/common/document-listing.tt delete mode 100644 t/test-site/common/du2html.xsl delete mode 100644 t/test-site/common/reST.xsl create mode 100644 t/test-site/src/common/document-listing.tt create mode 100644 t/test-site/src/common/du2html.xsl create mode 100644 t/test-site/src/common/reST.xsl 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/common/document-listing.tt b/t/test-site/common/document-listing.tt deleted file mode 100644 index 729e08c..0000000 --- a/t/test-site/common/document-listing.tt +++ /dev/null @@ -1,3 +0,0 @@ -[% FOR doc IN tagged.$path %] -[% IF isLang(language,doc) %]* `<[% dstUriFor(doc) %]>`_[% END %] -[% END %] diff --git a/t/test-site/common/du2html.xsl b/t/test-site/common/du2html.xsl deleted file mode 100644 index d7a9b62..0000000 --- a/t/test-site/common/du2html.xsl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - <x:apply-templates select="title/node()"/> - - -

- - - -
- -
\ No newline at end of file diff --git a/t/test-site/common/reST.xsl b/t/test-site/common/reST.xsl deleted file mode 100644 index 7db5de2..0000000 --- a/t/test-site/common/reST.xsl +++ /dev/null @@ -1,393 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- - -
-
- - - -
-
- - -
-
- - - -

-
- - - - - - - -
- -
- - -
- Source: - -
-
-
- - - - - - - - - footnoteref - - footnote-backref- - - - - #footnote- - - - - [ - - ] - - - - - - - footnote - - footnote- - - - - - footnotereturn - - #footnote-backref- - - - - return to content - - - # - - : - - - - - - - - - - -
-
- - -
-
- - - -
  • -
    - - - - - - - - - -
    -
    - - -
    -
    - - -
    -
    - - - - - - - - - - - -
    OptionDescription
    -
    - - - - - - - - -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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/src/common/document-listing.tt b/t/test-site/src/common/document-listing.tt new file mode 100644 index 0000000..729e08c --- /dev/null +++ b/t/test-site/src/common/document-listing.tt @@ -0,0 +1,3 @@ +[% FOR doc IN tagged.$path %] +[% IF isLang(language,doc) %]* `<[% dstUriFor(doc) %]>`_[% END %] +[% END %] diff --git a/t/test-site/src/common/du2html.xsl b/t/test-site/src/common/du2html.xsl new file mode 100644 index 0000000..d7a9b62 --- /dev/null +++ b/t/test-site/src/common/du2html.xsl @@ -0,0 +1,27 @@ + + + + + + + + + + + + + <x:apply-templates select="title/node()"/> + + +

    + + + +
    + +
    \ No newline at end of file diff --git a/t/test-site/src/common/reST.xsl b/t/test-site/src/common/reST.xsl new file mode 100644 index 0000000..7db5de2 --- /dev/null +++ b/t/test-site/src/common/reST.xsl @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
    + + +
    +
    + + + +
    +
    + + +
    +
    + + + +

    +
    + + + + + + + +
    + +
    + + +
    + Source: + +
    +
    +
    + + + + + + + + + footnoteref + + footnote-backref- + + + + #footnote- + + + + [ + + ] + + + + + + + footnote + + footnote- + + + + + footnotereturn + + #footnote-backref- + + + + return to content + + + # + + : + + + + + + + + + + +
    +
    + + +
    +
    + + + +
  • +
    + + + + + + + + + +
    +
    + + +
    +
    + + +
    +
    + + + + + + + + + + + +
    OptionDescription
    +
    + + + + + + + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    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 -- cgit v1.2.3