Rosetta Code talk:Village Pump/Javascript Functionality Add
Language comparison script
Rosetta Code:Language comparison script
This script puts checkboxes next to each language in the ToC which can be checked to compare a number of languages. I chose to leave them underneath the ToC rather than floating them next to it due to the observation that many of the examples have fairly long line lengths, making side-by-side comparison rather difficult space-wise.
--Tyrok1 00:16, 20 May 2010 (UTC)
- I took the liberty of playing around a bit with the DOM after your script did its job: File:Compare Languages Concept.png. Depending on the display resolution a side-by-side comparison of at least two languages should be possible in most cases, I think. The ToC in its smaller form there might need work; that doesn't look too compelling yet, but it's at least much shorter (vertically) than before. But that was just a rough idea what could be done. Overall I think a side-by-side view would be quite nice to have. —Johannes Rössel 06:22, 20 May 2010 (UTC)
- Jeepers, have you got a large screen. :) I'll see what I can do. --Tyrok1 14:07, 20 May 2010 (UTC)
- New version's up at the same link - Rosetta Code:Language comparison script Please let me know what you think. --Tyrok1 21:01, 21 May 2010 (UTC)
- The script is on its own page now. The links are updated to reflect this. --Tyrok1 03:19, 23 May 2010 (UTC)
- Updated links after moving page to Rosetta Code namespace. --Tyrok1 03:18, 25 May 2010 (UTC)
Direct links to language examples when coming from a language page
Just a random thought/idea: Since languages are categories they simply aggregate all pages that are tagged with that category. For languages hwoever, there is also a pretty rigid structure on this site concerning where the interesting part (concerning a particular language) is on a task page. Currently the links to the tasks from a language page simlpy link to the task page (which for a normal Wiki is fine since it's the page that's in the category, not a section). But on RC those links could – theoretically – link directly to the appropriate section (which is probably what a user might expect when clicking on a task link on a language page).
For most languages this is rather simple, I think, since the anchor name on the task page is identical to the language's name (which is also the category name for that language). However, for a few languages, including C# and F#, this doesn't quite work, as their categories are named »C sharp« and »F sharp« and the anchors use »C.23« and »F.23« (apparently url-encoded and %
replaced by .
). The name used in the anchors appears to be nowhere to grab for JS on the language page, although this might be solvable with converting the infobox into a template which makes the intended/canonical name accessible via a <span class='intended-name'>
or so. –Johannes Rössel 21:18, 21 May 2010 (UTC)