beautifier / js-beautify

Beautifier for javascript
https://beautifier.io
MIT License
8.57k stars 1.37k forks source link

golang template #389

Open chujialiang opened 10 years ago

chujialiang commented 10 years ago

Excuse me! How to support for golang html/template ? e.g. "{{" or "}}"

bitwiseman commented 10 years ago

Please provide an example of input, expected output, and actual output.

chujialiang commented 10 years ago

Thanks a lot! I hope in html file ,e.g. {{template "header" .}} {{template "mainbar" . }} {{.LayoutContent}} {{template "footer" .}}

can output :

{{template "header" .}} {{template "mainbar" . }} {{.LayoutContent}} {{template "footer" .}}

instead of displying in line

Sincerely Chu Jialiang

2014-01-30 3:00 GMT+08:00 Liam Newman notifications@github.com:

Please provide an example of input, expected output, and actual output.

— Reply to this email directly or view it on GitHubhttps://github.com/einars/js-beautify/issues/389#issuecomment-33617566 .

楚甲良

深圳市赛格导航科技股份有限公司 MSN:chujialiang@hotmail.com 公司地址:深圳市南山区科技园南区T-2栋B座6层

电话:(0755)26719988(总机) 26719590(直线) 手机:13823546855 邮编:518057 E-mail:chujialiang@gmail.com QQ:1417161847 http://www.chinagps.cc

matttproud commented 7 years ago

Package text/template outlines the syntax and behavior of templates in the Go Programming Language.

bitwiseman commented 7 years ago

Thanks for the link!

andreynering commented 6 years ago

I know this is an old issue, but this would be nice to have.

Basically indent {{if ...}}...{{end}}, {{if ...}}...{{else}}...{{end}}, {{range $v, $k := .Foobar}}...{{end}}, etc just like it indent HTML tags.

Currently it sometimes do things similar to this:

{{if .Foo}}
  <div>...</div>{{end}} <!-- this should be aligned with the if above -->