开发者

How can I use literal HTML in a CoffeeKup template?

I'm becoming a huge fan of CoffeeKup, 开发者_Go百科but I'm wondering how I can use literal HTML in such a template? For example when I just want to copy-paste some existing, non-CoffeeKup markup.


You can add arbitrary text with the text function:

text '<p>foo</p>'

For multiline strings, CoffeeScript's heredocs are a pleasure:

text '''
  <table>
    <tr>
      <td>Foo</td>
    </tr>
  </table>
'''

Just make sure you have autoescape set to false (the default value).


Have you tried using this tool too for converting your markup instead of just inlining in?

https://github.com/brandonbloom/html2coffeekup

It's linked from the main github page of coffeekup. If it handles your old markup it would be a more elegant solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