Extension:Negref
![]() |
The author of this extension is no longer maintaining it! Meaning any reports for additional features and/or bugfixes will more than likely be ignored. Volunteers are encouraged to take on the task of developing and maintaining it. As a courtesy, you may want to contact the author. You should also remove this template and list yourself as maintaining the extension in the page's {{extension}} infobox. |
Negref Release status: stable |
|||
---|---|---|---|
Implementation | Parser function | ||
Description | Provides a #negref parser function for negotiating the location of <ref> tags. | ||
Author(s) | Daniel Friesen (Dantmantalk) | ||
Last version | 0.2 | ||
Database changes | No | ||
License | GNU General Public License 2.0 or later | ||
Download | |||
|
|||
Check usage and version matrix; stats |
The Negref provides a #negref parser function with the ability to negotiate the location of <ref> tags within a chunk of WikiText. This parser function is primarily useful on semantic wiki, especially those using Semantic Forms, though it can also be very useful to a wiki that uses a lot of infobox like templates and likes to keep template parameters clean and simple.
Negref solves the problem of having template parameters you want to turn into some sort of link or semantic property but where the value may contain a <ref> tag. Instead of being forced to drop the ref tag, put it in another template parameter, or force people to hardcode the complex wikitext in articles the #negref parser function allows you to take a template parameter's value, and separate the ref tag from the rest of the value.
Usage[edit | edit source]
{{#negref:wikitext to negotiate|token for data|token for ref tags|pattern}}
The first parameter to the negref parser function is the wikitext you want to negotiate the location of the ref tags inside. The next two parameters are replacement tokens for the data, and the ref tags, something like $s$ and $ref$ work, these tokens will be used with the following pattern. The final parameter is the pattern you want to put the data and the ref tags from the wikitext into. For example if your goal was to create a link from the data of a template parameter and you were trying to keep the ref tags outside of that link to prevent them from breaking the link you would use {{#negref:{{{template param|}}}|$s$|$ref$|[[$s$]]$ref$}}
. Now if {{{template param|}}}
contained something like FooBar<ref>Book of Baz</ref>
the result would be [[FooBar]]<ref>Book of Baz</ref>
. The value here beind that if you had instead used [[{{{template param|}}}]]
the result would have been [[FooBar<ref>Book of Baz</ref>]]
which of course would have broke the link.
Installation[edit | edit source]
- Download a snapshot and extract it to your extensions directory. Choose the version that matches your version of MediaWiki.
- Add
require_once( "$IP/extensions/Negref/Negref.php" );
- Installation can now be verified through Special:Version of your wiki.
![]() |
This extension was migrated from Daniel Friesen's Wiki-Tools.com and checked into Wikimedia's svn. The original archived extension page can be viewed at http://wiki-tools.com/wiki/Negref and previous versions and commits to version control can be checked out from the old svn repo there. |