【问题标题】:Formatting ejs template files in emacs在 emacs 中格式化 ejs 模板文件
【发布时间】:2015-01-11 21:44:46
【问题描述】:

有没有可以正确格式化ejs模板文件的emacs模式。

示例 EJS 模板文件

<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <b> <%= doc.session_name %> </b>
    <ul>
      <% var p = {}; %>
      <% var coinInitialPositions = [-1, -1]; %>
      <% for (var i = 0; i < doc.moves.length; ++i) { %>
     <% if (doc.moves[i].type === 'dice_values') { %>
     <%     if (typeof p[doc.moves[i].player] === 'undefined') { %>
         <%        p[doc.moves[i].player] = []; %>
         <%     } %>
     <%     p[doc.moves[i].player] = p[doc.moves[i].player].concat(doc.moves[i].values); %>
     <% } %>

     <li>
        <%= i + " " + JSON.stringify(doc.moves[i]) %>
     </li>
      <% } %>
    </ul>
    <% for (var player in p) { %>
    <li>
      <b> <%= player + ": [" + p[player] + "]"%> </b>
    <li>
      <% } %>
    </body>
</head>

【问题讨论】:

标签: node.js express emacs ejs embedded-javascript


【解决方案1】:

你应该看看web-mode.el,它与ejs的兼容性很好

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-02
    • 1970-01-01
    • 2017-02-17
    • 2010-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多