You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pdfy/lib/template-util.coffee

16 lines
513 B
CoffeeScript

moment = require "moment"
module.exports = (req, res, next) ->
res.locals.conditionalClasses = (always, conditionals) ->
applicableConditionals = (className for className, condition of conditionals when condition)
applicableClasses = always.concat applicableConditionals
return applicableClasses.join " "
res.locals.makeBreakable = (string) ->
require("jade/lib/runtime").escape(string).replace(/_/g, "_<wbr>")
res.locals.shortDate = (date) ->
moment(date).format "MMM Do, YYYY hh:mm:ss"
next()