Jump to content

User:PerfektesChaos/js/WikiSyntaxTextMod/flow/selective

From Wikipedia, the free encyclopedia

WikiSyntaxTextModSyntax polishing → Step 5

Protecting regions

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

[edit]

There are two levels:

  1. Hide from further analysis
    Comments, nowiki and syntaxhighlight
    These regions influence further interpretation and processing of wikitext.
  2. 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

[edit]

Ranges with coded information are to be skipped.

Sequence and identification of protected ranges
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
input fields
math
poem
preformatted
time line

</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 &lt; or enclosing by <syntaxhighlight>.

[edit]

It 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.

Identification of link target ranges
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://
ftp://
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]
  1. ^ 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.
  2. ^ 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 ]