From a7bc2effe35b0059afe765e88b3aebd18d2b615c Mon Sep 17 00:00:00 2001 From: cdot Date: Sun, 28 Jan 2018 11:10:35 +0000 Subject: [PATCH] Item14611: add flatdir generator. Fix resources in flatfile generator too. Also make templates for generated topics, such as index. Add debug mode for tracing URL processing. --- data/System/PublishPlugin.txt | 17 ++- lib/Foswiki/Plugins/PublishPlugin/BackEnd.pm | 10 +- .../Plugins/PublishPlugin/BackEnd/file.pm | 113 ++++++++++-------- .../Plugins/PublishPlugin/BackEnd/flatdir.pm | 35 ++++++ .../Plugins/PublishPlugin/BackEnd/flatfile.pm | 45 ++++++- lib/Foswiki/Plugins/PublishPlugin/MANIFEST | 2 + .../Plugins/PublishPlugin/Publisher.pm | 71 ++++++----- templates/PublishPlugin.tmpl | 25 ++++ 8 files changed, 230 insertions(+), 88 deletions(-) create mode 100644 lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatdir.pm create mode 100644 templates/PublishPlugin.tmpl diff --git a/data/System/PublishPlugin.txt b/data/System/PublishPlugin.txt index c4ab578..837585e 100644 --- a/data/System/PublishPlugin.txt +++ b/data/System/PublishPlugin.txt @@ -130,7 +130,7 @@ table.publishForm .paramCol { The =topics= parameter is used to give a (comma-separated) list of web.topic names. These can be specified using [[#WildcardPattern][wildcard patterns]]. * =Myweb.*= will publish all topics in the =Myweb= web (but not in subwebs) - * =Myweb*.*= will publish all topics in the =Myweb= web and all it's subwebs + * =Myweb*.*= will publish all topics in the =Myweb= web and all its subwebs * =*.*= will publish all topics in the wiki * =Web.= implies =Web.*=, and =.Topic= and =Topic= both imply =*.Topic= * The list is expanded in left-right order. You can edit the list at any point by prefixing an entry with a =-= sign e.g. =*.*,-*.Last*= will publish all topics in the wiki in web.topic order except topics starting with =Last= @@ -335,6 +335,18 @@ don't need a history. =history= + + Debug + + + + +Enable to get a lot of debug messages, mainly relating to the processing of URL. + + + =debug= + + %ENDTWISTY% @@ -454,9 +466,10 @@ If you are using an on-disk file store, such as !PlainFile or one of the RCS sto %X% Note that overwriting attachments this way is extremely dangerous, so this should only be done by experts! You have been warned. %X% + * Open =configure= * First set the ={Plugins}{PublishPlugin}{Dir}= to the same as ={PubDir}= * Then publish with a =relativedir= setting that corresponds to the attachment directory for the web/topic that you want to attach to - * If {AutoAttachPubFiles} is enabled, it will automatically be attached to the topic. + * If ={AutoAttachPubFiles}= is enabled, it will automatically be attached to the topic. ---++ Installation Instructions diff --git a/lib/Foswiki/Plugins/PublishPlugin/BackEnd.pm b/lib/Foswiki/Plugins/PublishPlugin/BackEnd.pm index 9e7aba3..148b786 100644 --- a/lib/Foswiki/Plugins/PublishPlugin/BackEnd.pm +++ b/lib/Foswiki/Plugins/PublishPlugin/BackEnd.pm @@ -38,8 +38,8 @@ use Assert; Construct a new back end. * =$params= - optional parameter hash, may contain generator-specific options - * =$logger= - ref to an object that supports logWarn, logInfo and logError - methods (see Publisher.pm) + * =$logger= - ref to an object that supports logDebug, logWarn, logInfo + and logError methods (see Publisher.pm) =cut sub new { @@ -55,13 +55,15 @@ sub new { return $this; } -# Like join, but for dir and url paths, for subclasses +# Like join, but for dir and url paths, protected utility for subclasses sub pathJoin { my $this = shift; + + # use length() to exclude undef and empty path els my $all = join( '/', grep { length($_) } @_ ); $all =~ s://+:/:g; # doubled slash $all =~ s:/+$::; # trailing / - $all =~ s!^([a-zA-Z0-9]+:/)!$1/!; # reslash abs urls + $all =~ s!^([a-zA-Z0-9]+:/)!$1/!; # reslash absolute urls return $all; } diff --git a/lib/Foswiki/Plugins/PublishPlugin/BackEnd/file.pm b/lib/Foswiki/Plugins/PublishPlugin/BackEnd/file.pm index 541b94d..a8f3a0d 100644 --- a/lib/Foswiki/Plugins/PublishPlugin/BackEnd/file.pm +++ b/lib/Foswiki/Plugins/PublishPlugin/BackEnd/file.pm @@ -36,22 +36,31 @@ sub new { my $this = $class->SUPER::new( $params, $logger ); + # See param_schema for information about outfile and relativedir $this->{output_file} = $params->{relativedir} || ''; $this->{output_file} = $this->pathJoin( $this->{output_file}, $params->{outfile} ) if $params->{outfile}; + # The root of the directory structure we are writing to. $this->{file_root} = $this->pathJoin( $Foswiki::cfg{Plugins}{PublishPlugin}{Dir}, $this->{output_file} ); + $this->{logger}->logDebug( '', 'Publishing to ', $this->{file_root} ); $this->{resource_id} = 0; + # List of web.topic paths to already-published topics. $this->{last_published} = {}; - # Capture HTML generated for use by subclasses + # Capture HTML generated. $this->{html_files} = []; + # Note that both html_files and last_published are indexed on the + # final generated path for the HTML. This *may* look like the + # web.topic path, but that cannot be assumed as getTopicPath may + # have changed it significantly. + if ( !$params->{keep} || $params->{keep} eq 'nothing' ) { # Don't keep anything @@ -60,26 +69,29 @@ sub new { elsif ( !$params->{dont_keep_existing} ) { # See what's worth keeping - $this->_scanExistingHTML( $this->{file_root}, '' ); + $this->_scanExistingHTML(''); } return $this; } -# Find existing HTML in published dir structure to add to sitemap etc +# Find existing HTML in published dir structure to add to sitemap and act +# as targets for links. +# $w - path relative to publishing root sub _scanExistingHTML { - my ( $this, $root, $relpath ) = @_; + my ( $this, $w ) = @_; my $d; - return unless ( opendir( $d, "$root/$relpath" ) ); + return unless ( opendir( $d, "$this->{file_root}/$w" ) ); while ( my $f = readdir($d) ) { next if $f =~ /^\./; - if ( -d "$root/$relpath/$f" ) { - $this->_scanExistingHTML( $root, $relpath ? "$relpath/$f" : $f ); + if ( -d "$this->{file_root}/$w/$f" ) { + $this->_scanExistingHTML( $w ? "$w/$f" : $f ); } - elsif ( $relpath && $f =~ /\.html$/ ) { - my $p = "$relpath/$f"; - push( @{ $this->{html_files} }, Encode::decode_utf8($p) ); - $this->{last_published}->{$p} = ( stat("$root/$p") )[9]; + elsif ( $w && $f =~ /^\.html$/ ) { + my $p = "$w/$f"; # path relative to file_root + push( @{ $this->{html_files} }, $p ); + $this->{last_published}->{$p} = + ( stat("$this->{file_root}/$p") )[9]; } } closedir($d); @@ -111,6 +123,16 @@ sub validatePath { return $v; } +# Validate that the parameter refers to an existing web/topic +sub validateWebTopic { + my ( $v, $k ) = @_; + return $v unless $v; + my @wt = Foswiki::Func::normalizeWebTopicName( 'NOT_A_WEB', $v ); + die "$k ($v) is not an existing topic " . join( ';', @wt ) + unless Foswiki::Func::topicExists(@wt); + return $v; +} + # Implement Foswiki::Plugins::PublishPlugin::BackEnd sub param_schema { my $class = shift; @@ -123,9 +145,10 @@ sub param_schema { validator => \&validateFilename }, defaultpage => { - desc => 'Web.Topic to redirect to from index.html / default.html', + desc => +'Web.Topic to redirect to from index.html / default.html. If you leave this blank, the index will contain a simple list of all the published topics.', default => '', - validator => \&validatePath + validator => \&validateWebTopic }, googlefile => { desc => @@ -158,8 +181,9 @@ sub param_schema { # Implement Foswiki::Plugins::PublishPlugin::BackEnd sub getTopicPath { my ( $this, $web, $topic ) = @_; + my @path = split( /\/+/, $web ); - push( @path,, $topic . '.html' ); + push( @path, $topic . '.html' ); return $this->pathJoin(@path); } @@ -167,7 +191,7 @@ sub getTopicPath { sub alreadyPublished { my ( $this, $web, $topic ) = @_; return 0 unless ( $this->{params}->{keep} // '' ) eq 'unchanged'; - my $pd = $this->{last_published}->{"$web/$topic.html"}; + my $pd = $this->{last_published}->{ $this->getTopicPath( $web, $topic ) }; return 0 unless $pd; my ($cd) = Foswiki::Func::getRevisionInfo( $web, $topic ); return 0 unless $cd; @@ -178,10 +202,7 @@ sub alreadyPublished { sub addTopic { my ( $this, $web, $topic, $text ) = @_; - my @path = grep { length($_) } split( /\/+/, $web ); - push( @path, $topic . '.html' ); - - my $path = $this->pathJoin(@path); + my $path = $this->getTopicPath( $web, $topic ); push( @{ $this->{html_files} }, $path ); return $this->addByteData( $path, Encode::encode_utf8($text) ); } @@ -190,11 +211,9 @@ sub addTopic { sub addAttachment { my ( $this, $web, $topic, $attachment, $data ) = @_; - my @path = grep { length($_) } split( /\/+/, $web ); - push( @path, $topic . '.attachments' ); - push( @path, $attachment ); - - my $path = $this->pathJoin(@path); + my $path = + $this->pathJoin( $this->getTopicPath( $web, "$topic.attachments" ), + $attachment ); return $this->addByteData( $path, $data ); } @@ -251,13 +270,16 @@ sub addByteData { sub close { my $this = shift; + Foswiki::Func::loadTemplate('PublishPlugin'); + # write sitemap.xml - my $sitemap = - '' - . '' - . join( "\n", - map { '' . $_ . ''; } @{ $this->{html_files} } ) - . ''; + my $smurl = Foswiki::Func::expandTemplate('PublishPlugin:sitemap_url'); + my $smurls = join( "\n", + map { my $x = $smurl; $x =~ s/%URL%/$_/g; $x } + @{ $this->{html_files} } ); + my $sitemap = Foswiki::Func::expandTemplate('PublishPlugin:sitemap'); + $sitemap =~ s/%URLS%/$smurls/g; + $this->addByteData( 'sitemap.xml', Encode::encode_utf8($sitemap) ); # Write Google verification files (comma separated list) @@ -265,34 +287,29 @@ sub close { my @files = split( /\s*,\s*/, $this->{params}->{googlefile} ); for my $file (@files) { my $simplehtml = - '' - . $file - . 'Google verification'; + Foswiki::Func::expandTemplate('PublishPlugin:googlefile'); + $simplehtml =~ s/%FILE%/$file/g; $this->addByteData( $file, Encode::encode_utf8($simplehtml) ); } } # Write default.htm and index.html - my $html = <<'HEAD'; - - - - -HEAD + my $html = Foswiki::Func::expandTemplate('PublishPlugin:redirect'); if ( $this->{params}->{defaultpage} ) { - $this->{params}->{defaultpage} =~ s/\./\//g; - $html .= '\n$this->{params}->{defaultpage} - please wait"; + my @wt = + Foswiki::Func::normalizeWebTopicName( undef, + $this->{params}->{defaultpage} ); + my $mtag = ""; + $html =~ s/%HEAD%/$mtag/g; + $html =~ s/%BODY%/$this->{params}->{defaultpage} - please wait/g; } else { - $html .= ""; - $html .= join( "
\n", + $html =~ s/%HEAD%//g; + my $bod = join( "
\n", map { "$_" } @{ $this->{html_files} } ); + $html =~ s/%BODY%/$bod/g; } - $html .= "\n"; $html = Encode::encode_utf8($html); $this->addByteData( 'default.htm', $html ); $this->addByteData( 'index.html', $html ); diff --git a/lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatdir.pm b/lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatdir.pm new file mode 100644 index 0000000..dca27b9 --- /dev/null +++ b/lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatdir.pm @@ -0,0 +1,35 @@ +# +# Copyright (C) 2018 Crawford Currie, http://c-dot.co.uk +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details, published at +# http://www.gnu.org/copyleft/gpl.html +# +# File writer module for PublishPlugin. Generates a flat directory of HTML +# files, with a _rsrc subdirectory for external resources. +# +package Foswiki::Plugins::PublishPlugin::BackEnd::flatdir; + +use strict; + +use Foswiki::Plugins::PublishPlugin::BackEnd::file; +our @ISA = ('Foswiki::Plugins::PublishPlugin::BackEnd::file'); + +use constant DESCRIPTION => +'Flat directory of HTML files. Attachments (and external resources if =copyexternal is selected=) will be saved to a top level =_rsrc= directory next to the HTML.'; + +# Override Foswiki::Plugins::PublishPlugin::BackEnd +sub getTopicPath { + my ( $this, $web, $topic ) = @_; + my @path = split( /\/+/, $web ); + return join( '_', @path, $topic . '.html' ); +} + +1; diff --git a/lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatfile.pm b/lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatfile.pm index 0694f40..6aa8ffe 100644 --- a/lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatfile.pm +++ b/lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatfile.pm @@ -22,7 +22,7 @@ use Foswiki::Plugins::PublishPlugin::BackEnd::file; our @ISA = ('Foswiki::Plugins::PublishPlugin::BackEnd::file'); use constant DESCRIPTION => -'Single HTML file containing all topics. Attachments (and external resources if =copyexternal is selected=) will be saved to a top level =_rsrc= directory next to the HTML file.'; +'Single HTML file containing all topics. If =copyexternal= is selected, external resources will be saved to a top level =_files= directory next to the HTML file.'; sub new { my ( $class, $params, $logger ) = @_; @@ -30,10 +30,13 @@ sub new { $params->{dont_scan_existing} = 1; my $this = $class->SUPER::new( $params, $logger ); - $this->{flatfile} = ( $params->{outfile} || 'flatfile' ); - $this->{flatfile} .= '.html' unless $this->{flatfile} =~ /\.\w+$/; + my $flatfile = ( $params->{outfile} || 'flatfile' ); + $this->{flatfile} =~ s/\.\w+$//; + $this->{flatfile_rsrc} = $flatfile . "_files"; + $this->{flatfile_html} = $flatfile . ".html"; - my $fn = "$Foswiki::cfg{Plugins}{PublishPlugin}{Dir}/$this->{flatfile}"; + my $fn = + "$Foswiki::cfg{Plugins}{PublishPlugin}{Dir}/$this->{flatfile_html}"; my $fh; if ( open( $fh, '>', $fn ) ) { binmode($fh); @@ -49,6 +52,7 @@ sub param_schema { my $class = shift; my $base = $class->SUPER::param_schema(); delete $base->{keep}; + delete $base->{defaultpage}; # meaningless in a flat file $base->{outfile}->{default} = 'flatfile'; return $base; } @@ -72,11 +76,12 @@ sub addTopic { # Topics can be added inline to master with an anchor my $anchor = _makeAnchor( $web, $topic ); my $fh = $this->{flatfh}; - print $fh ""; + print $fh ""; print $fh $text; return '#' . $anchor; } +# Implement Foswiki::Plugins::PublishPlugin::BackEnd sub addAttachment { # Default is to store attachments in a .attachments dir next to @@ -86,6 +91,36 @@ sub addAttachment { return $this->addResource( $data, $attachment ); } +# Implement Foswiki::Plugins::PublishPlugin::BackEnd +sub addResource { + my ( $this, $data, $name ) = @_; + my $prefix = ''; + my $ext = ''; + if ( $ext =~ /(.*)(\.\w+)$/ ) { + $prefix = $1 // ''; + $ext = $2; + } + $this->{resource_id}++; + my $path = "$this->{flatfile_rsrc}/$prefix$this->{resource_id}$ext"; + my $dest = "$Foswiki::cfg{Plugins}{PublishPlugin}{Dir}/$path"; + $this->addPath( $dest, 1 ); + my $fh; + unless ( open( $fh, ">", $dest ) ) { + $this->{logger}->logError("Failed to write $dest: $!"); + return; + } + if ( defined $data ) { + print $fh $data; + } + else { + $this->{logger}->logError("$dest has no data, empty file created"); + } + close($fh); + $this->{logger}->logInfo( '', 'Published ' . $path ); + return $path; +} + +# Implement Foswiki::Plugins::PublishPlugin::BackEnd sub close { my $this = shift; diff --git a/lib/Foswiki/Plugins/PublishPlugin/MANIFEST b/lib/Foswiki/Plugins/PublishPlugin/MANIFEST index a570b05..98d5e2d 100644 --- a/lib/Foswiki/Plugins/PublishPlugin/MANIFEST +++ b/lib/Foswiki/Plugins/PublishPlugin/MANIFEST @@ -6,6 +6,7 @@ lib/Foswiki/Plugins/PublishPlugin/Config.spec 0444 lib/Foswiki/Plugins/PublishPlugin/Publisher.pm 0444 lib/Foswiki/Plugins/PublishPlugin/BackEnd.pm 0444 lib/Foswiki/Plugins/PublishPlugin/BackEnd/file.pm 0444 +lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatdir.pm 0444 lib/Foswiki/Plugins/PublishPlugin/BackEnd/flatfile.pm 0444 lib/Foswiki/Plugins/PublishPlugin/BackEnd/ftp.pm 0444 lib/Foswiki/Plugins/PublishPlugin/BackEnd/pdf.pm 0444 @@ -15,3 +16,4 @@ pub/System/PublishPlugin/publish.gif 0644 pub/System/PublishPlugin/wikiringlogo20x20.png 0644 templates/view.basic_publish.tmpl 0444 templates/publish_history.basic_publish.tmpl 0444 +templates/PublishPlugin.tmpl 0444 \ No newline at end of file diff --git a/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm b/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm index a0908a9..982c961 100644 --- a/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm +++ b/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm @@ -25,6 +25,11 @@ my %PARAM_SCHEMA = ( desc => 'Copy Off-Wiki Resources', validator => \&validateBoolean }, + debug => { + default => 0, + desc => 'Enable debug messages', + validator => \&validateBoolean + }, enableplugins => { # Keep this list in sync with System.PublishPlugin @@ -459,17 +464,24 @@ TEXT foreach my $expr (@wild) { my $filter = ( $expr =~ s/^-// ); + # Split specification into web and topics my ( $w, $t ) = split( /\./, $expr, 2 ); if ( $w && !$t ) { $t = $w; $w = '*'; } + + # Web. means all topics in Web + # . means all topics in all webs + # .Fred means all topics called Fred in all webs $w = '*' unless length($w); $t = '*' unless length($t); my $wre = _wildcards2RE($w); my $tre = _wildcards2RE($t); if ($filter) { + + # Exclude topics matching this RE my @filtered; while ( my $twt = pop(@topics) ) { ( $w, $t ) = split( /\./, $twt, 2 ); @@ -687,6 +699,12 @@ sub logInfo { $this->_log( 'info', '', @_ ); } +sub logDebug { + my $this = shift; + return unless $this->{params}->{debug}; + $this->_log( 'debug', '', @_ ); +} + sub logWarn { my $this = shift; $this->_log( 'warn', '%ORANGE% *WARNING* ', @_ ); @@ -967,8 +985,6 @@ sub _rewriteTag { # Rewrite a URL - be it internal or external. Internal URLs that point to # anything in pub, or to scripts, are always rewritten. -my $noisy = 0; - sub _processURL { my ( $this, $url ) = @_; @@ -984,13 +1000,15 @@ sub _processURL { # $url->equery # $url->frag + $this->logDebug( "Processing URL ", $url ); + if ( !defined $url->path() || length( $url->path() ) == 0 ) { - print STDERR "- no path\n" if $noisy; + $this->logDebug("- no path in "); # is there a frag? if ( $url->can('fragment') && $url->fragment ) { - print STDERR "- frag " . $url->fragment . "\n" if $noisy; + $this->logDebug( "- frag " . $url->fragment ); return '#' . $url->fragment(); } @@ -1010,7 +1028,7 @@ sub _processURL { sub _match { my ( $abs, $url, $match ) = @_; - print STDERR "Test $url against $match\n" if $noisy; + $this->logDebug("Test $url against $match"); # Some older parsers used to allow the scheme name to be present # in the relative URL if it was the same as the base URL @@ -1019,54 +1037,53 @@ sub _processURL { if ( $match->can('scheme') && $match->scheme ) { if ( $url->can('scheme') ) { unless ( _matchPart( $url->scheme, $match->scheme ) ) { - print STDERR "- scheme mismatch " - . $url->scheme . " and " - . $match->scheme . "\n" - if $noisy; + $this->logDebug( "- scheme mismatch " + . $url->scheme . " and " + . $match->scheme ); return undef; } } else { - print STDERR "- no scheme on url\n" if $noisy; + $this->logDebug("- no scheme on url"); return undef; } } elsif ( $url->can('scheme') && $url->scheme ) { - print STDERR "- no scheme on match\n" if $noisy; + $this->logDebug("- no scheme on match"); return undef; } if ( $match->can('host') && $match->host ) { if ( $url->can('host') ) { unless ( _matchPart( $url->host, $match->host ) ) { - print STDERR "- host mismatch\n" if $noisy; + $this->logDebug("- host mismatch"); return undef; } } else { - print STDERR "- no host on url\n" if $noisy; + $this->logDebug("- no host on url"); return undef; } } elsif ( $url->can('host') && $url->host ) { - print STDERR "- no host on match\n" if $noisy; + $this->logDebug("- no host on match"); return undef; } if ( $match->can('port') && length( $match->port ) ) { if ( $url->can('port') ) { unless ( _matchPart( $url->port, $match->port ) ) { - print STDERR "- port mismatch\n" if $noisy; + $this->logDebug("- port mismatch"); return undef; } } else { - print STDERR "- no port on url\n" if $noisy; + $this->logDebug("- no port on url"); return undef; } } elsif ( $url->can('port') && length( $url->port ) ) { - print STDERR "- no port on match\n" if $noisy; + $this->logDebug("- no port on match"); return undef; } @@ -1079,16 +1096,16 @@ sub _processURL { || $mpath[0] eq 'SCRIPT' ) ) { - print STDERR "- trim $upath[0] match $mpath[0]\n" if $noisy; + $this->logDebug("- trim $upath[0] match $mpath[0]"); shift(@mpath); shift(@upath); } if ( $mpath[0] eq 'WEB' ) { - print STDERR "- matched " . join( '/', @upath ) . "\n" if $noisy; + $this->logDebug( "- matched " . join( '/', @upath ) ); return \@upath; } else { - print STDERR "- no match at $mpath[0]\n" if $noisy; + $this->logDebug("- no match at $mpath[0]"); return undef; } } @@ -1115,23 +1132,19 @@ sub _processURL { my ( $is_script, $is_pub, $upath ) = ( 0, 0 ); if ( $upath = _match( 1, $url, $this->{url_paths}->{pub_abs} ) ) { - print STDERR "- matched pub_abs at " . join( '/', @$upath ) . "\n" - if $noisy; + $this->logDebug( "- matched pub_abs at " . join( '/', @$upath ) ); $is_pub = 1; } elsif ( $upath = _match( 0, $url, $this->{url_paths}->{pub_rel} ) ) { - print STDERR "- matched pub_rel at " . join( '/', @$upath ) . "\n" - if $noisy; + $this->logDebug( "- matched pub_rel at " . join( '/', @$upath ) ); $is_pub = 1; } elsif ( $upath = _match( 1, $url, $this->{url_paths}->{script_abs} ) ) { - print STDERR "- matched script_abs at " . join( '/', @$upath ) . "\n" - if $noisy; + $this->logDebug( "- matched script_abs at " . join( '/', @$upath ) ); $is_script = 1; } elsif ( $upath = _match( 0, $url, $this->{url_paths}->{script_rel} ) ) { - print STDERR "- matched script_rel at " . join( '/', @$upath ) . "\n" - if $noisy; + $this->logDebug( "- matched script_rel at " . join( '/', @$upath ) ); $is_script = 1; } @@ -1168,7 +1181,7 @@ sub _processURL { $new = $this->_processExternalResource($url); } - #print STDERR "-mapped $new"; + $this->logDebug("-mapped $url to $new"); return $new; } diff --git a/templates/PublishPlugin.tmpl b/templates/PublishPlugin.tmpl new file mode 100644 index 0000000..fef7b61 --- /dev/null +++ b/templates/PublishPlugin.tmpl @@ -0,0 +1,25 @@ +%TMPL:DEF{"PublishPlugin:redirect"}% + + + + + %HEAD% + + + %BODY% + + +%TMPL:END% +%TMPL:DEF{"PublishPlugin:sitemap_url"}% +%URL% +%TMPL:END% +%TMPL:DEF{"PublishPlugin:sitemap"}% + + + %URLS% + +%TMPL:END% +%TMPL:DEF{"PublishPlugin:googlefile"}% +%FILE%Google verification +%TMPL:END% \ No newline at end of file