History

Merge pull request #2344 from djpowers/include-search-aliases-docs-json

Add field to docs.json denoting available aliases

Simon Legner committed 1 year ago

Commit 002eb722 parents 22abb7d 050022b6 files · +45 −42Browse files

Showing the changes to lib (2 of 6 files). Show all

Unified · Split

2 files
  1. lib/app.rb +36 −0
  2. lib/docs/core/manifest.rb +1 −0
lib/app.rb+36−0
@@ -33,6 +33,42 @@ 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
36 set :csp, false72 set :csp, false
37 73
38 require 'docs'74 require 'docs'
lib/docs/core/manifest.rb+1−0
@@ -20,6 +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 result << json24 result << json
24 end25 end
25 end26 end