# Wikipedia:WikiProject Wiki Syntax

## What is this?

An attempt to fix up mismatched wiki syntax (such as brackets), like this "[link]]", or "(see [[Link)", or "(see link]])", or "[[link]". They're all wrong, and need to be fixed. If you're looking at this page, it's probably because someone fixed something on a page you're watching. All that's being asked is that you do the same for someone else (i.e., fix something on someone else's page). You don't have to go looking for these misplaced bits of wiki syntax — that's already been done for you. All you have to do is follow the steps below — it's very easy, quick, and helpful.

## How does this work?

1. Randomly select a page from the list of pages below (that hasn't been crossed out already).
2. On that page, randomly select one block of 5 problems from the list of contents.
3. Fix those 5 syntax problems (by closing/opening brackets or adding/removing quotes).
4. With each fix, if you want, set the edit description to "[[WP:WS|Please help out by clicking here to fix someone else's Wiki Syntax]]". (This is to encourage more malformed syntax to be fixed.)
5. Delete that block of 5 problems from the page (so that we know that they're done).

 Status: All done! The most recent batch was completed on the 21st January 2006. The next batch is available here.

### Completed pages

Problem Pages Tip/Note
Braces-Tables 000, 001, 002, 003, 004
triple quotes 000, 001, 002, 003, 004,

005, 006, 007, 008, 009

Unbalanced HTML tags 000, 001, 002 Tip: Contains unbalanced HTML comment tags (Section on How to fix --> (i.e. an ASCII arrow) may be of assistance); and unbalanced DIV tags (these articles open a <div> and don't close it, or they're closing a div with </div> that they never opened).
double quotes 000, 001, 002, 003, 004,
005, 006, 007, 008, 009,
010, 011, 012, 013, 014
square brackets 000, 001, 002, 003, 004,
005, 006, 007, 008, 009,
010, 011, 012, 013, 014,
015, 016, 017, 018, 019,
020, 021, 022, 023, 024,
025, 026, 027, 028
Double Redirects 000, 001, 002, 003, 004,
005, 006, 007, 008, 009,
010, 011, 012, 013, 014,
015, 016, 017, 018, 019,
020, 021
Please see tips on fixing double-redirects.
Redirect syntax 000, 001 Note: Please read tips on fixing redirect syntax.
Non-existent Redirect target 000 Please see tips on fixing redirects with non-existent targets.
ordinary brackets 000
1911 Britannica Category 000
HTML table attributes that look wrong 000 This list came from Erik Zachte - Thank you Erik!
Unbalanced Div tags 000 Tip: These articles open a <div>, and don't close it, or they're closing a div (with </div>) that they never opened.
Possible wrinkle: some editors use an empty <div /> to add an "id" anchor for an internal link. If you don't want to put the work in replacing these with more orthodox footnotes, leave them in place and make a note for next time around. discussion moved to the talk page.
Section Headings 000 Tip: Need same number of equal signs before and after the heading title.
miscellaneous 000, 001, 002, 003

## I can't find a listed problem / it was fixed already

Then please disregard it, and move on to the next problem.

Absolutely!

## What if I am unable or don't want to fix all 5 problems in a block?

You don't have to fix the whole block, but please remember to remove the problems you've fixed from the page.

## New lines

Please try and ensure that all square brackets, ordinary brackets, bold quotes, and italics quotes are opened and closed on the same line (i.e. no carriage returns between each start and end pair). For example, do this:

• [http://www.site.com Description]

Rather than this:

• [http://www.site.com

Description].

Or this:

• '''bold text'''

Rather than this:

• '''bold

text'''

If these things occur on different lines, they will be listed as problems (once for each line). This is deliberate, as these things really should be opened and closed on the same line.

## What do I do if I encounter valid unclosed square brackets, or other wiki syntax?

Some example of valid use of unclosed square brackets, and other Wiki formatting symbols are:

• The mathematical notation [a,b) or (a,b]
• The use of "[" in tables of character sets
• Articles about the languages of Africa where they make click noises, and [ and [[ are common ways to spell the clicks.
• In C and other programming languages, "==" often appears in code
• Emoticons such as :)
• The use of '' as a symbol for inch or arc second (although the preferred format for these now is to replace them with &Prime; which renders as ″ and which is the proper double prime mark. Note that you must use a capital "P" in &Prime; or else it will display as a single prime mark, which is just one dash).

These are all valid, so please don't close the brackets, or other symbols. Instead, please enclose that bit of text in <nowiki> tags — for example "<nowiki>[a,b)</nowiki>", or "<nowiki>[[</nowiki>". These nowiki tags will ensure that the software will know that it should ignore those unclosed brackets the next time that it is run.

If you encounter unclosed ordinary brackets by themselves, i.e. "(" or ")" that are valid, please do not enclose these in nowiki tags, since ordinary brackets are not a kind of wiki syntax.

Note: If you find a link enclosed in square brackets (i.e. "[text [[link]] text]"), be sure to enclose both outer brackets in nowiki tags ("<nowiki>[</nowiki>text [[link]] text<nowiki>]</nowiki>").

## What types of problems does it find?

• Unbalanced square brackets — e.g. [blah]].
• Unbalanced ordinary brackets — e.g. (blah)). These are not actually wiki syntax, but they're easy to forget to close.
• Unclosed bold or italics — e.g. '''blah.
• Unbalanced table open / close tags.
• Redirect pages that look malformed.

## How to fix --> (i.e. an ASCII arrow)

Do one of the following:

• (Most common situation) Replace "-->" and "--->" with &rarr; which looks like this →
• Likewise replace "<--" with &larr; which looks like this ←

For things within math tags (  ), proceed as below. Bear in mind that some mathematicians editing Wikipedia have qualms about using math tags in an "inline", as opposed to "displayed" context, because of failure of proper alignment with surrounding text, mismatches in sizes of characters, or punctuation such as a comma or period appearing only on the succeeding line as if it were part of a separate word. See Wikipedia:Manual of Style (mathematics) for more on this.

• Replace <-- and --> with $\leftarrow$ and $\rightarrow$ respectively.
• Replace "|-->" with this: $\mapsto$ which looks like this: ${\displaystyle \mapsto }$
• Replace "<--->" with this: $\leftrightarrow$ which looks like this: ${\displaystyle \leftrightarrow }$
• Or replace "<--->" with this: &harr; which looks like this: ↔
• Make sure HTML open comments are matched with an equal number of HTML close comments e.g.: <!-- blah -->
• If none of the above apply, enclose in <nowiki> tags.

## Do not "fix" the following square brackets

• The following form is correct: things like [[dog]]s, [[logic]]al, [[Russia]]n, [[dogma]]tic, [[apocrypha]]l, and [[hyphen]]ated are correct and do not need to be altered. This form causes the entire word to appear as a clickable link to the page with the title inside the brackets.

## Tips on fixing redirect syntax

• Pages listed as redirect syntax problems are using a non-standard type of redirect, although they may or may not work (as the Wikipedia is extremely forgiving of redirect syntax).
• The simplest redirect syntax is: #REDIRECT [[Target]]
• Note that the redirect target is not enclosed in italic quotes, nor is the redirect target enclosed in ordinary-brackets / parentheses.
• The redirect target should always be in enclosed in matching double square brackets.
• Redirection doesn't show correctly on the preview

## Tips on fixing double-redirects

• If the link goes to a redirect page with a blue link, which when clicked gives a page that says at the top "Redirected from (somepage)", then it is a double-redirect. A double redirect is when page A redirects to page B, which then redirects to page C. The Wikipedia only properly supports one level of redirects. To fix this, page A (the first redirect page) should be edited to point to page C (the final page), instead of another redirect (page B) - and then please delete it from the list.
• Otherwise, if the link on the redirect page works correctly (i.e. shows the article, without saying "Redirected from (somepage)"), and is syntaxed correctly, then it has already been fixed - please delete it from the list.

Multiple redirects to same ultimate target
The groups of five may contain two or more pages that ought to redirect to the same ultimate target; some such pairs or triples overflow into another group of five. It will be most efficient if all are done in one hit and all then deleted, no matter which group they are in.

## Tips on fixing redirects with non-existent targets

• If the link goes to a redirect page with a red link, then the redirect target does not exist. Basically it's a redirect that points to something which isn't there.
• In some cases this redirect may be edited to point to a page that does exist.
• If you can't easily find a suitable target, then you can add it to the end of the redirects for deletion page (where the redirect will either get fixed, or deleted by an administrator), and then delete it from our list page.
• In some cases, however, such as a redirect from a plural to a singular, or from a misspelling to a correct spelling, or from a misnomer to a correct term, a redirect with a non-existent target can be useful because it avoids later creation of duplicate articles; in these situations the best solution is usually to leave a note on the redirect creator's talk page, asking them politely if they can please create a quick one-sentence stub article at the target (this ensures that all redirects point to existing articles, as well as preventing the creation of duplicate articles, and improving the Wikipedia).
• If the redirect page has no useful history, and does not seem useful, then add {{delete}} to the top of the redirect; it will then be speedily deleted.
• Some redirects that are listed as having a non-existent target, but which do have an existing target (blue link) when you look at them, are actually badly syntaxed (e.g. they have extra gibberish after the redirect, or an extra misplaced square bracket, or a double space instead of a single space in the link name), but you usually have to edit the redirect to see these. Also templates included after a redirect can cause a redirect to be listed as bad, if the template's curly braces aren't closed properly. To fix these situations, please clean up the redirect (e.g. delete the gibberish, remove extraneous square brackets, use single spaces instead of double spaces, and close template curly braces).

## Tips on fixing parentheses

• Please do not add or delete parentheses unless there really is a grammatical mistake - for example if an article has "The arguments in favour are 1) something 2) something else", then that's OK - but if it has "The arguments in favour are well known (see reference. " then that bracket should be closed. Things like emoticons :) are also grammatically OK (although possibly not always suitable for an encyclopedia!).
• If you're in doubt as to whether something is a real problem or not, then please assume it's not a problem, and just delete it from the list of problems. It's better to not fix something that is a problem, than it is to fix something that is not a problem; or to put it another way: "If in doubt, leave it out."
• Please don't surround parentheses with nowiki tags (as they're not a wiki syntax).

## What is the scope and aim of this project?

The scope is the whole of the English wikipedia, and the aim is for it to contain valid and well-formed wiki-syntax. In other words, it should be possible to get the number of problems found down to zero (excluding valid unclosed ordinary brackets, so these will probably be ignored in later runs).

## History

• The first batch of invalid wiki syntax focussed primarily on mismatched square brackets, and took place from 27th October to the 31st of October 2004, and found around 1,500 mismatched brackets, and it covered up to "Luke" in the alphabet. There were 68 contributors to this first batch.
• The second batch of invalid wiki syntax searched for more kinds of invalid wiki syntax (added section headings, double braces + wiki table start/end, italics quotes, bold quotes, parentheses), and checked every article in the Wikipedia. This run went from the 6th November to the 20th November 2004, and involved fixing around 15,000 problems. There were 237 new contributors to this second batch.
• On the 20th November 2004, around 4,900 unbalanced parentheses problems were added, as a one-off special.
• The third batch started on the 1st December 2004, and listed 3,924 problems. (The second run found 15,000 problems in the same categories.) In other words, we're definitely having a big effect: 3924 / 15000 is equal to 26% - I.e. we have eliminated 74% of these problems! This 3rd batch added checking of redirect syntax.
• The fourth batch was started in mid December 2004, and added checking div tags. All the problems found in the 3rd batch, the 4th batch, and the parentheses check, were completed by the 13th January 2005.
• The fifth batch started on 13th March 2005. This batch covered from 'A' to 'H' in the alphabet, and listed around 7000 problems (which included around 3000 redirect problems), added checking of comment tags, and was completed on 28th March 2005. Well done!
• The sixth batch was started on the 26 April 2005, using the 21-April-2005 database dump, covered every article in the Wikipedia, and listed around 8400 problems (comprised of roughly 3000 redirects, 50 section headings, 80 html-tags, 250 braces-tables, 600 double-quotes, 950 triple-quotes, 3400 square brackets, and 50 miscellaneous). Some syntax-checking additions that were new in this batch were: nowiki tags, math tags, code tags, pre tags, and handling multi-line image tags. It ran until the 22nd of June 2005.
• The seventh batch started on the 3rd of December 2005 and concluded on the 30th of December. It covered up to 'J' in the alphabet, and included a few bug fixes (such as removing false positives for multi-line image tags), and listed around 5700 problems. Additionally a new step was added, so that if a syntax problem is found in the offline database dump, then we verify (using the live Wikipedia) that the syntax problem still exists. This allows problems to be found quickly, whilst simultaneously giving you a fresh and current list of problems, and preventing problems that were already fixed in the time between the dump and syntax-checking from being listed. After this batch, a small follow-up batch was done, relisting 380 problems that were part of the seventh batch, but which the syntax checker was still showing as unfixed in the live Wikipedia as of 13 Jan 2006, and this list was refreshed on 20 Jan 2006. After this mini batch, a final run was done to catch any stubborn unfixed items, with the 51 remaining items being fixed as needed. This was done in case these items represented problems in the syntax checker itself, but no such problems were found - rather the items were mostly hard-to-spot errors, plus some inconsistent table syntax.

## Are the problems shown ever not problems?

Yes, sometimes — but it's fairly rare. It can happen when the page author did something that looks like invalid wiki syntax, which now tends to only happen with mathematics notations — two examples are half-open interval notation in mathematics, and surreal number notation in mathematics. The solution in these situations is usually to enclose the thing that looks unbalanced in nowiki tags.

## When are you planning on doing a new run?

When everything on this page has been done, and a new database dump is produced that incorporates those fixes.

As existing problems get fixed, it is thought that each successive run will find progressively fewer problems. After a few runs, it seems likely that only newly-created problems will be found, and that the total number of errors will probably fit onto a handful of pages.

## What do I do if I finish the last items in one of the above pages?

Please ensure that all the items have been deleted from the list, add a quick note to that page that it has been completed, and then put a strikeout through the name of that file on this page (so that everyone knows it is done).

## What do I do if I find an article that needs more than just its syntax cleaned up?

If you find any articles that need additional, non-syntactic, cleanup, then please list those articles on Wikipedia:Cleanup. Many Wikipedians regularly go to the Cleanup page, looking for chances to do deeper cleanup work. The main difference between Cleanup and Wiki Syntax is that Wiki Syntax is much broader (systematically checks every article) but shallower (focuses on fixing specific problems with Wiki Syntax) — whereas Wikipedia:Cleanup is narrower (there are usually around 100 or more pages listed) but much deeper (including complete rewrites of articles).

## Thank you to contributors

There are many people who have contributed to fixing broken wiki syntax, and big thank you to everyone who has helped out — this project is only possible because of your help:

Note: If you've helped out before and your name is missing, or if you've just fixed something, then please add your name to the list.

## Credits — software

The software for finding malformed wiki syntax was written by Nickj, as part of his link suggester project.

Source code for Wiki Syntax project is now available. It's a bit of a mess, sorry!