diff --git a/Cakefile b/Cakefile index bc20a894..e92bbea1 100644 --- a/Cakefile +++ b/Cakefile @@ -159,31 +159,7 @@ task 'doc:site', 'watch and continually rebuild the documentation for the websit """ - codeFor = -> - counter = 0 - hljs = require 'highlight.js' - hljs.configure classPrefix: '' - (file, executable = false, showLoad = true) -> - counter++ - cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8' - js = CoffeeScript.compile cs, bare: yes - js = js.replace /^\/\/ generated.*?\n/i, '' - - cshtml = "
#{hljs.highlight('coffeescript', cs).value}"
- # Temporary fix until highlight.js adds support for newer CoffeeScript keywords
- # Added in https://github.com/isagalaev/highlight.js/pull/1357, awaiting release
- if file in ['generator_iteration', 'generators', 'modules']
- cshtml = cshtml.replace /(yield|import|export|from|as|default) /g, '$1 '
- jshtml = "#{hljs.highlight('javascript', js).value}"
- append = if executable is yes then '' else "alert(#{executable});".replace /"/g, '"'
- if executable and executable isnt yes
- cs.replace /(\S)\s*\Z/m, "$1\n\nalert #{executable}"
- run = if executable is true then 'run' else "run: #{executable}"
- name = "example#{counter}"
- script = ""
- load = if showLoad then "" else ''
- button = if executable then """""" else ''
- "#{hljs.highlight('coffeescript', cs).value}"
+ # Temporary fix until highlight.js adds support for newer CoffeeScript keywords
+ # Added in https://github.com/isagalaev/highlight.js/pull/1357, awaiting release
+ if file in ['generator_iteration', 'generators', 'modules']
+ cshtml = cshtml.replace /(yield|import|export|from|as|default) /g, '$1 '
+ jshtml = "#{hljs.highlight('javascript', js).value}"
+ append = if executable is yes then '' else "alert(#{executable});".replace /"/g, '"'
+ if executable and executable isnt yes
+ cs.replace /(\S)\s*\Z/m, "$1\n\nalert #{executable}"
+ run = if executable is yes then 'run' else "run: #{executable}"
+ name = "example#{counter}"
+ script = ""
+ load = if showLoad then "" else ''
+ button = if executable then """""" else ''
+ "