Fixes #461.
Unified · Split
| @@ -39,10 +39,13 @@ class app.models.Doc extends app.Model · 38 unmodified lines | ||
| 39 | 39 | "#{app.indexHost()}/#{@slug}/#{app.config.index_filename}?#{@mtime}" |
| 40 | 40 | |
| 41 | 41 | toEntry: -> |
| 42 | − @entry ||= new app.models.Entry | |
| 42 | + return @entry if @entry | |
| 43 | + @entry = new app.models.Entry | |
| 43 | 44 | doc: @ |
| 44 | 45 | name: @fullName |
| 45 | 46 | path: 'index' |
| 47 | + @entry.addAlias(@name) if @version | |
| 48 | + @entry | |
| 46 | 49 | |
| 47 | 50 | findEntryByPathAndHash: (path, hash) -> |
| 48 | 51 | if hash and entry = @entries.findBy 'path', "#{path}##{hash}" |
| @@ -5,8 +5,13 @@ class app.models.Entry extends app.Model · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | constructor: -> |
| 7 | 7 | super |
| 8 | − @text = app.Searcher.normalizeString(@name) | |
| 9 | − @text = applyAliases(@text) | |
| 8 | + @text = applyAliases(app.Searcher.normalizeString(@name)) | |
| 9 | + | |
| 10 | + addAlias: (name) -> | |
| 11 | + text = applyAliases(app.Searcher.normalizeString(name)) | |
| 12 | + @text = [@text] unless Array.isArray(@text) | |
| 13 | + @text.push(if Array.isArray(text) then text[1] else text) | |
| 14 | + return | |
| 10 | 15 | |
| 11 | 16 | fullPath: -> |
| 12 | 17 | @doc.fullPath if @isIndex() then '' else @path |
| @@ -45,8 +50,9 @@ class app.models.Entry extends app.Model · 32 unmodified lines | ||
| 45 | 50 | return string |
| 46 | 51 | |
| 47 | 52 | @ALIASES = ALIASES = |
| 53 | + 'angular': 'ng' | |
| 48 | 54 | 'angular.js': 'ng' |
| 49 | − 'backbone': 'bb' | |
| 55 | + 'backbone.js': 'bb' | |
| 50 | 56 | 'c++': 'cpp' |
| 51 | 57 | 'coffeescript': 'cs' |
| 52 | 58 | 'elixir': 'ex' |