|
Cookbook /
HandleUnknownMarkupsSummary: How to suppress unknown markup, instead of having it display
Version:
Prerequisites:
Status:
Maintainer:
Categories: Administration
Warning: This recipe isn't tested yet. Somebody please try it out and either report errors here, or (even better) fix things and remove the warning :-) QuestionIs there a way to simply suppress unknown markup, instead of having it display? I have imported pages from elsewhere and don't have (nor need) all the markups that are used on these pages. Alternatively: I have written pages that use some special markup, and others might want to import those pages but don't want to install the markup. AnswerIf the original site is up and running, and has Say the original entry is [include] => Array
(
[cmd] => >if
[seq] => B>=>
[pat] => /\(:(include\s+.+?):\)/ei
[rep] => PRR().IncludeText($pagename,'$1')
[dep] => Array
(
[nogroupheader] => >
[nogroupfooter] => >
)
)
In Markup('include', '>if',
'/' . pcre_quote ('\(:(include\s+.+?):\)', '/') . '/ei',
'');
This will overwrite the definition for the markup. If you want an error message instead of simply dropping the markup, you can replace the final line with '\'[Unknown markup: \' . PSS($0) . \']\'');
If you have a general pattern that you wish to ignore, put it into the second line. For example, many markups are written as Markup('(:', '<restore', '/\\(:.*?:\\)/', '');
'<restore' makes sure that the rule is processed late, when all the normal markup is already done, so all the remaining Notes and Comments
See AlsoContributors
|