[Pmwiki-users] wikiware to allow html in pages

J. Meijer commentgg
Fri Jul 16 09:54:06 CDT 2004


Below some freshware to allow html in pages. Only a restricted set of tags
is allowed. If your wiki is private you may want to add some tags. The list
of tags allowed is easily modified.

There are two versions. V1 always allows (and converts) html tags. V2
enables this after a line with a [[html]] directive. Its [[nohtml]]
directive cancels [[html]] enabled or V1 html-processing.

-jm



ps I'm probably duplicating somebody's efforts here.



  # list tags for html tag recognition
$OkHtml='HTML|HEAD|TITLE|META|STYLE|BODY|INPUT|FORM'.
  '|TABLE|TBODY|TR|TD|CODE|PRE|CITE|SPAN|FONT'.
  '|BR|P|DIV|CENTER|IMG|A|B|I|S|BLOCKQUOTE|UL|OL|LI';
$OkHtml="/<([\/]?(?:$OkHtml)(?: .+?)?\\w*)>/i";

  # V1: globally enable (registered) html tags recognition
$InlineReplacements[$OkHtml]= '<$1>';

  # V2: let [[html]] directive enable (registered) html tags
$DoubleBrackets["/\\[\\[html\\]\\]/e"]=
  "(\$InlineReplacements['$OkHtml']='<\\$1>')?'':'';";

  # V2: let [[nohtml]] directive disable V1 or [[html]] processing
$DoubleBrackets["/\\[\\[nohtml\\]\\]/e"]= 'unsetHtml();';
function unsetHtml() {
  global $OkHtml,$InlineReplacements;
  unset($InlineReplacements[$OkHtml]);
  return '';
}

  # insert the code as usual in your local/config.php







More information about the pmwiki-users mailing list