FANDOM


This page describes a bit of regex. It must be used within a script or user-fix.

Delink section headers
Creator: CzechOut
What it does: Strips links in section headers
Complexity: Moderate

Delink section headers is a bit of regex that will help you strip links from section headers. If your users have gone crazy with links, you may find that you suddenly have to worry about linked text in section headers. Because links are frequently a different color from header text, your whole site design could be compromised by this pernicious practice. This bit of regex will strip the links away but leave behind what's inside

It is typically used with the replace.py script.

Code Edit

python replace.py -summary:"Getting rid of links in headlines" -regex -start:! "\=\=(.*?)\[\[\:[Cc]ategory\:(.*?)\|(.*?)\]\](.*?)\=\=" "==\1\2\4=="

Explanation Edit

This main example actually demonstrates one of the more complex cases:

=== [[:category:movies|Movie]] roles ===

This isn't really desirable because in most style sheets Movie would render in a different color to roles. What the script does is to remove the word Movie from the brackets, resulting in:

=== Movie roles ===

Known limitations Edit

In the form above, only links to category pages would be stripped. But this regex could be easily modified in a number of different ways. You could excise the :[Cc]ategory: bit if you wanted to concentrate on links to regular pages. You could make it a little bit fancier by replacing :[Cc]ategory: with another instance of .*?, which would check for anything prior to a pipe, and thereby catch not just category calls, but also calls to any other namespace (except namespace:0).

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.