Inductiveload User Area
Main User Page Talk Page Gallery Contributions

WELCOME to my user page. Have a look around my galleries and contributions if you like, or leave messages on my talk page. It is also worth checking in the IRC channels if you need me quickly. I am usually present in the main Wikisource channel, #wikisource. Come and have a chat!

If you can suggest improvements to my own work, tell me. Don't let any poor quality work hang around!

Wikisource user page Commons user page Wikibooks user page Wikipedia user page

Languages: Nuvola English flag.svg (native), Nuvola France flag.svg (basic), Nuvola German flag.svg (basic), Nuvola Chinese flag.svg (very basic), Nuvola USA flag.svg (like, totally fluent), (passable), C plus plus.svg, (basic)


Admins have no greater enemies than themselves.

About Inductiveload
Awards for Participationedit
Featured article star - check.svg

Proofread of the Month
November 2010

Special: Validation month

Featured article star - check.svg

Proofread of the Month
November 2011

Special: Validation month

Ask me to do thingsEdit

I will need information:

Tools and scriptsEdit

User preferences and custom javascripts:

Commons scriptsEdit

Popups ReloadedEdit

Popups, but way better.

mw.loader.load('//en.wikisource.org/w/index.php?title=User:Inductiveload/popups_reloaded.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikisource.org/w/index.php?title=User:Inductiveload/popups_reloaded.css&action=raw&ctype=text/javascript', "text/css");

Quick AccessEdit

Keyboard-driven tool access

mw.loader.load('//en.wikisource.org/w/index.php?title=User:Inductiveload/quick_access.js&action=raw&ctype=text/javascript');

Preview markupEdit

mw.loader.load('//en.wikisource.org/w/index.php?title=User:Inductiveload/show_markup.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikisource.org/w/index.php?title=User:Inductiveload/show_markup.css&action=raw&ctype=text/javascript', "text/css");

Maintenance Wizard and ReplacerEdit

Perform maintenance without going into edit mode.

// maintain script has no purpose in special
if (mw.config.get("wgCanonicalNamespace") !== "Special") {
  mw.loader.using(['ext.gadget.utils-difference', 'mediawiki.util', 'mediawiki.api',
      'oojs-ui-core', 'oojs-ui-windows', 'oojs-ui-widgets']).done(function() {
    mw.loader.load("/w/index.php?title=User:Inductiveload/maintain.js&action=raw&ctype=text/javascript");
    mw.loader.load("/w/index.php?title=User:Inductiveload/maintain-ws-tools.js&action=raw&ctype=text/javascript");
  });
}

Jump to fileEdit

Add a button to go to the book file at Commons from the Index or Page namespace, and to the transcluding page from the Page namespace

mw.loader.load('//en.wikisource.org/w/index.php?title=User:Inductiveload/jump to file/load.js&action=raw&ctype=text/javascript');

ActivePageAlertEdit

Display an icon if a page has been edited recently, with the ability to vary the definition of "recently" on a per-other-user basis.

mw.loader.load('//en.wikisource.org/w/index.php?title=User:Inductiveload/ActivePageAlert.js&action=raw&ctype=text/javascript');

TweaksEdit

Show an indicator when a script loadsEdit

I use this to check my local script is loading

$(function() {
  $(".mw-indicators").append($("<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/OOjs_UI_icon_chem.svg/20px-OOjs_UI_icon_chem.svg.png\">"));
});

Add nocache=1 to WS-export sidebar linksEdit

$(function() {
  $("#p-coll-print_export a[href*='ws-export.wmcloud.org/?format'").each(function(i, a) {
    $(a).attr("href", $(a).attr("href") + "&nocache=1");
  });
});

Add a button to the main page POTM to edit itEdit

if (mw.config.get("wgTitle") === "Main Page") {
  $(function() {
    $(".collaboration-potm tr:first-child td:last-child").prepend(
      $("<a>")
        .css({float: "right", "font-size": "70%"})
        .attr("href", mw.config.get("wgScript") + "?title=Module:PotM/data&action=edit")
        .text("[+]")
    )
  });
}

Add a link your your bot's contributionsEdit

$( function () {
  var botname = "InductiveBot";
  mw.util.addPortletLink(
    'p-personal',
    '/wiki/Special:Contributions/' + botname,
    botname,
    'pt-botcontribs',
    'Contributions by ' + botname,
    '',
    '#pt-logout'
  );
} );

One-linersEdit

PywikibotEdit

List all indexes which have a page with a linter errorEdit
python pwb.py listpages -ns:Page -linter:misnested-tag -format:"Index:{page.title}" | sed -E 's/\/[0-9]+$//' | uniq


Image ProcessingEdit

Convert all files of type X to type Y, in parallelEdit
find . -type f  -name '*.png' -print0 | parallel -0 convert {} {.}.pbm
Make an image showing only not-black and not-white pixelsEdit
convert input.png -colorspace rgb -fill white -opaque black -fill red +opaque output.png

PDF/DJVU processingEdit

Fix a PDF that chokes ImageMagic due to "bad streams"Edit
gs -o generated.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress input.pdf

FunctionsEdit

Some extra functions that might be handy for other scripts:


Maintenance and reportsEdit

Below are lists of pages in Wikisource which are useful for various purposes. All of these could be out of date. If you really need up-to-date reports, just leave me a note, and I will do it as soon as I can.

  • templates A list of all templates in use on enWS, along with links and usage counts.
  • wikisource pages A list of all Wikisource namespace pages.
  • portals A list of all Portal pages.
  • ws-portal redirects A list of all Wikisource pages which redirect to Portal pages. No pages should link to these.
  • ws-wp no backlink A list of Wikisource pages linking to Wikipedia pages which do not link back here.
  • false root pages A list of pages that should be subpages but aren't.
  • site-css-js: in-progress CSS tidying-up - look here for CSS and/or JS moved out of MediaWiki namespace (rather than being deleted)

