@@ -179,14 +179,11 @@ buildDocs = (watch = no) ->
179
179
sectionsSourceFolder = ' documentation/sections'
180
180
examplesSourceFolder = ' documentation/examples'
181
181
outputFolder = " docs/v#{ majorVersion} "
182
- searchCollections = docs : [], changelogs : []
183
182
{structure } = require " ./documentation/structure.coffee"
184
183
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 : []
190
187
191
188
# Helpers
192
189
releaseHeader = (date , version , prevVersion ) ->
@@ -198,6 +195,11 @@ buildDocs = (watch = no) ->
198
195
</h2>
199
196
"""
200
197
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
+
201
203
codeFor = require " ./documentation/site/code.coffee"
202
204
203
205
# Template for search results.
@@ -241,7 +243,7 @@ buildDocs = (watch = no) ->
241
243
.replace / ^ \s + / g , " "
242
244
243
245
# Build search catalog.
244
- searchCatalogue = (mdDoc , section , data ) ->
246
+ searchCatalog = (mdDoc , section , data ) ->
245
247
return unless match = / ^ (#+? )\s + ([^ \n ] + )\s + ([\s\S ] + )/ .exec mdDoc
246
248
[, level , title , body ] = match
247
249
content = clean body
@@ -293,7 +295,7 @@ buildDocs = (watch = no) ->
293
295
md = md .replace / <%= releaseHeader %>/ g , releaseHeader
294
296
md = md .replace / <%= majorVersion %>/ g , majorVersion
295
297
md = md .replace / <%= fullVersion %>/ g , CoffeeScript .VERSION
296
- searchCatalogue md, file, searchData
298
+ searchCatalog md, file, searchData
297
299
html = markdownRenderer .render md
298
300
html = _ .template (html)
299
301
codeFor : codeFor ()
@@ -391,11 +393,14 @@ buildDocs = (watch = no) ->
391
393
window.searchResultTemplate = #{ searchResultsTemplate} ;
392
394
window.searchResultsListTemplate = #{ searchResultsListTemplate} ;
393
395
window.searchCollections = #{ JSON .stringify searchCollections} ;
396
+ window.initializeSearch();
394
397
"""
395
398
fs .writeFileSync " #{ outputFolder} /search-index.js" , searchIdx
399
+ log ' output' , green, " #{ outputFolder} /search-index.js"
396
400
fs .writeFileSync " #{ outputFolder} /index.html" , output
397
401
log ' compiled' , green, " #{ indexFile} → #{ outputFolder} /index.html"
398
402
try
403
+ fs .symlinkSync " v#{ majorVersion} /search-index.js" , ' docs/search-index.js'
399
404
fs .symlinkSync " v#{ majorVersion} /index.html" , ' docs/index.html'
400
405
catch exception
401
406
0 commit comments