PmWiki

Page File Format

You may have many documents that you would like to use a local program to format in a format Pm Wiki can display.

You could open each document and copy/paste the content to new pmwiki pages or you could format the document in advance and upload it using a FTP client.

Only two lines are necessary in a Pm Wiki page file:

version=pmwiki-2.1.0 urlencoded=1
text=Markup text

"version=" tells Pm Wiki that the values are urlencoded. The actual value doesn't matter, as long as "urlencoded=1" appears somewhere in the line.

"text=" needs to have the markup text with newlines converted to "%0a" and percent signs converted to "%25".

In addition, Pm Wiki writes pages with '<' encoded as "%3c" (to help with security), but it doesn't require that <'s be encoded that way in order to be able to read the page. More conversions are possible to be added in the future.

In order to let the (:pagelist :) markup work, make sure the filename begins with an uppercase letter.

In order to have the (:pagelist link= ... :) markup on other pages list this page, a third attribute is required:

targets=GroupName1.Pagename1,GroupName2.Pagename2,...

"targets=" is a comma delimited list of all links from the current page.


Keys you could see in a raw Pm Wiki file:

version
Version of Pm Wiki used to create the file More??? (ordered, urlencoded)
agent
Author's browser when saving the page
author
Last author to save page
charset
The character encoding of the page text, may be used by future upgrades
csum
Change summary
ctime
Page creation time
host
Host created this page
name
Name of the page (e.g., Main.WikiSandbox)
rev
Number of times the page has been edited
targets
Targets for links in the page
text
The page's wiki markup
time
Time the page was last saved (seconds since 1 Jan 1970 00:00 UTC)
title
Page title set via (:title The Page Title:).
newline
Character used for newlines (deprecated)
passwdedit
encrypted version of the password
updatedto
The version to which Pm Wiki has been updated to by upgrades.php (only on SiteAdmin.Status)

Below these you will see information used to keep track of the page's revision history.

Creating a Page for Distribution

A simple way to create a wikipage file to use for distribution (for example with a recipe or a skin) is to create the page with Pm Wiki and then use a text editor to delete all lines but version, text, and ctime. Example:

version=pmwiki-2.1.0 ordered=1 urlencoded=1
text=This is a line.%0aThis is another.
ctime=1142030000

Keeping track of page history

Inside of a page file, Pm Wiki stores the latest version of the markup text, and uses this to render the page. The page history is kept as a sequence of differences between the latest version of the page and each previous version.

Pm Wiki normally puts the page history at the end of each page file in reverse chronological sequence, and sets the "ordered=1" items in the header. If an operation needs only the most recent version of a page, then Pm Wiki will stop reading and processing a page file at the point where the history begins, potentially saving a lot of time and memory. If the "ordered=1" flag isn't present, Pm Wiki makes no assumptions about the ordering of items in the pagefile and processes the entire file.

Load pages from text files

See Cookbook: Import text.

Unix utility to extract wiki text

The following unix script (tested on Mac OSX?) will extract and decode the current text from a wiki file:

#!/bin/tcsh
# wtext - extract wiki text
#
# wtext wikifile > output

set fn = "$1"
if ("$fn" == "") then
  echo "need input file parameter"
  exit 999
endif
if (! -f $fn) then
  echo "$fn does not exist"
  exit 999
endif
rm sedin.$$ >& /dev/null
set ch = `grep ^newline= $fn | cut -d= -f2`
if ("$ch" == "") set ch = "%0a"
cat <<eof > sedin.$$
s/^text=//
s/$ch/\
/g
s/%3c/</g
s/%25/%/g
eof
grep "^text=" "$1" | sed -f sedin.$$
rm sedin.$$ >& /dev/null

Observations

I had a bunch of pages incorrectly attributed to the Pm Wiki group in my instance, so being the admin I decided it would be easier to take care of this via the "backdoor". I changed the name of a bunch of files to the new group from the old, and everything seemed to work fine. I used VI to peer inside and noticed that the "name" attribute was equal to the old filenames. BE CAREFUL if you choose to edit pmwiki page content files in an editor like VI. You can lose all of your content so make sure to back everything up first! (I did)Most of my resaved files were fine, but files that had "line too long" issues in VI, clobbered all content. I did some further research and discovered that pmwiki will actually change the internal name file attributes if you just go into each page thru the pmwiki interface and Save them. No changes are necessary and the name attributes correct themselves once saved.

See also


This page may have a more recent version on pmwiki.org: PmWiki:PageFileFormat, and a talk page: PmWiki:PageFileFormat-Talk.

Agents Group

Wiki

edit SideBar

Blix theme adapted by David Gilbert, powered by PmWiki


Warning: fopen(wiki.d/.flock): failed to open stream: Permission denied in /group/cisa/web/agents/pmwiki.php on line 518

PmWiki can't process your request

Cannot acquire lockfile

We are sorry for any inconvenience.

More information

Return to https://groups.inf.ed.ac.uk/agents/index.php