Note, regexW skills needed for the xml editing.

  1. Export from source wiki, turning on "Include templates." Do not import this file.
  2. Determine the list of pages to be imported.
    1. Delete everything except the title lines and turn those titles into wikilinks. (One method: Remove all linebreaks - regex matching \r?\n should work on most systems - then regex replace .*?<title>([^<]+)</title> with \* [[$1]]\n and delete the last paragraph, which will not be a page title.)
    2. Paste into an Appropedia page (e.g. the Sandbox).
    3. Delete all the blue links from the list, until that only redlinks remain. Be 100% sure, to avoid overwrite problems. (This assumes that the blue links represent the same template working close enough to the same way on both wikis.)
    4. For each template in the list, add a /doc page below it. Replace (\* \[\[Template\:[^]]+)\]\] with $1]]\n$1/doc]]
    5. On second thoughts, this step may not be necessary as importing a non-existent page should simply fail with no action taken. Take this new list and paste it into Wikipedia's Sandbox. Click "Preview". Remove any redlinks. Preview to check. This is the list to be exported from the source wiki.
  3. Go to the export page on the source wiki
    1. Paste in the short list of red links (removing the square brackets)
    2. Turn off "Include templates"
    3. Turn on "Save as file"
    4. Export
  4. Edit the xml export file:
    1. Strip out interlanguage links, if any - step through each one to avoid false positives. This regex match code should get almost all, with few false positives: ^\[\[([a-z][a-z][a-z]?[\:\-]|simple\:)[^\]]+\]\](\r?\n)? and hit delete or replace with nothing.
    2. Change every username - for Wikipedia, assuming you've imported only the latest revision, change usernames to "(various editors @ en.wikipedia.org)". Regex: Match \<username\>[^\<]+\</username\> and replace with <username>(various editors @ en.wikipedia.org)</username>
  5. Double check there are no existing templates (e.g. do a quick search and eyeball each <title> line, comparing it to your memory - what you expected to be there.)
  6. Import here.
  7. Check the templates.
  8. Add attribution, e.g. by pasting in {{attrib wikipedia|{{FULLPAGENAME}} }} at the bottom of the "noinclude" section. (This code assumes the template is from Wikipedia and the name is unchanged.)


Issues

NEXT:

  • Add {{attrib wikipedia|{{subst:PAGENAME}}}} to each imported template.
  • Template:SometimesW looks wrong

Weird addition of content (early revisions of mainspace content) to failed templates, e.g. STAR-TIDES page at Template:Sometimes/doc.

NEXT TEMPLATES TO IMPORT (after server upgrade to avoid charset errors):

  • Template:To do
Cookies help us deliver our services. By using our services, you agree to our use of cookies.