<span class="mw-page-title-main">Dates2wiki</span>
Fabrice P. Lauss𝕪's Web

dates2wiki

dates2wiki turns a date written for humans into the template that links it on my web: select the date anywhere on the screen, press Ctrl+Alt+D, and the selection is replaced by its {{thisday}} or {{thesedays}} call. It keeps the company of bib2wiki and keys2wiki.

Written with Claude Opus 5 on 3 August (2026) for KDE Plasma 6 on X11. Version 1.1.

What it does

You select You get which renders as
5 September 2024 {{thisday|5|September|2024}} 5 September (2024)
September 5, 2024 {{thisday|5|September|2024}} the same, and so does 2024-09-05
October 16 to 18, 2026 {{thesedays|16|18|October|2026}} 1618 October (2026)
30 October to 2 November 2026 {{thesedays|30|October|2|November|2026}} 30 October2 November (2026)
23 November 1876, Cádiz, Spain – 14 November 1946, Alta Gracia {{thisday|23|November|1876}}—{{thisday|14|November|1946}} 23 November (1876)14 November (1946)

Two different years is not a span, so a lifespan comes out as two {{thisday}} joined by an em-dash, and the text in between is dropped. Months are also read in Spanish and French, so 16 al 18 de octubre de 2026 works too. Numeric dates such as 5/9/2024 are deliberately not parsed: day-month and month-day cannot be told apart.

Usage

dates2wiki '5 September 2024'   # convert its arguments
dates2wiki < file               # ...or stdin
dates2wiki --paste              # convert the selection and paste it back (Ctrl+Alt+D)
dates2wiki --copy               # ...to the clipboard only
dates2wiki --inplace            # keep the sentence, rewrite only the dates

With --inplace, « We met on 5 September 2024 in Madrid » keeps its prose and only the date becomes a template.

Notes

  • Python, with nothing to install beyond xclip and xprop. The script is ~/bin/dates2wiki; the shortcut is ~/.local/share/applications/net.local.dates2wiki.desktop declared in ~/.config/kglobalshortcutsrc, the same way as TeX2unicode.
  • It reads the X PRIMARY selection, so what you swiped with the mouse is what it converts. The result always goes to the clipboard as well, so a paste that misses is never a lost result.
  • The paste keystroke is synthesised with explicit hardware keycodes, never with xdotool, which rewrites the keymap and wrecks a multiple-layout keyboard. Which keystroke that is depends on the application (Ctrl+Y in Emacs, Ctrl+Shift+V in a terminal).
  • If the selection holds no date at all, nothing is touched and a notification says so.