Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lowercase with Jade template

I'm using jade in a nodejs project

Can't find how to define filters

I have categories that i want to display in a select box, lowercase option values and uppercase option text

select
  each cat in categories
    option(value="lowercase(#{cat})") uppercase(#{cat})

any idea ?

like image 603
Louis Grellet Avatar asked Aug 03 '12 10:08

Louis Grellet


2 Answers

Why are you not using the native JavaScript functions to do so?

select
  each cat in categories
    option(value=cat.toLowerCase())= cat.toUpperCase()
like image 157
Amberlamps Avatar answered Nov 13 '22 22:11

Amberlamps


You can also use:

select
  each cat in categories
    option(value=#{cat.toLowerCase()}) #{cat.toUpperCase()}
like image 4
Gaoping Avatar answered Nov 13 '22 21:11

Gaoping