Bot activitiesEdit

I operate a bot, InductiveBot, which performs minor maintenance tasks. It is based on pywikipedia and is quite flexible. If you have a specific request, please let me know on my talk page, and I'll see what I can do!

MW devEdit

Run extension linterEdit

docker-compose exec mediawiki composer test extensions/ProofreadPage

Run extension parser testsEdit

docker-compose exec mediawiki php tests/parser/parserTests.php --file=extensions/ProofreadPage/tests/parser/proofreadpage_pages_pagelist.txt

Or to run all the tests in a directory:

docker-compose exec mediawiki sh -c 'find extensions/ProofreadPage/tests -name "*.txt" -exec php tests/parser/parserTests.php --file={} \;'

Run extension unit testsEdit

docker-compose exec mediawiki php tests/phpunit/phpunit.php extensions/ProofreadPage/tests/phpunit

Run linterEdit

docker-compose exec mediawiki composer test extensions/ProofreadPage
npm run-script test

Useful things to shareEdit

These are some useful scripts I have hacked together. I guarantee nothing! They are certainly not always neatly coded or structured, but they work for quick and dirty jobs.

Header scriptEdit

This is a tiny script to add the path of pywikipedia to the Python PATH environment variable at runtime, so you can run scripts from outside the PW directory, without messing around.

pw_script_header.py
#!/usr/bin/env python

import sys

PW_PATH = '/home/user/src/pywikipedia' #this is the directory containing the pywikipedia files
sys.path.append(PW_PATH)

General Python scriptsEdit

GIMP scriptsEdit

  • Remove-paper-texture.scm Gimp script to remove the paper background from a scan of a black and white image.
  • Remove-background-colour.scm Gimp script to remove a flat background colour from an image. This is a fairly brutal algorithm, use with care on delicate images.

How to split a table across many Page: pages so they transclude neatly into oneEdit

Page 1
 {| table styling
 | col1 || col2 || col3 
 <noinclude>|}</noinclude> <---this is the footer of the page
Page 2
 <noinclude> {| table styling (same as page 1)</noinclude> <---this is the header
 {{nopt}}
 | col1 || col2 || col3
 <noinclude>|}</noinclude> <---this is the footer of the page
Page 3
 <noinclude> {| table styling (same as page 1)</noinclude> <---this is the header
 {{nopt}}
 | col1 || col2 || col3
 |}

One touch template wrapping with AutohotkeyEdit

If you use Autohotkey (and you should be), the following is a useful function that lets you wrap the current mouse selection in a template, which saves you having to paste in the contents.

F2 & s :: wrapTemplate("sc") ; small caps

wrapTemplate( name )  
{
    front :="{{}{{}" . name . "|"
    back :="{}}{}}"  
    wrapTags( front, back) 
    return
}

wrapTags( front, back ) 
{
    AutoTrim Off               ; Retain any leading and trailing whitespace on the clipboard.
    ClipSaved := ClipboardAll  ; Save the entire clipboard so we can restore it when we're done
    clipboard =                ; clear the clipboard
    SendInput ^x               ; cut the selection to the clipboard
    ClipWait                   ; wait for the clipboard to contain something
    SendInput %front%%clipboard%%back% ; Output what was selected, surrounded by front and back
    Clipboard := ClipSaved     ; Restore the original clipboard
    ClipSaved =                ; Free the memory in case the clipboard was very large.
    return
}

Regular expressionsEdit

Function Search pattern Replacement Pattern
Remove single newlines. Useful for OCR'd text /([^\n])\n([^\n])/g '$1 $2'
Convert relative links to static links. Useful when putting a TOC in the Page: namespace. (/\[\[\/(.*)\/\]\]/g '\[\[$1\|$1\]\]'

My requestsEdit

Works I'm keeping an eye out for.

PeriodicalsEdit

Technical wishlistEdit

Some things I'd like to see done (that isn't actual proofreading). Some of it is unimportant, some of it may be controversial and un-discussed, but would be nice to address and tighten up.

  • Get dynamic layouts to work for non scan-backed works and scrap {{prose}} and other hard-coded formatting.
  • Fix poem tags - only by having all lines as p or span-tags can we have hanging-indented continuation lines like 95% of all printed poems are. Stanzas should be divs . Might need a whole new tag in the poem extension, but might not be that hard?(???)
  • Train Tesseract specifically for 1700s-style printing esp. with long-s
  • Allow match-and-split to match to PDFs (since there are now ~1m PDFs on Commons)
  • Get para breaks working in OCR loading: phab:T230415
  • Add common fonts:
    • Cursive: phab:T166138
    • JUnicode: phab:T173573
    • Sans Outline (and remove hacks like ℕ𝔼𝕎 𝕐𝕆ℝ𝕂)
    • Serif Outline
    • Maybe a better Polytonic greek?
  • Move MediaWiki:Proofreadpage_index_template to a module
  • Move Template:Header to module

Half-doneEdit

  • Ebook review process leading to categorisation, then... Category:Ready for export
  • Improve index autofill to fetch author links from Commons creator templates: Getting there: Mediawiki:Gadget-Fill Index.js
  • Fix {{FI}} which is invoking full-size images every single time. Merge with and/or deprecate {{large image}}.
  • Fix headers on mobile, the tabular structure is unfriendly on narrow screens (main header done, other namespaces pending main header module-ificaton). See {{header/main block}}

DoneEdit