wget http://example.com/view/Publish/WebPublish?action=publish;ptopic=Topic_Name
%PUBLISHWEB{"publish" topic="Name"}% feature to re-publish topics on demand
%PUBLISHWEB{}% variable. (I fell into this trap already with the BlackListPlugin)
During save of TWiki.PublishWebPlugin an error was found by the version control system. Please notify your TWiki administrator. =RCS: /usr/bin/rcs -q -l %FILENAME|F% failed: =Is this plugin related to you think or twiki related? I'm trying this on a fresh install of twiki 4.0.1. Thanks! -- JeffLink - 27 Feb 2006 Most probably a file permission issue. Make sure that the webserver user can write to the .txt and .txt,v files. Also check the rcs lock user, should be same webserver user or unlocked for TWiki 4.0. -- PeterThoeny - 27 Feb 2006 And in reply to myself... with Peter's guidance... needed to change "webuser" to the user that owned the file in the
PublishWebPlugin.txt,v file.
-- JeffLink - 27 Feb 2006
TOC does not seem to be converting to file.html anchor. TOC links are linking to the bin/view/etc... reference.
Also... I have twiki installed on the public_html folder. so domain.com/pub is the pub dir. I have the hardcode path to the published html files to domain.com/kb/ ($publishPath = "../kb";). When using using the breadcrumb, the links are domain.com/file.html not domain.com/kb/file.html. Do I have some setting wrong? Thanks in advance!
-- JeffLink - 28 Feb 2006
Peter, If you put some kind of authorisation option (workflow) into the publish process, you're very close to a "real" CMS.
-- MarcusLeonard - 01 Mar 2006
Thanks Peter: it help us make a "PermaLink" on old content without complex rewriting configuration.
but I meet the same subdir publishing problem like Jeff Link: if you pubish docs into a non root directory(like "/foo/"): the page.html links ot other topic(Bar) is still to root "/bar.html"
Should we define a $destPublishDir?
Also... I have twiki installed on the public_html folder. so domain.com/pub is the pub dir. I have the hardcode path to the published html files to domain.com/kb/ ($publishPath = "../kb";). When using using the breadcrumb, the links are domain.com/file.html not domain.com/kb/file.html. Do I have some setting wrong? Thanks in advance!
-- CheDong - 05 Mar 2006
OK, there is clearly a need for a destination URL other than the root.
-- PeterThoeny - 05 Mar 2006
Potential bug in attachment link described in Support.PublishWebPluginAttachmentLinks.
print feedback). But that's pretty much all afaics. You can implement any usability policy you like in the plugin part but use publish services in a shared library.
And -- pardon me -- I will reestablish my votes on PublishWebPluginAppraisal.
The results of the current PublishContrib output can be seen at http://www.wikiring.comEhm, not quite correct: PublishWebPlugin uses STARTPUBLISH....STOPPUBLISH whereas PublishContrib uses <nopublish> ... </nopublish>. Kind of same idea done differently. Both makes sense. -- MichaelDaum - 20 Apr 2006PublishContrib was formerly limited to zipfile output, though thanks to recent support for improvements from clients, it now supports plain html publishing, as well as tgz, zip, pdf and postscript output formats. FYI, note that the PublishContrib has always been able to run in a batch mode (it uses a "publishing topic" to control the batch publishing process). The documentation on this use mode is poor, however. Peter could have kept PublishWebPlugin internal for his own use; instead he chose to publish it for the benefit of the community, despite the obvious overlaps. Rather than criticising, we should all welcome any work that seeks to improve on existing technologies! -- CrawfordCurrie - 20 Apr 2006 I do welcome the plugin. I even stopped to wonder the contrib was not called a plugin. It always saddens me when we do exploration when the concepts are stable enough that we should be doing consolidation. Without ExplorationThenConsolidation there is not requisite variety to keep innovating or not sufficient sanity to keep the community efforts from disapating chasing all the offshoots. Had the plugin been issued by someone on the periphery of development I'd have been less disappointed. I'd still now be pushing for consolidation though. Let's focus on the go-forward actions. -- MartinCleaver - 20 Apr 2006 Thanks Crawford for putting things into the right perspective. Again, I am not here to compete, I am here for sharing ideas, code, docs with the TWikiCommunity. There is no one size fits all. I am glad that Micha found a solution that fits his needs. Although I must admit his shift in opinion took me by surprise: At the beginning a very positive e-mail on this Plugin, and now a very negative appraisal. I removed Martin's appraisal again since he did not actually install this Plugin and since his opinion is stated on this dev topic. -- PeterThoeny - 20 Apr 2006 Peter, certainly I am all positive about every contribution. But after evaluating both publish solutions, looking up the code and testing it with the NatSkin I had to revise my initial ratings. That's normal. -- MichaelDaum - 21 Apr 2006 For whatever the feedback is worth: I just considered PublishContrib and PublishWebPlugin and wound up going with PublishContrib for now for the following reasons:
--- lib/TWiki/Plugins/PublishWebPlugin.pm Wed Feb 15 15:55:40 2006
+++ PublishWebPlugin.pm Sat May 6 19:02:29 2006
@@ -258,7 +258,7 @@
# 'file': '/file/path/to/topic_name.html'
# 'label': 'Topic Name'
my $text = lc( $topic ) . '.html';
- $text =~ s/[^a-z_\.]+//go;
+ $text =~ s/[^a-z0-9_\.]+//go;
$text =~ /(.*)/;
$text = $1; # untaint
if( $type eq 'url' ) {
This is from the current version of the plugin (DL'd today)
-- JasonPeacock - 06 May 2006
Also, when first installed and used, the plugin generates RCS errors b/c the ,v files have a different user associated with them. Maybe it would be better to not include the ,v files in the distribution? Or is there a different way to fix that problem - I notice that all other ,v files in the TWiki distro don't have that problem. (I'm not an RCS expert...)
-- JasonPeacock - 06 May 2006
Thanks for the bug report, I'll incude the fix in the next release.
On ,v files, topics are in Cairo format (mostly compatible with Dakar). Cairo's ,v files have locks, Dakar not. You get the issue described in Dakar. A proper fix is to make Dakar more forgiving to locks, e.g. fully support Cairo files.
-- PeterThoeny - 07 May 2006
See KeepRcsFilesUnlocked for a discussion of this. Apparently there are both issues with conflicting users and performance costs. I'm sure CDot can discuss this more thoroughly, however.
-- MeredithLesly - 07 May 2006
here there is a patch to get publish url out of root website
in TWiki/PublishWebPlugin
--- lib/TWiki/Plugins/PublishWebPlugin.pm 2006-02-15 17:55:40.000000000 -0300
+++ ../lib/TWiki/Plugins/PublishWebPlugin.pm 2006-05-10 02:26:10.000000000 -0300
@@ -72,6 +72,7 @@
$excludeTopic =~ s/,\s*/\|/go;
$excludeTopic = '(' . $excludeTopic . ')';
$homeLabel = TWiki::Func::getPluginPreferencesValue( "HOMELABEL" ) || "Home";
+ $publishUrl = TWiki::Func::getPluginPreferencesValue( "PUBLISHURL" ) || "";
$initialized = 1;
}
@@ -158,7 +159,7 @@
$error = "Error: Can't copy $from $to ($!)";
TWiki::Func::writeWarning( "- ${pluginName}: $error\n" );
}
- return "/$attachPath/$file";
+ return "$publishUrl/$attachPath/$file";
}
# =========================
@@ -262,7 +263,7 @@
$text =~ /(.*)/;
$text = $1; # untaint
if( $type eq 'url' ) {
- $text = '/' . $text;
+ $text = $publishUrl. '/' . $text;
} elsif( $type eq 'file' ) {
$text = $publishDir . '/' . $text;
} elsif( $type eq 'label' ) {
-- DanielGrana - 10 May 2006
and here a patch to make lowercase a setting, but keeping lowercase as default behaivor. Plugin setting in TWiki/PublishWebPlugin
--- old/lib/TWiki/Plugins/PublishWebPlugin.pm 2006-02-15 17:55:40.000000000 -0300
+++ new/lib/TWiki/Plugins/PublishWebPlugin.pm 2006-05-10 05:21:55.501896750 -0300
@@ -72,6 +72,7 @@
$excludeTopic =~ s/,\s*/\|/go;
$excludeTopic = '(' . $excludeTopic . ')';
$homeLabel = TWiki::Func::getPluginPreferencesValue( "HOMELABEL" ) || "Home";
+ $keepCase = TWiki::Func::getPluginPreferencesValue( "KEEPCASE" );
$initialized = 1;
}
@@ -257,8 +258,9 @@
# 'url': '/topic_name.html'
# 'file': '/file/path/to/topic_name.html'
# 'label': 'Topic Name'
- my $text = lc( $topic ) . '.html';
- $text =~ s/[^a-z_\.]+//go;
+ my $text = $topic . '.html';
+ $text = lc( $text ) unless $keepCase;
+ $text =~ s/[^a-zA-Z0-9_\.]+//go;
$text =~ /(.*)/;
$text = $1; # untaint
if( $type eq 'url' ) {
-- DanielGrana - 10 May 2006
This patch fix TOC render bug (code from PublishContrib)
--- old/lib/TWiki/Plugins/PublishWebPlugin.pm 2006-05-10 06:05:01.726585492 -0300
+++ new/lib/TWiki/Plugins/PublishWebPlugin.pm 2006-05-10 07:31:46.164543831 -0300
@@ -134,6 +136,10 @@
$tmpl =~ s/($pubUrl)\/([^'" ]+)/&fixAndCopyAttachments($1, $2, $pubDir )/geo;
$tmpl =~ s/<\/?(nop|noautolink)\/?>\n?//gois;
+ # fix links to dinamics twiki topics (from PublishContrib)
+ my $ilt = '(?:http://localhost)?' . $TWiki::dispScriptUrlPath . $TWiki::dispViewPath . $TWiki::scriptSuffix;
+ $tmpl =~ s!(href=["'])$ilt/$web/(\w+)!"$1".&buildName($2,'url')!geo;
+
my $name = buildName( $topic, 'file' );
writeDebug( "publishTopic, saving file $name using $publishSkin skin" );
TWiki::Func::saveFile( $name, $tmpl );
-- DanielGrana - 10 May 2006
Thanks Daniel for the fixes, I will take them into the next release.
-- PeterThoeny - 11 May 2006
The fix did not work in our setting. Reason was that $TWiki::dispScriptUrlPath . $TWiki::dispViewPath . $TWiki::scriptSuffix was empty.
To still make it run, we hacked the code as follows:
... + # fix links to dynamics twiki topics (from PublishContrib) + #my $ilt = '(?:http://localhost)?' . $TWiki::dispScriptUrlPath . $TWiki::dispViewPath . $TWiki::scriptSuffix; + $tmpl =~ s!(href=["'])/wiki/bin/view/$web/(\w+)!"$1".&buildName($2,'url')!geo; ...-- WolfgangSlany - 08 Sep 2006
%PUBLISHWEB{"nicetopic"}% in the skin seems not to work with wikinames (it wrongly points to the internal wiki page). However, it works fine with Such_Page_Names
/p/pub/TWiki06x01/PatternSkin/TWiki_header.gif is used from the TWiki web when republishing all pages via the form on the TWiki.PublishWebPlugin page, however, when saving individual pages in the publish web, the /p/pub/TWiki06x01/PatternSkin/TWiki_header.gif of the Publish web is used. In the pattern skin, these two are by default different (TWiki Web with people and robot, Publish Web without).
Publish.WebPublish topic to re-publish all topics; the latest TWiki.PublishWebPlugin topic has no longer a publish form. -- PeterThoeny - 22 May 2006
smiley at the end of a page without anything after it works fine in the wiki view, but is shown as :-) in the published version. Putting a space or newline behind works also for the published version.
Somecompany GmbH
will be rendered OK in the internal wiki view, but in the published version there will be a question mark to edit http://www.somecompany.com/wiki/bin/edit/Publish/GmbH?topicparent=TWiki.PublishWebPlugin next to GmbH. Escaping GmbH with a leading ! solves the problem.
Set NOAUTOLINK = on in WebPreferences). -- PeterThoeny - 22 May 2006
---+ Title line at the beginning of a page will not be translated correctly in the published version (it is OK in the wiki view). Solution: Put a line containing a single space before the ---+ Title line.
data/debug.txt (for every view at least 9 lines... why does it log "view" commands from non-publish webs at all? This seems very inefficient). Here are some sample lines from my data/debug.txt file (Main is not the Web that is published):
| 22 May 2006 - 22:45 | - PublishWebPlugin: initPlugin( Main.WebHome ) is OK | 22 May 2006 - 22:45 | - PublishWebPlugin: commonTagsHandler( Main.WebHome ) | 22 May 2006 - 22:45 | - PublishWebPlugin: commonTagsHandler( Main.WebHome ) | 22 May 2006 - 22:45 | - PublishWebPlugin: commonTagsHandler( TWiki.WebLeftBarWebsList ) | 22 May 2006 - 22:45 | - PublishWebPlugin: commonTagsHandler( Main.WebLeftBar ) | 22 May 2006 - 22:45 | - PublishWebPlugin: commonTagsHandler( TWiki.LanguageSelector ) | 22 May 2006 - 22:45 | - PublishWebPlugin: commonTagsHandler( TWiki.WebTopBar ) | 22 May 2006 - 22:45 | - PublishWebPlugin: commonTagsHandler( TWiki.WebBottomBar ) | 22 May 2006 - 22:45 | - PublishWebPlugin: commonTagsHandler( Main.WebHome )Any help?
data/debug.txt is getting totally blown up
debug=1; line in initPlugin function. This Plugin runs on Cairo and Dakar; it could be made more efficient with conditional code. -- PeterThoeny - 22 May 2006
data/warnXXXXXX.txt:
| 22 May 2006 - 22:54 | (TWiki::Plugins::PublishWebPlugin) - PublishWebPlugin: Error: Can't copy /netshares/www/wikis-new/pub/TWiki/PreviewBackground/preview2bg.gif);
}
</style>
<style /netshares/www/wikis-new/pub/Publish/htdocs/_attach/preview2bg.gif);
}
</style>
<style (No such file or directory)
Note that the file is there and has the right permissions, though I had to copy it myself (and sic!, the last line does not have a closing >).
style="background-image: url(%PUBURL%/TWiki/MySkin/mygrid.gif);". To fix, change a line in the publisTopic function to: (change indicated in red) $tmpl =~ s/($pubUrl)\/([^\)'" ]+)/&fixAndCopyAttachments($1, $2, $pubDir )/geo; use strict; pragma to this plugin. Its use is important to ensure the quality of TWiki plugins, enables catching certain errors, and helps to avoid unpleasant surprises. See UseStrict for more.
-- MeredithLesly - 02 Jul 2006
Concerning: Introduce subdirectories for the attachments to avoid namespace issues (but that would reveil the TWiki web structure) from top of the page. This became urgent for us as more users started to make attachments with rather generic names and unaware of attachments of others, so I had to do the following workaround:
*** 157,171 ****
my $link = "/$attachPath/$path";
my $file = $path;
$file =~ s/.*\///;
my $from = "$pubDir/$path";
! my $to = "$attachDir/$file";
# writeDebug( "fixAndCopyAttachments, copying attachment from $from to $to" );
use File::Copy;
unless( copy( $from, $to ) ) {
$error = "Error: Can't copy $from $to ($!)";
TWiki::Func::writeWarning( "- ${pluginName}: $error\n" );
}
! return "$publishUrl/$attachPath/$file";
}
# =========================
--- 158,198 ----
my $link = "/$attachPath/$path";
my $file = $path;
$file =~ s/.*\///;
+ my $web = $path;
+ $web =~ s!/.*/.*!!;
+ my $topic = $path;
+ $topic =~ s!.*/(.*)/.*!$1!;
my $from = "$pubDir/$path";
! my $to = "$attachDir/$path";
! # my $to = "$attachDir/$file";
# writeDebug( "fixAndCopyAttachments, copying attachment from $from to $to" );
use File::Copy;
+ my $attachDirWeb = "$attachDir/$web";
+ if (-e $attachDirWeb ) {
+ writeDebug( "dir $attachDirWeb already exists.\n\n");
+ } else {
+ writeDebug( "dir $attachDirWeb will be created.\n\n");
+ unless( mkdir( $attachDirWeb, 0775 ) ) {
+ $error = "Error: Can't create $attachDirWeb ($!)";
+ TWiki::Func::writeWarning( "- ${pluginName}: $error\n" );
+ }
+ }
+ my $attachDirWebTopic = "$attachDirWeb/$topic";
+ if (-e $attachDirWebTopic ) {
+ writeDebug( "dir $attachDirWebTopic already exists.\n\n")
+ } else {
+ writeDebug( "dir $attachDirWebTopic will be created.\n\n");
+ unless( mkdir( $attachDirWebTopic, 0775 ) ) {
+ $error = "Error: Can't create $attachDirWebTopic ($!)";
+ TWiki::Func::writeWarning( "- ${pluginName}: $error\n" );
+ }
+ }
unless( copy( $from, $to ) ) {
$error = "Error: Can't copy $from $to ($!)";
TWiki::Func::writeWarning( "- ${pluginName}: $error\n" );
}
! return "$publishUrl/$attachPath/$path";
! # return "$publishUrl/$attachPath/$file";
}
The urls look a bit weird but that's still better than having the cv of another person on one's hompage. You can see on our site http://www.ist.tugraz.at//index.html would be an alternative solution. Although I prefer to have standard web pages in the htdoc root, such as /about.html, /services.html etc.
-- PeterThoeny - 23 Oct 2006
Understood and agreed; but then how would you attack the issue? I'm not sure how else to resolve the top-level issue in cross-Web linking, since all Webs are "flat", so to speak.
-- JohnDeStefano - 23 Oct 2006
Option 1: Treat one web as top level, and a set of other webs (on same top level on TWiki) as sub dirs under htdoc root. Links between webs need to be fixed properly when publishing content. Example structure:
| TWiki web structure | Htdoc structure |
|---|---|
| • Publish • Marketing • Products |
/*.html /marketing/*.html /products/*.html |
| TWiki web structure | Htdoc structure |
|---|---|
| • Publish • Marketing • Products |
/*.html /marketing/*.html /products/*.html |
However, I think Option 2 makes the most sense and better reflects the structure of an actual, usable heirarchy.
-- JohnDeStefano - 24 Oct 2006
Would it be possible to see any approved code (or cumulative patches) that would enable the plugin to publish without having it convert the web and topic names to lowercase? I see discussion and some code about this earlier in this topic, but not sure what's safe or optimal to implement.
-- JohnDeStefano - 28 Nov 2006
Personally I do not have a need for this, but it could certainly be implemented (with a setting to disable the lowercase conversion.) We can add this if someone brings a patch that works on Cairo and TWiki 4 (including documentation.)
-- PeterThoeny - 29 Nov 2006
We're looking at using TWiki internally to develop our procedure manual. For this reason, it would be great that this plugin be interfaced with WorkflowPlugin so that we can publish pages only once they have been approved. We need to have two versions of our internal procedures, one which is under development (on the wiki server) and one which has been approved and currently under application (maybe on a different wiki web).
-- DenisBallant - 07 Mar 2007
For a page using ImagePlugin, I get different results depending on whether the static page is published during a save cycle (which works) or the publish web cycle. The publish web cycle does not have the linked in style sheet for the ImagePlugin which would indicate to me (a novice) that perhaps the ImagePlugin did not execute it's initPlugin. Any suggestions?
-- RichardBeaver - 06 Dec 2007
It may be a hack, but I was able to solve my problem by making the following changes to the ImagePlugin commonTagsHandler (lines with RB):
###############################################################################
# only used to insert the link style
sub commonTagsHandler {
# RB return if $doneHeader;
return if ($_[0] =~ /<head>[^\n]*$imgStyle/ ); # RB
if ($_[0] =~ s/<head>(.*?[\r\n]+)/<head>$1$imgStyle\n/o) {
$doneHeader = 1;
}
}
###############################################################################
-- RichardBeaver - 07 Dec 2007
Can we please have the settings in a spec file instead of in the pm file? The current way will loose all configurations with a plugin update.
-- ArthurClemens - 21 Feb 2008
Doc update needed: Search engines prefer dashes over underscores, http://www.mattcutts.com/blog/dashes-vs-underscores/About-us instead of Acout_us.
-- PeterThoeny - 2010-10-05
It would be nice if the user could configure whether they want the publish to happen on every save or just on demand, as in the PublishContrib.
An extensive generation of content from a dynamic topic could be time consuming and not be desirable during the edit/save cycle.
Further, one might not want to publish everytime one makes a change, depending on the purpose of the published site.
-- ThomasWeigert - 2011-11-27
This could be done with a new configure setting.
On need to no publishing before content is ready, at work we actually publish first automatically to a staging area with the PublishWebPlugin, then to sync to the corporate website using rsync (used in a CGI script that is called via a browser link). This approach has the advantage that one can make changes to many topics and push out the changes after review.
-- PeterThoeny - 2011-11-27
Published file name not support UTF-8, how can i fix it ? thx!
-- LiamChou - 2011-11-29
This plugin has not been tested for UTF-8 support. TWiki is open source, where everybody is invited to take and contribute. I invite you to get involved and send a patch. Alternatively you can hire a consultant to do that for you.
-- PeterThoeny - 2011-11-29
So back in 2006 Peter asked if anyone needed support for publishing multiple webs. Well, I do, so I wrote a patch to that end. It creates a new boolean config variable, AppendWebnameToPath (defaults to off), which if set appends the web name to the publishdir and attachdir. Like always, you still need manually create those dirs and chown them to the webserver user.
--- lib/TWiki/Plugins/PublishWebPlugin/Config.spec.dist 2012-03-02 10:48:12.103829568 -0600
+++ lib/TWiki/Plugins/PublishWebPlugin/Config.spec 2012-03-01 16:52:26.683852378 -0600
@@ -30,4 +30,7 @@
# URL path that corresponds to <code>{PublishPath}</code> directory. Leave
# empty if it is the HTML document root.
$TWiki::cfg{Plugins}{PublishWebPlugin}{PublishUrlPath} = '';
+# **BOOLEAN**
+# Append the webname to PublishPath and AttachPath
+$TWiki::cfg{Plugins}{PublishWebPlugin}{AppendWebnameToPath} = 0;
1;
--- lib/TWiki/Plugins/PublishWebPlugin.pm.dist 2012-03-01 16:27:14.575903461 -0600
+++ lib/TWiki/Plugins/PublishWebPlugin.pm 2012-03-01 16:49:09.551896845 -0600
@@ -44,6 +44,7 @@
my $publishDir;
my $attachDir;
my $publishUrlPath;
+my $appendWebnameToPath = 0;
# template path for skin file; empty for twiki/templates; must be absolute path if specified
$templatePath = $TWiki::cfg{Plugins}{PublishWebPlugin}{TemplatePath} || "";
@@ -57,6 +58,9 @@
# URL path corresponding to $publishPath
$publishUrlPath = $TWiki::cfg{Plugins}{PublishWebPlugin}{PublishUrlPath} || "";
+# if set to true, append the web name to publishPath and attachPath
+$appendWebnameToPath = $TWiki::cfg{Plugins}{PublishWebPlugin}{AppendWebnameToPath} || 0;
+
# =========================
sub initPlugin
{
@@ -73,6 +77,12 @@
# Get plugin debug flag
$debug = TWiki::Func::getPluginPreferencesFlag( "DEBUG" );
+ # append web name to path?
+ if( $appendWebnameToPath == 1 ) {
+ $publishPath = $publishPath . '/' . $web;
+ $attachPath = $attachPath . '/' . $web;
+ }
+
writeDebug( "initPlugin( $web.$topic ) is OK" );
$initialized = 0;
$error = "";
I'd love to see this pulled back into the main plugin, if there is anything I can do to improve the odds of that let me know. Thanks.
-- JohnVestrum - 2012-03-02
Thank you John for supporting the TWiki open source project! This is a good enhancement. I'll take that into the next release. I'd like to make two small changes. Explained and tracked at TWikibug:Item6856{AppendWebnameToPath} setting, all path settings now accept these new variables: %WEB% - name of publish web
%LCWEB% - name of publish web, lower case version
%SKIN% - name of publish skin
xyz.com as an example:
Set PUBLISHWEBPLUGIN_PUBLISHSKIN = xyz.com
$TWiki::cfg{Plugins}{PublishWebPlugin}{PublishPath} = "/var/www/vhosts/%SKIN%/html";
$TWiki::cfg{Plugins}{PublishWebPlugin}{TemplatePath} = '/var/www/vhosts/%SKIN%/html/_skin';
xyz.com is now used by the publish process to point the proper virtual host at /var/www/vhosts/xyz.com. The skin file is located at /var/www/vhosts/xyz.com/html/_skin/xyz.com.html.
-- PeterThoeny - 2012-03-05
I made a couple changes to my copy of the plugin, to support (1) https links and (2) anchor links (mypage#myparagraph) within double square brackets. Here's the diff, in case there is any interest in pulling it back in.
--- PublishWebPlugin.pm 2012-06-12 15:40:26.000000000 -0500
+++ /home/msi/vestrum/PublishWebPlugin.pm 2012-10-04 09:37:16.234280000 -0500
@@ -259,7 +259,7 @@
sub handleLink
{
my ( $link, $label ) = @_;
- if( $link =~ /^(http|ftp)\:/ ) {
+ if( $link =~ /^(http|https|ftp)\:/ ) {
return "<a href=\"$link\">$label</a>";
} elsif( $link eq $label ) {
return '<a href="'
@@ -358,11 +358,16 @@
# 'label': 'Topic Name'
# 'publishurlpath': {Plugins}{PublishWebPlugin}{PublishUrlPath} configure setting
my $text = lc( $topic ) . '.html';
- $text =~ s/[^a-z0-9_\-\.]+//go;
+ $text =~ s/[^a-z0-9_\#\-\.]+//go;
$text =~ /(.*)/;
$text = $1; # untaint
if( $type eq 'url' ) {
- # keep text as is (relative URL)
+ # handle anchors
+ if( $topic =~ /\#/ ) {
+ my $anchor = lc( $topic );
+ $anchor =~ /^([^\#]+)(\#.*)$/;
+ $text = $1 . '.html' . $2;
+ }
} elsif( $type eq 'file' ) {
$text = $publishDir . '/' . $text;
} elsif( $type eq 'label' ) {
-- JohnVestrum - 2012-10-04
I'm glad to see activity in this thread again, after a haitus of several years, and encouraged at the improvements being made. But I'm a bit confused by the motivation: I'm already publishing multiple webs using the prior version of the plugin, albeit with a small bash script and some Apache regexp hacks. Perhaps this new version obviates the need to manipulate Apache requests to published webs?
-- JohnDeStefano - 2012-10-05
Comments: How to uninstall an existing plugin from TWiki Server ?
We have installed this PublishWebPlugin but unable to publish now using the same. Error when trying to publish is: " TWiki detected an internal error - please check your TWiki logs and webserver logs for more information. Can't create file path - No such file or directory" So we are trying to uninstall this PublishWebPlugin now.
-- NivethithaAnnamalainathan - 2012-11-23
Nivethitha, read the TWikiPlugins documentation on how to enable/disable plugins.
-- PeterThoeny - 2012-11-24
We installed PublishWebPlugin in our server and also we were able to publish the contents as HTML pages before but now we are unable to publish.
Getting the following error " TWiki detected an internal error - please check your TWiki logs and webserver logs for more information. Can't create file path - No such file or directory".
We dont want to disable the plugin from configure page, we have to uninstall the plugin from the server by removing all the PublishWebPlugin related files from the backend.
-- NivethithaAnnamalainathan - 2012-11-27
Nivethitha, please take the time to RTFM. Disabling the plugin will solve the issue. If you want to remove the files look at the file list of PublishWebPlugin.zip indicated in PublishWebPlugin and remove those files in your TWiki installation.
-- PeterThoeny - 2012-11-28
Hi, I'm trying to use the HistoryPlugin with the PublishWebPlugin but the publish activity is ignoring the %HISTORY% variable. Is this a quick fix? Thanks.
-- %HISTORY% variable, so it should get expanded in the PublishWebPlugin, but there is also a template file, and I am not sure about that.
--
sub handleLink
{
my ( $link, $label ) = @_;
if( $link =~ /^(https?|ftp)\:/ ) {
return "<a href=\"$link\">$label</a>";
}
my $url = '';
my ($name, $anchor) = split(/#/,$link);
if ($name ne '') {
$url = buildName($name,'url');
}
if ($anchor ne '') {
$url .= "#$anchor";
}
if( $link eq $label ) {
return '<a href="' . $url . '">' . buildName( $link, 'label' ) . '</a>';
} else {
return "<a href=\"$url\">$label</a>";
}
}
--
$tmpl =~ s/( href=['"])$viewWebUrl([^'"])*/$1 . buildName( $2, 'url' )/ge;
in publishTopic with:
my $viewPathUrl = $viewWebUrl;
$viewPathUrl =~ s/http[s]?:\/\/[^\/]*//;
$tmpl =~ s/<a\s*?href\s*?=\s*?['"].*?$viewPathUrl([^'"]*).*?>(.*?)<\s*?\/a>/handleLink($1,$2)/ige;
Also, the following code to remove the URL parameters needs to be moved up to execute before this section (which is commented as "fix page links"):
# remove URL parameters to make TOC and other TWiki internal links work
$tmpl =~ s/(<a href=[\"\'][A-Za-z0-9_\-\/]*)\?[^\#\"\']*/$1/gos;
--