yosssi / ace

HTML template engine for Go
MIT License
835 stars 89 forks source link

Are conditionals possible? #81

Open elorest opened 6 years ago

elorest commented 6 years ago

In Haml, Slim, Slang I'm used to the following.

- if name.size > 10
  | You have a long name.
- else
  | You're name is average.

Is there anyway to achieve something similar with Ace?

rdbell commented 5 years ago
1   doctype html
  1 html(lang="en")
  2     head
  3         title= Title
  4     body
  5         h1= Title
  6         if SessionId == ""
  7             p Login
  8             p
  9                 form(method="POST")
 10                     div Username
 11                         input(type="text" name="username")
 12                     div Password
 13                         input(type="password" name="password")
 14                     div Secret Key
 15                         input(type="text" name="key")
 16                     div
 17                         input(type="submit" name="submit" value="Login")
 18         else
 19             p login complete
 20             p= SessionId