@@ -179,14 +179,11 @@ buildDocs = (watch = no) ->
179179 sectionsSourceFolder = ' documentation/sections'
180180 examplesSourceFolder = ' documentation/examples'
181181 outputFolder = " docs/v#{ majorVersion} "
182- searchCollections = docs : [], changelogs : []
183182 {structure } = require " ./documentation/structure.coffee"
184183
185- monthNames = [' January' , ' February' , ' March' , ' April' , ' May' , ' June' , ' July' , ' August' , ' September' , ' October' , ' November' , ' December' ]
186-
187- formatDate = (date ) ->
188- date .replace / ^ (\d\d\d\d )-(\d\d )-(\d\d )$ / , (match , $1 , $2 , $3 ) ->
189- " #{ monthNames[$2 - 1 ]} #{ + $3} , #{ $1} "
184+ searchCollections =
185+ docs : []
186+ changelogs : []
190187
191188 # Helpers
192189 releaseHeader = (date , version , prevVersion ) ->
@@ -198,6 +195,11 @@ buildDocs = (watch = no) ->
198195 </h2>
199196 """
200197
198+ monthNames = [' January' , ' February' , ' March' , ' April' , ' May' , ' June' , ' July' , ' August' , ' September' , ' October' , ' November' , ' December' ]
199+ formatDate = (date ) ->
200+ date .replace / ^ (\d\d\d\d )-(\d\d )-(\d\d )$ / , (match , $1 , $2 , $3 ) ->
201+ " #{ monthNames[$2 - 1 ]} #{ + $3} , #{ $1} "
202+
201203 codeFor = require " ./documentation/site/code.coffee"
202204
203205 # Template for search results.
@@ -241,7 +243,7 @@ buildDocs = (watch = no) ->
241243 .replace / ^ \s + / g , " "
242244
243245 # Build search catalog.
244- searchCatalogue = (mdDoc , section , data ) ->
246+ searchCatalog = (mdDoc , section , data ) ->
245247 return unless match = / ^ (#+? )\s + ([^ \n ] + )\s + ([\s\S ] + )/ .exec mdDoc
246248 [, level , title , body ] = match
247249 content = clean body
@@ -293,7 +295,7 @@ buildDocs = (watch = no) ->
293295 md = md .replace / <%= releaseHeader %>/ g , releaseHeader
294296 md = md .replace / <%= majorVersion %>/ g , majorVersion
295297 md = md .replace / <%= fullVersion %>/ g , CoffeeScript .VERSION
296- searchCatalogue md, file, searchData
298+ searchCatalog md, file, searchData
297299 html = markdownRenderer .render md
298300 html = _ .template (html)
299301 codeFor : codeFor ()
@@ -391,11 +393,14 @@ buildDocs = (watch = no) ->
391393 window.searchResultTemplate = #{ searchResultsTemplate} ;
392394 window.searchResultsListTemplate = #{ searchResultsListTemplate} ;
393395 window.searchCollections = #{ JSON .stringify searchCollections} ;
396+ window.initializeSearch();
394397 """
395398 fs .writeFileSync " #{ outputFolder} /search-index.js" , searchIdx
399+ log ' output' , green, " #{ outputFolder} /search-index.js"
396400 fs .writeFileSync " #{ outputFolder} /index.html" , output
397401 log ' compiled' , green, " #{ indexFile} → #{ outputFolder} /index.html"
398402 try
403+ fs .symlinkSync " v#{ majorVersion} /search-index.js" , ' docs/search-index.js'
399404 fs .symlinkSync " v#{ majorVersion} /index.html" , ' docs/index.html'
400405 catch exception
401406
0 commit comments