Wikipedia talk:WikiProject User scripts/Scripts/Formatter
From Wikipedia, the free encyclopedia
Hi. I added this script to my monobook.js, but I'm not sure if it works (I don't see the difference). How is it supposed to work? Thanks. IronChris | (talk) 18:22, 14 May 2006 (UTC)
- Ok I've found the "format" tab... But it doesn't work very well! It modifies some links so that they no longer send to the right article, etc. (see for example the effect on "[[United States]]" here). Am I the only one to have problems with it? IronChris | (talk) 18:31, 14 May 2006 (UTC)
-
- It doesnt do that for me at all. Martin 19:38, 14 May 2006 (UTC)
-
-
- I removed this :
-
//entities that should never be unicoded function noUnicodify(str) { str = str.replace(" & ", " & "); str = str.replace("&", "&").replace("<", "<").replace(">", ">").replace(""", """).replace("'", "'"); str = str.replace("−", "−").replace("×", "×"); str = str.replace(" ", " ").replace(" ", " ").replace("", ""); str = str.replace("′", "′"); str = str.replace(/&(#0?9[13];)/, "&$1"); str = str.replace(/&(#0?12[345];)/, "&$1"); return str; }
Can we add a description of what this scipt does to the main page? It may be a good idea for those using it to have similar edit summary advertising this script, like [[Wikipedia:WikiProject User scripts/Scripts/Formatter|format]].-- Piotr Konieczny aka Prokonsul Piotrus talk 22:34, 25 July 2006 (UTC)
- yes, that's a good idea. thanks Martin 08:26, 26 July 2006 (UTC)
- I hope we do so, then - I am not familar enough with specific of what this script does to write a description.-- Piotr Konieczny aka Prokonsul Piotrus | talk 19:51, 31 July 2006 (UTC)
[edit] Functions
- Standardises appearances of categories.
- Fixes some common non-standard headings.
- Fixes broken internal and external links
- Standises and removes excess whitespace.
- Simplifies links e.g. [[dog]] to [[dog]]
[edit] Problem with single brackets being wrongly doubled
I keep noticing a problem with this script: when there is a string enclosed in single brackets, like [foo], Formatter assumes from the lack of http: that it is supposed to be an internal link, and doubles the brackets. But http:// is not the only kind of resource; ftp links are valid as well as irc: or mail: links. In addition, even if there is a quote and one inserts an eluicidating comment like this: <nowiki>[they really meant this]</nowiki>, the brackets will be doubled regardless. There doesn't seem to be an easy way to make that regexp smart enough to deal with all these cases, so perhaps it should just be removed. --Gwern (contribs) 16:25, 20 October 2006 (UTC)
- Agreed. Usualy a single bracket is intentional; what the formater should fix is a single bracket/two bracket error (when one bracket is missing from an ilink). -- Piotr Konieczny aka Prokonsul Piotrus | talk 21:26, 5 December 2006 (UTC)
[edit] Fix level 1 headings
Other things to easily fix with the script: if the article has level 1 headings (=heading=), the formatter should add '=' to each heading. A slightly more complex: if a new user does not know how to make headings, they often create bolded text in a line, thus the formatter should convert lines containing only bold text into headings. Last but not least, another common newbie mistake is to start paragraphs without an extra line wiki needs; thus if the formatter could detect such 'unwikified' paras and instert an extra line, it would be another useful feature.-- Piotr Konieczny aka Prokonsul Piotrus | talk 21:26, 5 December 2006 (UTC)