diff --git a/Gruntfile.coffee b/Gruntfile.coffee
index 426576abe..ac117e633 100755
--- a/Gruntfile.coffee
+++ b/Gruntfile.coffee
@@ -4,7 +4,7 @@ module.exports = (grunt) ->
"(innerHTML: #{JSON.stringify grunt.file.read("src/General/html/#{filename}.html").replace(/^\s+|\s+$
- parts = template.split /([\$&@]){([^}]*)}/
+ parts = template.split /([\$&@]){([^}`]*)}/
parts2 = []
checkText = ''
for part, i in parts
@@ -15,12 +15,10 @@ module.exports = (grunt) ->
when 1
if /<[^>]*$/.test(checkText) and not (part is '$' and /\=['"][^"'<>]*$/.test checkText)
throw new Error "Illegal insertion into HTML template: #{template}"
- expr = parts[i+1]
- expr = "(#{expr})" for x in parts[i+1].split ')'
parts2.push switch part
- when '$' then "E#{expr}"
- when '&' then "#{expr}.innerHTML"
- when '@' then "#{expr}.map((x) -> x.innerHTML).join('')"
+ when '$' then "E(`#{parts[i+1]}`)"
+ when '&' then "`#{parts[i+1]}`.innerHTML"
+ when '@' then "`#{parts[i+1]}`.map((x) -> x.innerHTML).join('')"
unless /^(<\w+( [\w-]+(='[^"'<>]*'|="[^"'<>]*")?)*>|<\/\w+>|[^"'<>]*)*$/.test checkText
throw new Error "HTML template is ill-formed: #{template}"
output = if parts2.length is 0 then '""' else parts2.join ' + '
diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee
index ea5555bbb..e0ed48f41 100755
--- a/src/Filtering/ThreadHiding.coffee
+++ b/src/Filtering/ThreadHiding.coffee
@@ -138,7 +138,7 @@ ThreadHiding =
a = $.el 'a',
className: "#{type}-thread-button"
href: 'javascript:;'
- $.extend a, <%= html('') %>
+ $.extend a, <%= html('') %>
a.dataset.fullID = thread.fullID
$.on a, 'click', ThreadHiding.toggle
a
diff --git a/src/General/Build.coffee b/src/General/Build.coffee
index 59973e2bf..e2b69bb2d 100755
--- a/src/General/Build.coffee
+++ b/src/General/Build.coffee
@@ -197,8 +197,8 @@ Build =
else if file and boardID is 'f'
<%= html(
'
' +
- 'File: ${file.name}' +
- '-(${$.bytesToString file.size}, ${file.width}x${file.height}, ${file.tag})' +
+ 'File: ${file.name}' +
+ '-(${$.bytesToString(file.size)}, ${file.width}x${file.height}, ${file.tag})' +
' '
) %>
else if file
@@ -215,7 +215,7 @@ Build =
fileThumb = file.turl
fileSize = $.bytesToString file.size
- fileDims = if file.url[-4..] is '.pdf' then 'PDF' else "#{+file.width}x#{+file.height}"
+ fileDims = if file.url[-4..] is '.pdf' then 'PDF' else "#{file.width}x#{file.height}"
fileLink = if file.isSpoiler or file.name is shortFilename
<%= html('${shortFilename}') %>
@@ -229,8 +229,8 @@ Build =
<%= html(
'&{fileText}' +
- '' +
- '
' +
+ '' +
+ '
' +
''
) %>
diff --git a/src/Miscellaneous/FileInfo.coffee b/src/Miscellaneous/FileInfo.coffee
index 703e0202d..27a01586b 100755
--- a/src/Miscellaneous/FileInfo.coffee
+++ b/src/Miscellaneous/FileInfo.coffee
@@ -19,10 +19,10 @@ FileInfo =
''
$.extend outputNode, <%= html('@{output}') %>
formatters:
- t: -> <%= html('${@file.URL.match(/\\d+\\..+$/)[0]}') %>
- T: -> <%= html('&{FileInfo.formatters.t.call @}') %>
- l: -> <%= html('&{FileInfo.formatters.n.call @}') %>
- L: -> <%= html('&{FileInfo.formatters.N.call @}') %>
+ t: -> <%= html('${this.file.URL.match(/\\d+\\..+$/)[0]}') %>
+ T: -> <%= html('&{FileInfo.formatters.t.call(this)}') %>
+ l: -> <%= html('&{FileInfo.formatters.n.call(this)}') %>
+ L: -> <%= html('&{FileInfo.formatters.N.call(this)}') %>
n: ->
fullname = @file.name
shortname = Build.shortFilename @file.name, @isReply
@@ -30,11 +30,11 @@ FileInfo =
<%= html('${fullname}') %>
else
<%= html('${shortname}${fullname}') %>
- N: -> <%= html('${@file.name}') %>
+ N: -> <%= html('${this.file.name}') %>
p: -> if @file.isSpoiler then <%= html('Spoiler, ') %> else <%= html('') %>
- s: -> <%= html('${@file.size}') %>
- B: -> <%= html('${Math.round @file.sizeInBytes} Bytes') %>
- K: -> <%= html('${Math.round(@file.sizeInBytes/1024)} KB') %>
- M: -> <%= html('${Math.round(@file.sizeInBytes/1048576*100)/100} MB') %>
- r: -> <%= html('${@file.dimensions or "PDF"}') %>
+ s: -> <%= html('${this.file.size}') %>
+ B: -> <%= html('${Math.round(this.file.sizeInBytes)} Bytes') %>
+ K: -> <%= html('${Math.round(this.file.sizeInBytes/1024)} KB') %>
+ M: -> <%= html('${Math.round(this.file.sizeInBytes/1048576*100)/100} MB') %>
+ r: -> <%= html('${this.file.dimensions || "PDF"}') %>
'%': -> <%= html('%') %>
diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee
index 393b497e9..b553ffa84 100755
--- a/src/Monitoring/ThreadStats.coffee
+++ b/src/Monitoring/ThreadStats.coffee
@@ -14,7 +14,7 @@ ThreadStats =
Header.addShortcut sc
else
@dialog = sc = UI.dialog 'thread-stats', 'bottom: 0px; right: 0px;',
- <%= html('&{countHTML}
') %>
+ <%= html('&{countHTML}
') %>
$.ready =>
$.add d.body, sc
diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee
index 2cb601c28..e4a7af336 100644
--- a/src/Posting/QR.coffee
+++ b/src/Posting/QR.coffee
@@ -46,7 +46,7 @@ QR =
link = $.el 'h1',
className: "qr-link-container"
- $.extend link, <%= html('${if g.VIEW is "thread" then "Reply to Thread" else "Start a Thread"}') %>
+ $.extend link, <%= html('${(g.VIEW === "thread") ? "Reply to Thread" : "Start a Thread"}') %>
QR.link = link.firstElementChild
$.on link.firstChild, 'click', ->