University of Natural Resources and Life Sciences (BOKU)
Institute of Computational Biology

internal package Foswiki::Plugins::ImportExportPlugin::Filters

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

On this page:

internal package Foswiki::Plugins::ImportExportPlugin::Filters

filters for importing

TODO( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) -> ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

TODO: need to add the following filters
  • html - convert a set of html files to foswiki format, need a remove_prefix, remove_postfix, html2tml,
  • rename webs - list of from -> to conversions, including some mechanism to merge webs together (drop dups, merge dupes, rename second dup..)
  • skipdistrotopics - work out what topics are unmodified by wiki users (ie, shipped in the release) and skip those that were from the old (or twiki) release
  • check / fix up attachments - ./rest /UpdateAttachmentsPlugin/update -topic Web
  • initialise Tags (given a tag, tag that topic if the topic contains the tag word) -
    • my $cmd = "grep '\\-\\-\\-+' ../data/$params{web}/*.txt | grep -s $tag | sed 's/..\\/data\\/$params{web}\\//.\\/rest \\/TagMePlugin\\/addTag tag=$tag webtopic=$params{web}./' | sed 's/.txt.*//' | sh";

ClassMethod nothing( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) → ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

does nothing - copy to create a new filter.

ClassMethod text_regex( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) → ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

runs a regex over the topic text (only)

uses 2 params, separated by a ; eg:
  • text_regex(TWiki;Wiki)

  • chkLinks - check for URLs and wiki links, report on them with frequency, broken link, missing topic, html links to in-wiki topics
    • TODO: plus a 'fixup' option smile

ClassMethod skiptopics( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) → ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

  • skiptopics - Skip topics named in list - used to skip this plugin's check reports when checking

ClassMethod selecttopics( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) → ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

  • selecttopics - Skip topics other than those named in list

ClassMethod userweb( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) → ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

  • userweb(fromwikitype;fromwebname) - used to import a USERWEB (Main by default) from a potentially old installation to this wiki (hardcoded to import to Main web atm)
    • fromwebtype - twiki or foswiki (default to foswiki)
    • userwebname - webname to import users from (defaults to Main)
  • uses the TCP hash to convert topic names from twiki to foswiki
  • assumes TopicuserMapping
  • TODO: should really try to deal with htpasswd file too?

ClassMethod selectwebs( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) → ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

  • selectwebs - only import a specified list of webs (csv in $params{params}), skip the others.

ClassMethod twiki( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) → ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

  1. convert topic text that refers to TWiki topics who's names have changed
    • attachments?
  2. Main web renames and migration is left to the userweb filter

report on everything that you did!

ClassMethod converturls( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params ) → ( result=>$params{result}, web=>$params{web}, topic=>$params{topic}, text=>$params{text}, attachment=>$file, params=>$params )

  • converturls - convert literal URL's to topic links * start with http(s?)://host/view/ and http(s?)://host/pub/ * can i add regex safely? * then add SCRIPTURL/view * think about pub, and other

TODO: actually, this is hard, and given that we'll be dns directing all old host links to the new setup, we don't need it

18 May 2024 - 16:03 Foswiki v2.0.2