Skip to content

Commit 5e02d77

Browse files
committed
Fix Docs.aliases
1 parent 83c4a18 commit 5e02d77

File tree

3 files changed

+40
-37
lines changed

3 files changed

+40
-37
lines changed

lib/app.rb

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,46 +33,11 @@ class App < Sinatra::Application
3333
set :default_docs, %w(css dom html http javascript)
3434
set :news_path, File.join(root, assets_prefix, 'javascripts', 'news.json')
3535

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-
7236
set :csp, false
7337

7438
require 'docs'
7539
Docs.generate_manifest
40+
set :docs_aliases, Docs.aliases
7641

7742
Dir[docs_path, root.join(assets_prefix, '*/')].each do |path|
7843
sprockets.append_path(path)

lib/docs.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,44 @@ def self.store
108108
store_class.new(store_path)
109109
end
110110

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+
111149
extend Instrumentable
112150

113151
def self.install_report(*names)

lib/docs/core/manifest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def as_json
2020
if doc.options[:attribution].is_a?(String)
2121
json[:attribution] = doc.options[:attribution].strip
2222
end
23-
json[:alias] = App.docs_aliases[json["slug"].try(:to_sym)]
23+
json[:alias] = Docs.aliases[json["slug"].try(:to_sym)]
2424
result << json
2525
end
2626
end

0 commit comments

Comments
 (0)