[pmwiki-users] Converting PmWiki pages to static html

Patrick R. Michaud pmichaud at pobox.com
Tue Sep 5 10:44:35 CDT 2006


On Tue, Sep 05, 2006 at 03:04:32PM +0000, Pico wrote:
> At work we used (an internal) PmWiki to draft a large document (a separate
> group, with a wikitrail and many pages).  At this point it looks like we are
> unlikely to get get permission to use PmWiki outside of our firewall due to
> concerns about being able to protect and secure a scripted program.
> 
> Is there a recipe for converting PmWiki page to static html?  (We are not
> looking at pdf, at least not now).  


First, add the HtmlUrls recipe.  In local/config.php:

    $EnablePathInfo = 1;
    $FmtP['!\\$ScriptUrl/[^?#\'"\\s<>/]+/[^?#\'"\\s<>]+!'] = '$0.html';
    $FmtPV['$PageUrl'] = 'PUE("$ScriptUrl/$group/$name.html")';

This causes all of your pages to automatically receive a '.html' extension.

Then, use a tool such as wget to download all of the pages for that
group and fix up the links.  For example:

    wget -r -k -np -p -l 0 http://example.org/wiki/SomeGroup

Here's the meaning of the options to wget:

    -r    Recursive retrieval.  Wget will follow any links it finds in
          the document

    -k    Link adjustment.  After retrieving the pages, wget will convert
          all of the downloaded files to have relative links instead
          of absolute ones.

    -np   No parent.  Wget will restrict itself to the path
          given on the command line (in the above case, it would
          only download the pages of SomeGroup).

    -p    Prerequisites.  Wget will retrieve local copies of any .css
          files or gif images needed to display the static copy of the
          page locally.

    -l 0  Infinite follow.  Wget will follow all of the links it encounters
          (subject to the -np restriction above), so that it will completely
          spider the group.

I've only done a minimal test of this, but it seems to work pretty well.

Pm





More information about the pmwiki-users mailing list