Add field to docs.json denoting available aliases
Showing the changes to lib (2 of 6 files). Show all
Unified · Split
| @@ -33,6 +33,42 @@ class App < Sinatra::Application · 32 unmodified lines | ||
| 33 | 33 | set :default_docs, %w(css dom html http javascript) |
| 34 | 34 | set :news_path, File.join(root, assets_prefix, 'javascripts', 'news.json') |
| 35 | 35 | |
| 36 | + set :docs_aliases, { | |
| 37 | + 'angular' => 'ng', | |
| 38 | + 'angular.js' => 'ng', | |
| 39 | + 'backbone.js' => 'bb', | |
| 40 | + 'c++' => 'cpp', | |
| 41 | + 'coffeescript' => 'cs', | |
| 42 | + 'crystal' => 'cr', | |
| 43 | + 'elixir' => 'ex', | |
| 44 | + 'javascript' => 'js', | |
| 45 | + 'julia' => 'jl', | |
| 46 | + 'jquery' => '$', | |
| 47 | + 'knockout.js' => 'ko', | |
| 48 | + 'kubernetes' => 'k8s', | |
| 49 | + 'less' => 'ls', | |
| 50 | + 'lodash' => '_', | |
| 51 | + 'löve' => 'love', | |
| 52 | + 'marionette' => 'mn', | |
| 53 | + 'markdown' => 'md', | |
| 54 | + 'matplotlib' => 'mpl', | |
| 55 | + 'modernizr' => 'mdr', | |
| 56 | + 'moment.js' => 'mt', | |
| 57 | + 'openjdk' => 'java', | |
| 58 | + 'nginx' => 'ngx', | |
| 59 | + 'numpy' => 'np', | |
| 60 | + 'pandas' => 'pd', | |
| 61 | + 'postgresql' => 'pg', | |
| 62 | + 'python' => 'py', | |
| 63 | + 'ruby.on.rails' => 'ror', | |
| 64 | + 'ruby' => 'rb', | |
| 65 | + 'rust' => 'rs', | |
| 66 | + 'sass' => 'scss', | |
| 67 | + 'tensorflow' => 'tf', | |
| 68 | + 'typescript' => 'ts', | |
| 69 | + 'underscore.js' => '_', | |
| 70 | + } | |
| 71 | + | |
| 36 | 72 | set :csp, false |
| 37 | 73 | |
| 38 | 74 | require 'docs' |
| @@ -20,6 +20,7 @@ module Docs · 19 unmodified lines | ||
| 20 | 20 | if doc.options[:attribution].is_a?(String) |
| 21 | 21 | json[:attribution] = doc.options[:attribution].strip |
| 22 | 22 | end |
| 23 | + json[:alias] = App.docs_aliases[json["slug"].try(:to_sym)] | |
| 23 | 24 | result << json |
| 24 | 25 | end |
| 25 | 26 | end |