User:Nardog/ExpandContractions
| You take full responsibility for any actions taken using ExpandContractions. You must read and abide by all relevant Wikipedia policies when using this tool; failure to do so may result in being blocked from editing. |
| Description | Expands contractions |
|---|---|
| Updated | February 13, 2026 (3 months ago) |
| Browsers | Chrome, Firefox, etc. |
| Source | User:Nardog/ExpandContractions.js |
This script adds a button to the sidebar that expands contractions when editing in source mode (not 2017 editor). Specifically, it replaces
- "it's" etc. with "... is" or "... has"
- "it'd" etc. with "... would" or "... had"
- "'re" with " are"
- "'ve" with " have"
- "'ll" with " will"
- "can't" with "cannot"
- "won't" with "will not"
- "n't" with " not"
It will not replace "I'm", "I'd", or "ain't" because they don't typically appear in encyclopedic prose (if they do, the contractions are likely the least of the article's problems). "'ll" is assumed to be short for "will" because who uses "shall" anymore—certainly not someone who leaves contractions in.
It does its best to distinguish between "is" and "has" for "'s" and between "would" and "had" for "'d", but this is not perfect so you'll be reminded to review the result if the replacements include "'s" or "'d".
Links, references, quotes, poems, hatnotes, comments, headings, etc. are excluded from replacements, but don't rely too much on this as it might still replace contractions where it shouldn't, e.g. a template parameter for a filename. Italic and bold text is also excluded because it tends to be legitimate titles, aliases, etc. Anything after a heading named "References", "Sources", "Bibliography", "Further reading", or "External links" is also ignored.
If the script incorrectly replaces a contraction inside an inline quote (or misses one outside it), it likely means the paragraph has missing or misnested quotes (e.g. "... "..." ..." where it should be "... '...' ...").
Installation
Add the following to your common.js:
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/ExpandContractions.js&action=raw&ctype=text/javascript');
Or you may enable the script installer in Preferences → Gadgets and click "Install" in the infobox on this page.
Acknowledgements
This script relies on Pathoschild's TemplateScript framework. Its escape feature was buggy, however, so the script implements its own.
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.