History

Fix Docs.aliases

Simon Legner committed 1 year ago

Commit 5e02d771 parent 83c4a183 files · +40 −37Browse files

Unified · Split

3 files
  1. lib/app.rb +1 −36
  2. lib/docs.rb +38 −0
  3. lib/docs/core/manifest.rb +1 −1
lib/app.rb+1−36
@@ -33,46 +33,11 @@ class App < Sinatra::Application · 32 unmodified lines
33 set :default_docs, %w(css dom html http javascript)33 set :default_docs, %w(css dom html http javascript)
34 set :news_path, File.join(root, assets_prefix, 'javascripts', 'news.json')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
72 set :csp, false36 set :csp, false
73 37
74 require 'docs'38 require 'docs'
75 Docs.generate_manifest39 Docs.generate_manifest
40 set :docs_aliases, Docs.aliases
76 41
77 Dir[docs_path, root.join(assets_prefix, '*/')].each do |path|42 Dir[docs_path, root.join(assets_prefix, '*/')].each do |path|
78 sprockets.append_path(path)43 sprockets.append_path(path)
lib/docs.rb+38−0
@@ -108,6 +108,44 @@ module Docs · 107 unmodified lines
108 store_class.new(store_path)108 store_class.new(store_path)
109 end109 end
110 110
111 def self.aliases
112 {
113 'angular' => 'ng',
114 'angular.js' => 'ng',
115 'backbone.js' => 'bb',
116 'c++' => 'cpp',
117 'coffeescript' => 'cs',
118 'crystal' => 'cr',
119 'elixir' => 'ex',
120 'javascript' => 'js',
121 'julia' => 'jl',
122 'jquery' => '$',
123 'knockout.js' => 'ko',
124 'kubernetes' => 'k8s',
125 'less' => 'ls',
126 'lodash' => '_',
127 'löve' => 'love',
128 'marionette' => 'mn',
129 'markdown' => 'md',
130 'matplotlib' => 'mpl',
131 'modernizr' => 'mdr',
132 'moment.js' => 'mt',
133 'openjdk' => 'java',
134 'nginx' => 'ngx',
135 'numpy' => 'np',
136 'pandas' => 'pd',
137 'postgresql' => 'pg',
138 'python' => 'py',
139 'ruby.on.rails' => 'ror',
140 'ruby' => 'rb',
141 'rust' => 'rs',
142 'sass' => 'scss',
143 'tensorflow' => 'tf',
144 'typescript' => 'ts',
145 'underscore.js' => '_',
146 }
147 end
148
111 extend Instrumentable149 extend Instrumentable
112 150
113 def self.install_report(*names)151 def self.install_report(*names)
lib/docs/core/manifest.rb+1−1
@@ -20,7 +20,7 @@ module Docs · 19 unmodified lines
20 if doc.options[:attribution].is_a?(String)20 if doc.options[:attribution].is_a?(String)
21 json[:attribution] = doc.options[:attribution].strip21 json[:attribution] = doc.options[:attribution].strip
22 end22 end
23 json[:alias] = App.docs_aliases[json["slug"].try(:to_sym)]23 json[:alias] = Docs.aliases[json["slug"].try(:to_sym)]
24 result << json24 result << json
25 end25 end
26 end26 end