User:PerfektesChaos/js/WikiSyntaxTextMod/flow/selective
WikiSyntaxTextMod → Syntax polishing → Step 5
The fifth step protects further areas (after nowiki, codes, and link targets etc.) against general modifications.
This is not always necessary and will be executed only if there is a reason.
Within protected areas nothing is searched, so nothing found or even worse: replaced.
Necessity of protection
editThere are two levels:
- Hide from further analysis
Comments,nowiki
andsyntaxhighlight
These regions influence further interpretation and processing of wikitext. - Protection against user defined modifications and some changes triggered internally.
In the first case the referred ranges are always protected, while parts deserve to be protected only if later acivity has been scheduled.
Protection of sections with coded information
editRanges with coded information are to be skipped.
Begin | Content | End |
---|---|---|
<!-- <hiddentext>
|
Comment | --> </hiddentext>
|
<nowiki>
|
No wiki formatting | </nowiki>
|
<syntaxhighlight…> <source…>
|
syntaxhighlight | </syntaxhighlight> </source>
|
<hiero> <imagemap> <inputbox> <math> <poem> <pre> <timeline>
|
hieroglyphs link sensitive images |
</hiero> </imagemap> </inputbox> </math> </pre> </timeline>
|
space at beginning of line | preformatted text | line end (last line in block) |
<code>
|
code | </code>
|
<tt>
|
type writer (monospace) | </tt>
|
<dfn> <kbd> <samp>
|
code | </dfn> </kbd> </samp>
|
If in doubt the extension is spread in conservating direction; may be wider than actually intended. If end marks have not been found, since illegal nesting happened in source text, the range is extended at maximum, in extreme cases until end of the entire wikitext.
Keys for sorting of categories and the entire DEFAULTSORT are always protected against user defined modifications.
Since the processing order brings tags into standardised form first and consecutively protected regions are built from those tags, it is possible to show scaring examples for bad formatting of wikisyntax or similar ML only by <
or enclosing by <syntaxhighlight>
.
Protection of link targets
editIt is reasonable to modify changed URL and wikilinks of moved pages or disambiguation pages. In particular cases it is meaningful to modify link targets which have been protected before. However, these link targets have to be protected against spelling correction and typographic refinement.
Begin | Content | End |
---|---|---|
after[[
|
wikilink (internal / external) including [[File: (link target only) |
before | or before ] or end of line |
after[ at[// [http:// [https:// [ftp://
|
URL | before ] or before space or end of line |
http:// https:// |
one of < | > or space or end of line[1] | |
end of line or space before File: or file name
|
within<gallery…>
|
| or end of line |
after{{
|
template name | last non-space before | or }} or end of line |
first character of parameter after =
|
media ID in template[2] |
last character of file extension before | or }}
|
Syntax elements of template transclusion (parameter names with |
and =
) might be protected as well, but not the parameter values.
Remarks
edit- ^ The MediaWiki parser currently interpretes a punctuation character (like
.;),?
) at the end of an unbracketed URL as not belonging to URL, despite it is a regular URL character according to HTTP/RFC. This needs to be investigated and should be put into brackets. - ^ Parameter values ending on a file name extension (with dot
.
).
These are currently:avi css djvu doc flac gif jpeg jpg js mid mp3 odt og[agv] pdf png svg tiff? wav xcf xls xml
(case insensitive).
[ German page ]