User:Espyo/Pikan

From Pikipedia, the Pikmin wiki
< User:Espyo
Revision as of 12:32, June 4, 2015 by Espyo (talk | contribs)
Jump to navigation Jump to search

Pikan is a Javascript script I made for Pikipedia. The name is short for "Pikipedia analyzer", and it creates a new button on the editing interface that, when pressed, runs an analyzer that reports problems with the page. These range from important things that need to be fixed as soon as possible (like old page links linking to Wikia), to stylistic issues (like pointless spaces at the end of lines). Its use is completely optional, but if you want to make sure that your edit is spotless, you should run it.

The analyzer checks the entire page, meaning that if you just made a simple edit on a section, you'll likely be warned about problems on other parts of the page. Although if you're using the script to begin with, then that means you're up for the challenge of cleaning up the small problems, so... When it finishes analyzing (should be near-instantaneous), it'll show one of the problems it found. You can navigate through the problems using the buttons. Every time you edit the text box with the page's source, the results are cleaned, and you'll have to press the search button again once you're done fixing. Please try fixing all of the problems while you're there, specially because some problems might only be detected if the text is in a certain way that matches what the analyzer (and the wiki) wants.

That said, if you find that the analyzer is reporting something that's obviously not a problem, ignore it. Remember, it's just a script that finds text; it can't understand context. Though if you think something's wrong with the way it's searching, you should let me know.

Source

See: User:Espyo/pikan.js

Analyzing

The problems are split into four categories:

  • Problem: General problem; something bad on the page that you should really fix.
  • Policy: A problem that contradicts Pikipedia's policy, explicit or implied (i.e. either a policy on the policy pages, or a "common sense" policy, like "Pikmin" with a lowercase p).
  • Question: The analyzer found something, but it can't tell for sure if the match is a problem or not. It's up to you to decide what to do, even if that means ignoring the analyzer's result.
  • Style: Problems that won't affect the reader, but that should still be fixed to make sure the analyzer runs well, and that future editors will have a nice clean editing experience.

The following is a list of all problems it checks for:

Problem

  • Finds any instance of "Wikia".
  • Finds incorrect spellings of "GamePad", "Nunchuk" and "GameCube".
  • Finds sub-optimal names for the fourth Super Smash Bros. game.
  • Finds incorrect names for the inhabitants of Hocotate and Koppai.

Policy

  • Finds thumbs and gallery images without a caption (and without a period at the end of said caption).
  • Finds game names without italicization.
  • Finds "Pikmin 1", "Pikmins", and "Pikmin" without lowercase p.
  • Finds links to the ambiguous page Pikmin,
  • Finds Pikmin type names in lowercase.
  • Finds words that start in uppercase needlessly.
  • Finds "NTSC", "PAL", "beta" and "alpha".
  • Finds Pikmin area names without the "The" (and capitalized as such).
  • Finds references that aren't using {{refs}}.
  • Finds missing "see also" sections.
  • Finds "strategy" and "external links" sections with bad names.
  • Finds links and bold in section headers.
  • Finds level 1 headers.
  • Finds headers that are sorted incorrectly.
  • Reports if there are no images on the page.

Question

  • Finds section headers in title case.
  • Reports if the first mention of the subject's name in the first paragraph is boldless.
  • Reports "you" outside of sections with {{guide}} in them.
  • Finds "color", as it is normally better to use "type" instead, when referring to a Pikmin type.
  • Finds "artwork" sections and suggests they be called "gallery".
  • Finds Wikia visual editor leftovers (weird junk in the page source).
  • Reports missing {{game icons}}.
  • Finds "captain", and suggests "leader" instead.
  • Finds gendered nouns.

Style

  • Finds galleries that are centered.
  • Finds "Image:" when used to call a file.
  • Finds redundant "Template:" namespace prefixes when calling a template.
  • Finds reference tags with spaces before them.
  • Finds trailing spaces.
  • Finds double spaces and double empty lines.
  • Finds empty lines at the start of the page.
  • Finds images that aren't alone on their line.
  • Finds underscores in links.
  • Finds redundant link names (like [[A|AB]] or [[A|A]]).

History

Creation

The script was made with the 2014 merge in mind. When we started merging pages, a lot of garbage from the Wikia page source leaked into Pikipedia. Some problems merely resulted in eye-rolls, but others were completely disgusting, even affecting the reader more than the page's source. Half of the common problems were easy to overlook, so in the interest of making sure I didn't miss any of them, I made a quick script that checked for common issues using patterns and reported them. Since then, I evolved the script further and further, eventually incorporating policy and style recommendations into it, to make sure that not just merged pages, but all pages can be made better with less effort.

Some time later, I decided I should just turn this into an official script to use all around the wiki. And here we are.

Changelog

Still on version 1.0.0.

Future

Known bugs

None at the moment.

Future plants

None at the moment.

Outside use

I also made Pikan with flexibility in mind. Feel free to grab the script and change it to your own will. I even added Greasemonkey information so you can run it as a Greasemonkey script. If you want to add the script to your wiki, you can change the problems and matches it checks for simply by editing the pikan.find_problems function. Quick guide:

  • Change pikan.url to point to your wiki. This is used for the "[More info]" links.
  • Edit pikan.find_problems to your suiting.
    • To find a simple problem with regex, do it like this:
reg = /my bad pattern/igm;
pikan.regex_check(reg, pikan.types.PROBLEM, "Problem found.");
  • You can add one more parameter to regex_check. This is a function that takes one regex match, and returns false if this match doesn't apply to match the problem with.
  • To create your own code to find a problem, you can add the problem to the list with pikan.save_problem. Check the function in the code for a documentation comment explaining it.
  • There are more helper functions in the code. I documented all of them. At the end, you'll find code that's more or less Pikipedia-specific, so you can probably delete that.

FAQ

Why do I have to press search again every time I make a change?
Because the positions of the old problem matches will be changed when you edit, and there's no reasonable way to keep track of them as you add and delete text.