Fix Docs.aliases

pull/2361/head
Simon Legner 2 months ago
parent 83c4a189c1
commit 5e02d779a1

@ -33,46 +33,11 @@ class App < Sinatra::Application
set :default_docs, %w(css dom html http javascript) set :default_docs, %w(css dom html http javascript)
set :news_path, File.join(root, assets_prefix, 'javascripts', 'news.json') set :news_path, File.join(root, assets_prefix, 'javascripts', 'news.json')
set :docs_aliases, {
'angular' => 'ng',
'angular.js' => 'ng',
'backbone.js' => 'bb',
'c++' => 'cpp',
'coffeescript' => 'cs',
'crystal' => 'cr',
'elixir' => 'ex',
'javascript' => 'js',
'julia' => 'jl',
'jquery' => '$',
'knockout.js' => 'ko',
'kubernetes' => 'k8s',
'less' => 'ls',
'lodash' => '_',
'löve' => 'love',
'marionette' => 'mn',
'markdown' => 'md',
'matplotlib' => 'mpl',
'modernizr' => 'mdr',
'moment.js' => 'mt',
'openjdk' => 'java',
'nginx' => 'ngx',
'numpy' => 'np',
'pandas' => 'pd',
'postgresql' => 'pg',
'python' => 'py',
'ruby.on.rails' => 'ror',
'ruby' => 'rb',
'rust' => 'rs',
'sass' => 'scss',
'tensorflow' => 'tf',
'typescript' => 'ts',
'underscore.js' => '_',
}
set :csp, false set :csp, false
require 'docs' require 'docs'
Docs.generate_manifest Docs.generate_manifest
set :docs_aliases, Docs.aliases
Dir[docs_path, root.join(assets_prefix, '*/')].each do |path| Dir[docs_path, root.join(assets_prefix, '*/')].each do |path|
sprockets.append_path(path) sprockets.append_path(path)

@ -108,6 +108,44 @@ module Docs
store_class.new(store_path) store_class.new(store_path)
end end
def self.aliases
{
'angular' => 'ng',
'angular.js' => 'ng',
'backbone.js' => 'bb',
'c++' => 'cpp',
'coffeescript' => 'cs',
'crystal' => 'cr',
'elixir' => 'ex',
'javascript' => 'js',
'julia' => 'jl',
'jquery' => '$',
'knockout.js' => 'ko',
'kubernetes' => 'k8s',
'less' => 'ls',
'lodash' => '_',
'löve' => 'love',
'marionette' => 'mn',
'markdown' => 'md',
'matplotlib' => 'mpl',
'modernizr' => 'mdr',
'moment.js' => 'mt',
'openjdk' => 'java',
'nginx' => 'ngx',
'numpy' => 'np',
'pandas' => 'pd',
'postgresql' => 'pg',
'python' => 'py',
'ruby.on.rails' => 'ror',
'ruby' => 'rb',
'rust' => 'rs',
'sass' => 'scss',
'tensorflow' => 'tf',
'typescript' => 'ts',
'underscore.js' => '_',
}
end
extend Instrumentable extend Instrumentable
def self.install_report(*names) def self.install_report(*names)

@ -20,7 +20,7 @@ module Docs
if doc.options[:attribution].is_a?(String) if doc.options[:attribution].is_a?(String)
json[:attribution] = doc.options[:attribution].strip json[:attribution] = doc.options[:attribution].strip
end end
json[:alias] = App.docs_aliases[json["slug"].try(:to_sym)] json[:alias] = Docs.aliases[json["slug"].try(:to_sym)]
result << json result << json
end end
end end

Loading…
Cancel
Save