Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

AdminByShell

Summary: A collection of ways to assist sysadmin of pmwiki using shell tools
Version:
Prerequisites:
Status:
Maintainer: Peter Bowers

Questions answered by this recipe

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer. How can I use linux shell tools to examine, search, and otherwise process PMWiki pages?

Description

Various ways to use linux shell tools to process wiki pages

Notes

Running arbitrary shell commands on pages (security based on root-controlled /usr/local/bin location of scripts):
(:shellout cmd=customcommand args="some arguments":)
see http://article.gmane.org/gmane.comp.web.wiki.pmwiki.user/48570
see http://article.gmane.org/gmane.comp.web.wiki.pmwiki.user/48603

Finding a list of all categories:
See http://article.gmane.org/gmane.comp.web.wiki.pmwiki.user/48030

Converting wiki pages to text files for further processing:
WIKID_DIR=/var/www/html/pmwiki/wiki.d
TEXTDIR=/var/www/html/pmwiki/export
cd "$WIKID_DIR"
for i in "$@"
do
	grep '^text=' "$i" | sed -e 's/^text=//' -e 's/%0a/\n/g' -e 's/%25/%/g' >${TEXTDIR}/${i}.txt
done

Converting wiki pages to text files for external processing:
* Install Cookbook:WikiSh recipe and run the command {(cp page [...] TEXTFILE--dirname)}. "TEXTFILE--" is a special prefix to make it use text files rather than pages in its operations. You must give it appropriate permissions via $Enable... as well as having an existing directory to write to. Note that directories are relative from the pmwiki root rather than the wiki.d directory.

Converting from text files back to wiki pages:
See ImportText -- just copy the text files into the import directory

Converting from text files back to wiki pages without the Import (assuming existing pages):
May work. May not. Feel free to update this if you fix it. You should really use ImportText.
Attach: Text2Wiki.txtΔ (It's a perl script but has to be named with an uploadable extension, thus the .txt)

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also

PageFileFormat (includes an alternate shell script to access text from command line)

Contributors

Several of the code examples come from Chris Cox thru pmwiki-users posts. See related links to those posts.

Comments

Edit - History - Print - Recent Changes - Search
Page last modified on July 05, 2008, at 09:11 AM