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.com.
-- MichaelDaum - 20 Apr 2006
I did install the plugin and even opened up the code, but uninstalled it again in favor of the PublishContrib. I decided to fixed PublishContrib to work with the NatSkin. I did not try PublishWebPlugin using the NatSkin. I expect it to fail for the same reasons PublishContrib failed before. This is part of a more fundamental problem rebuilding the preferences cache for each topic. I don't have the time to fix that for the PublishWebPlugin also. I hope you understand, Peter.
Ehm, 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/TWiki04x01/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/TWiki04x01/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/ how it looks like.
-- WolfgangSlany - 08 Sep 2006
Wolfgang, I just browsed your site, looks nice! And thanks for the bug fixes, hope I find time soon enough to make a new release.
-- PeterThoeny - 13 Sep 2006
Forgive me for asking, but can this plugin be used to publish existing webs (and multiple webs), or only the topics in a new "Publish" web?
-- JohnDeStefano - 20 Oct 2006
You can point it to an existing web. At this time it is designed to be used in one web only; the name of that web can be configured.
-- PeterThoeny - 20 Oct 2006
Thanks; I see that now: changing the SET variable in the page changes the name of the web passed for processing. If it can ever handle multiple webs in one throw, it would be great.
-- JohnDeStefano - 20 Oct 2006
How would you solve the namespace question? Possible solution: Primary web where topic go into the htdoc root; list of other webs that go into sub-dirs below that. Would that make sense? Cross-links would need to be fixed properly.
-- PeterThoeny - 20 Oct 2006
Yeah, namespace is the big problem I am seeing as well on the publishing side with another, similar plugin: in order to get cross-Web links to work, I need to publish all Webs to a folder, then redirect any links to start from that parent folder, then back down into specific Webs. Publishing to htdocs could be one solution; what about specifying a "parent" directory, which would contain an "index" file that is nothing more than a copy of the WebHome of the Main web, with built-in logic to resolve links to the actual webs below it? Not sure if that makes sense; feel free to contact me for clarification.
-- JohnDeStefano - 23 Oct 2006
Yes, treating one topic special as the htdoc root /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