0

I want to update the HTML bundle so that the head snippet outputs <meta charset="utf-8"> instead of <meta http-equiv="Content-type" content="text/html; charset=utf-8"> if the doctype is HTML5. How?

This is what it looks like now in the Bundle Editor:

<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>
ma11hew28
  • 121,420
  • 116
  • 450
  • 651

1 Answers1

1

Textmate allows you to interpolate shell code into snippets. The shell code is evaluated and placed inline. So you could write some Ruby (or some other code: maybe Perl or some funky combination of old-school sed, grep, awk, etc.) that can extract out the doctype. Then test on the result in an if-then block and echo whichever head you'd prefer.

Jason Marcell
  • 2,785
  • 5
  • 28
  • 41