【问题标题】:TextMate Edit Bundle SnippetTextMate 编辑捆绑代码段
【发布时间】:2011-02-16 21:08:43
【问题描述】:

如果文档类型是 HTML5,我想更新 HTML 包,以便 head sn-p 输出 <meta charset="utf-8"> 而不是 <meta http-equiv="Content-type" content="text/html; charset=utf-8">。怎么样?

这就是现在捆绑编辑器中的样子:

<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8"${TM_XHTML}>
  <title>${1:${TM_FILENAME/((.+)\..*)?/(?2:$2:Page Title)/}}</title>
  $0
</head>

【问题讨论】:

    标签: conditional textmate bundle textmatebundles


    【解决方案1】:

    Textmate 允许您interpolate shell code into snippets。对 shell 代码进行评估并内联放置。因此,您可以编写一些 Ruby(或其他一些代码:可能是 Perl 或老式 sed、grep、awk 等的一些时髦组合)来提取文档类型。然后test 将结果放在 if-then 块中并回显您喜欢的任何头部。

    【讨论】:

      猜你喜欢
      • 2011-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多