Rosetta Code tasks – viewing two languages side by side

A macro which:

  1. Takes you to the Rosetta Code task list, and then
  2. if you choose a task, shows you side-by-side the versions for two different languages

Rosetta Code tasks – two languages side by side.kmmacros (30.9 KB)

Note that the names of languages need to be spelled exactly as they appear on the Rosetta Code site, for example, it's case-sensitive, and AppleScript and JavaScript have caps both at the start and at the letter S.

2 Likes

A second version which adds Most Recently Used popup lists for languages and tasks.

Rosetta Code tasks – two languages side by side.kmmacros (41.9 KB)

(Use the OK button to choose a task selected from the MRU popup list, or the New task button to choose from the Rosetta Code task list page)

(These drop-downs require Yosemite – they use a bit of JavaScript for Applications to prune any duplicates out of the 'up to 12 most recently used' lists:

(function(strLangs, strLeft, strRight) {
  return [strLeft, strRight].concat(
    strLangs.split('|')
  ).reduce(
    function (u, x) {
      return u.indexOf(x) === -1 ? u.concat(x) : u;
    }, [] 
  ).slice(0,12).join('|')
})(
  "$KMVAR_langsVisited",
  "$KMVAR_left_language",
  "$KMVAR_right_language"
)
1 Like