Manual:Using content from Wikipedia

Wikipedia, a Wikimedia project, uses a large number of extensions, a very up-to-date copy of the MediaWiki software, and a number of hacks and add-ons that make duplicating its layout and content output rather difficult.

However, there are some common issues that come up frequently enough to warrant a manual page on how to import content from Wikipedia.

Template theft
There are a few likely issues if you have copied templates from Wikipedia and they do not seem to be working as expected.

{ {#if: ...
If you have copied templates directly from Wikipedia and you see output like and  it means that you do not have the ParserFunctions extension installed.

Odd colors and floating
Wikipedia uses site-wide CSS pages for things such as class="infobox". They are located at w:MediaWiki:Common.css and w:MediaWiki:Vector.css. The latter is obviously only necessary if you're using MediaWiki's default skin, Vector. Some old tables may not contain the class="infobox" line, in which case you will need to add it.

Show/hide links
The show / hide links are controlled using site-wide JavaScript. The relevant page is w:MediaWiki:Common.js.

HTMLTidy
Wikimedia wikis (like Wikipedia) use an program called HTMLTidy that cleans up markup and validates it. If a template you have lifted from Wikipedia contains code that uses both wiki markup and HTML, you'll need to enable HTMLTidy in order for it to work. See also: Manual:$wgUseTidy.

Template dependencies
At times, templates will call sub-templates or other templates on a wiki. If you click the edit tab and look at the bottom of the page below the edit text area, new versions of MediaWiki will list other templates called by the current template. These may need to be copied over as well for the template to work. Documentation subpages (Template:Foobar/doc) are generally not needed, though they can be helpful for more complex templates. When you use Special:Export on Wikipedia, you can check a box to import sub-templates. Note that in some cases, you will want to open the downloaded XML file with your favorite text editor and do a search and replace. E.g., you may want to replace all mentions of "Wikipedia" with the name of your wiki and all "en.wikipedia" urls with the url of your wiki. Watch out for the difference between spaces and underscores if your wiki name consists of more than one word; there may be urls in that XML file that will break if you put a space in the middle of them. If the XML file consists of a lot of pages, to save work correcting it later, you may want to scroll down the XML file one last time before import as a sanity check to make sure you didn't forget anything that needed to be changed. On the other hand, if a mistake does slip through and you import a lot of faulty template pages, there's always Extension:DeleteBatch (see below).

Outdated templates
If the templates were added to your wiki a long time ago, you may run into issues from their being outdated. You can try to figure out which sub-template is causing the problem and try to fix it, or you can follow this procedure, which assumes you are an administrator on your wiki and that Extension:DeleteBatch is installed:
 * 1. Go to w:Special:Export (Wikipedia's export page). Enter the name of the template, e.g. Template:Citation. Check all three checkboxes: Include only the current revision, not the full history; Include templates; and Save as file.
 * 2. Go to Special:Import (on your wiki). Import the file. You'll get a list of imports that went through and imports that didn't, e.g.:

* Template:Citation 1 revision * Template:AuthorMask doc 1 revision * Template:Citation/authors 1 revision * Template:Citation/core All revisions were previously imported.
 * 3. Check to see if the template works now. Make a small edit to a page that transcludes the template and it should reload.
 * 4. If it's still not working (as it probably won't be), follow the rest of the steps below.
 * 5. Fire up OpenOffice spreadsheet, or Microsoft Excel, or whatever.
 * 6. Copy and paste the list from step 2 into column A of this spreadsheet. (You may first want to copy and paste into gedit or Microsoft Notepad or whatever as an intermediate step, so that you can dispense with all the formatting that will otherwise end up in your spreadsheet.) In cell B1, put this formula: =IF(RIGHT(RIGHT(A1,LEN(A1)-6),9)="imported.",LEFT(RIGHT(A1,LEN(A1)-6),LEN(RIGHT(A1,LEN(A1)-6))-40),LEFT(RIGHT(A1,LEN(A1)-6),LEN(RIGHT(A1,LEN(A1)-6))-11))
 * 7. Copy and paste that formula all the way down column B, or at least far enough that it's even with the end of the list in column A.
 * 8. Now copy the content of column B into Special:DeleteBatch. Delete them all.
 * 9. Now do the import in step 2 again.
 * 10. Check to see if the template works now. (See step 3)

Generic duplication
Wikimedia's configuration files are available at http://noc.wikimedia.org/conf/

The extensions currently enabled on a specific project are located at Special:Version (e.g., w:en:Special:Version).

Wikimedia wikis use short URLs. More information regarding those is available at Manual:Short URL.

Gadgets
Harvest all of Wikipedia's gadgets by going to w:Special:Export and grabbing these. Of course, it will still be necessary to make the necessary changes in MediaWiki:Gadgets-definition, MediaWiki:Common.css, MediaWiki:Common.js, MediaWiki:Vector.css, and MediaWiki:Vector.js as the case may be. Also, a lot of those description pages, e.g. MediaWiki:Gadget-HotCat, have links that will break when imported, so you'll probably want to edit those.

MediaWiki:Gadget-OldUploadForm.js MediaWiki:Gadget-ChooseResolution.js MediaWiki:Gadget-Gallerypreview.js MediaWiki:Gadget-Slideshow.js MediaWiki:Gadget-UTCLiveClock.js MediaWiki:Gadget-addsection-plus.js MediaWiki:Gadget-DefaultSearch.js MediaWiki:Gadget-dictionaryLookupHover.js MediaWiki:Gadget-ZoomViewer.js MediaWiki:Gadget-mwEmbed.js MediaWiki:Gadget-purgetab.js MediaWiki:Gadget-Gmaps.js MediaWiki:Gadget-QPreview.js MediaWiki:Gadget-ClassicMonobook.css MediaWiki:Gadget-rightsfilter.js MediaWiki:Gadget-contribsrange.js MediaWiki:Gadget-PrettyLog.js MediaWiki:Gadget-Geotoolbox.js MediaWiki:Gadget-Geocodecattodo.js MediaWiki:Gadget-DisableImageAnnotator.js MediaWiki:Gadget-edittop.js MediaWiki:Gadget-Watchlist-wo-uploads.js MediaWiki:Gadget-ThumbnailPurger.js MediaWiki:Gadget-GalleryDetails.js MediaWiki:Gadget-AddInformation.js MediaWiki:Gadget-WhatIsThat.js MediaWiki:Gadget-QuickDelete.js MediaWiki:Gadget-UserMessages.js MediaWiki:Gadget-RemoveImageTools.js MediaWiki:Gadget-Tineye.js MediaWiki:Gadget-CSSValidate.js MediaWiki:Gadget-Cat-a-lot.js MediaWiki:Gadget-HotCat.js MediaWiki:Gadget-CategoryAboveAll.js MediaWiki:Gadget-CategoryAboveBelowImage.js MediaWiki:Gadget-Searchnotincat.js MediaWiki:Gadget-Sum-it-up.js MediaWiki:Gadget-Tag.js MediaWiki:Gadget-BiDiEditing.js MediaWiki:Gadget-ShortLink.js MediaWiki:Gadget-EoMagicalConversion.js MediaWiki:Gadget-MyLangNotify.js MediaWiki:Gadget-Flickrfixr.js MediaWiki:Gadget-DelReqHandler.js MediaWiki:Gadget-PermissionOTRS.js MediaWiki:Gadget-EnhancedUndelete.js MediaWiki:Gadget-CleanDeleteReasons.js MediaWiki:Gadget-autodel.js MediaWiki:Gadget-modrollback.js MediaWiki:Gadget-massblock.js MediaWiki:Gadget-blockoptions.js MediaWiki:Gadget-section-browsing-gadgets MediaWiki:Gadget-section-editing-gadgets MediaWiki:Gadget-section-interface-gadgets MediaWiki:Gadget-section-interface-gadgets-editing MediaWiki:Gadget-section-library-gadgets MediaWiki:Gadget-GoogleTrans MediaWiki:Gadget-Navigation_popups MediaWiki:Gadget-RegexMenuFramework MediaWiki:Gadget-Friendly MediaWiki:Gadget-HotCat MediaWiki:Gadget-refToolbar MediaWiki:Gadget-Twinkle MediaWiki:Gadget-wikEd MediaWiki:Gadget-purgetab MediaWiki:Gadget-UTCLiveClock MediaWiki:Gadget-ExternalSearch MediaWiki:Gadget-mwEmbed MediaWiki:Gadget-dropdown-menus MediaWiki:Gadget-modrollback MediaWiki:Gadget-contribsrange MediaWiki:Gadget-CategoryAboveAll MediaWiki:Gadget-addsection-plus MediaWiki:Gadget-CommentsInLocalTime MediaWiki:Gadget-removeAccessKeys MediaWiki:Gadget-metadata MediaWiki:Gadget-searchFocus MediaWiki:Gadget-exlinks MediaWiki:Gadget-Blackskin MediaWiki:Gadget-edittop MediaWiki:Gadget-LongEditSummaries MediaWiki:Gadget-textareasansserif MediaWiki:Gadget-lefteditlinks MediaWiki:Gadget-modernskin-thunks MediaWiki:Gadget-DejaVu_Sans MediaWiki:Gadget-JSL User:TheDJ/Gadget-HotCat.js User:Ioeth/friendly.js User:AzaToth/morebits.js User:Ioeth/friendlyclock.js User:Ioeth/friendlyshared.js User:Ioeth/friendlytabs.js User:Ioeth/friendlytag.js User:Ioeth/friendlytalkback.js User:Ioeth/friendlywelcome.js User:AzaToth/morebits.js User:AzaToth/twinklefluff.js User:AzaToth/twinklewarn.js User:AzaToth/twinklearv.js User:AzaToth/twinklespeedy.js User:AzaToth/twinklediff.js User:AzaToth/twinkleprotect.js User:AzaToth/twinkleprod.js User:AzaToth/twinklexfd.js User:AzaToth/twinkleimage.js User:AzaToth/twinkleunlink.js User:AzaToth/twinkledelimages.js User:AzaToth/twinkledeprod.js User:AzaToth/twinklebatchdelete.js User:AzaToth/twinklebatchprotect.js User:AzaToth/twinkleimagetraverse.js User:AzaToth/twinklebatchundelete.js User:Smith609/reftool.js