Skip to content

Instantly share code, notes, and snippets.

@thundergnat
Last active January 23, 2023 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thundergnat/c5a86a6d5e0018ac67bdea3fc48786a0 to your computer and use it in GitHub Desktop.
Save thundergnat/c5a86a6d5e0018ac67bdea3fc48786a0 to your computer and use it in GitHub Desktop.
Tampermonkey / Greasemonkey script to add Language link parameters to Rosettacode Language Category pages
@thundergnat
Copy link
Author

thundergnat commented Jun 8, 2021

Version 0.8 - 2023-01-22

Site updated to MediaWiki 1.39. The page title format changed
slightly. Update code for new format. (It's actually a little less
touchy-feely now, should be a little more robust.)

Version 0.7 - 2021-06-16

Fix typo in specialCase dictionary.

Add fixup for Icon / Unicon task link. They mostly seem to be the
same, vastly more have the composite task link than don't.

Still don't know what to do about Mathematica / Wolfram language
links. I don't even understand why those are listed as two separate
categories. AFAICT, Wolfram language is only used in Mathematica,
and Mathematica only uses Wolfram language. One should just be
a redirect to the other... but what do I know. ¯\_(ツ)_/¯ Whatever.
I'm not going to go nuts trying to compensate for it.

Version 0.6:

Compensate for languages that have an initial lowercase letter in
their name.  Rosettacode (mediawikia) automatically title-cases
category pages,  erroneously upper-casing initial letter of language
name.
    
Compensate with a look-up table of known lower-case names.
I may have missed some.  Still depends on the entry authors
using the correct case in the entry header. If that is wrong all bets
are off. Sed (sed) especially seems to be bad for that. 

Version 0.5:

 Add update and download links.

 Re-arrange logic and tidy a bit. Mostly cosmetic polishing.

Version 0.4:

Use a real encoding function rather than cobbled together bespoke solution.

Fail early and reduce unnecessary work if it is a non-Language Category page.

Better variable names. Cut out some intermediate variables.

Fix bug with languages with no examples getting bogus links

Version 0.3:

 Fix a bunch of typos; mostly but not completely non-functional typos.

Version 0.2:

 Works for most languages.

 Languages with few example aren't picked up correctly.

 Announced publicly.

Version 0.1:

 It sort-of works, but isn't really ready for public consumption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment