User:PerfektesChaos/js/WikiSyntaxTextMod/flow/corr
WikiSyntaxTextMod → Syntax polishing → Step 7
Only a few errors can be detected without any doubt, which is precondition for automatic fixes without any risk.
In addition to automatic correction it is searched for errors which must not be removed silently. Finally, users will be notified on those results. A note is also issued if the problem has been fixed but in rare cases that might have been misinterpreted.
Current approach
[edit]Sortkey
[edit]This affects {{DEFAULTSORT:
…… and [[Category:*|
……]]
elements.
Authors are notified if a sortkey is entirely redundant since DEFAULTSORT matches page title. If category sortkey is the same as at DEFAULTSORT (or page title, if no DEFAULTSORT) that one will be removed.
Further (automatic) adjustments may be configured on project level, depending on state of project migration towards Unicode Collation Algorithm.
Sortkeys are protected against further modification by this script.
ISBN
[edit]ISBN are “magic” and will be turned into link towards booksources special page. To ensure this MediaWiki behaviour formatting has to obey some rules. If the intention is recognized but format is invalid, the following conditions are enforced (number of subsequent digits exacly matching):
- Exacly one space between
ISBN
and number.- No colon; equal sign for template parameters only.
- No length specification like
ISBN-13
orISBN-10
. ISBN
in capital letters.
For magic word as well as identified template parameter:
- Hyphens (ASCII 4510) used for segmentation within the number.
- Spaces, minus signs, en-dash, dot,
, subsequent segmentation signs are replaced by exactly one hyphen.
- Spaces, minus signs, en-dash, dot,
- Hyphens supplied for segmentation: Language code and check digit will be separated as well as GTIN/EAN country code for “bookland” (978 and 979), illegal hyphens discarded or moved.
As next step inside the unstructured ISBN the separation between publisher and title number might be added. For nearly every language this is done by this script.
Naturally, an invalid check digit won’t be “fixed”. Rather than formatting the number the user will be alerted, since it is unknown which digit is wrong.
PMID
[edit]Like ISBN the PMID are “magic” and converted into external links. In order to enable MediaWiki proper recognition, some conditions are to be fulfilled, if the intention is clearly recognized (sufficient amount of subsequent digits assumed):
- Exactly one space between
PMID
and number - No colon; equal sign for template parameters only.
Bold weight in headline and definition term
[edit]In definition term (line beginning with ;
) bold markup can’t be noticed and will be removed.
- In headlines bold markup is invisible as well, but since 2012 rendered in table of content (rev:105284) and will be kept therefore.
Syntax errors which cannot be fixed automatically
[edit]A basic prinziple of the script is to reformat unambiguous syntax elements, which have been expressed less fortunately and which are not pretty readable for hman beings, will be improved without user interaction or even attracting attention.
If there is no unique interpretation of the received source code the script is not able to fix it. –
Example:== 2 left, right 3 ===
– Unbalanced number of equal signs
This is subject to manual repairing only and needs to be derived from context.
Error messages
[edit]With interactive users the script communicates as follows:
- All error messages and risky fixes are collected. When processing has been finished a flashy message box is displayed on top of page. If any risk was taken this is always appearing on the diffpage.
- In the more or less experimental LivePreview mode (where the user stays on the same page for preview) that is inserted into the identical page.
- Otherwise it is attempted to use
sessionStorage
– if writable, that is used for transfer between built pages. If no other choice, a comment is inserted ahead of wikitext source, and removed again after extraction. - If the identical error type with the same details is repeated, that issue is diplayed only once and the number of repetitions is prepended in italics.
- The number of different messages is limited to 7 by default. Inherited errors, frequent copies of buggy syntax or articles at first draft stage an indigestible amount of messages might be triggered.
On batch mode the error list might be taken from application object.
- No messages are inserted into source text.
- The
.errors.collection
component provides all single errors. Severe unrecoverable errors were found if this is an array. Every element of thi array is an array with keyword for error type, corrective attempt and context.
Design of message box
[edit]Appearance of error message box may be configured by user. It is derived from class=error
system resource.
Advanced users might insert into own common.css:
.error-detail {
font-size: 90%;
font-weight: normal;
}
.error-explanation {
display: none;
}
By application object the maximum number of different messages within the box may be specified (with integrated definition of application object:
mw.libs.WikiSyntaxTextMod = { config: { errorlimit: 25 } };
This figure could be set to zero, then notification is suppressed. That does not influence the internal .errors.collection
storage.
[ German page ]