Skip to content

Instantly share code, notes, and snippets.

@PaulMaynard
Created December 16, 2013 03:11
Show Gist options
  • Save PaulMaynard/7981774 to your computer and use it in GitHub Desktop.
Save PaulMaynard/7981774 to your computer and use it in GitHub Desktop.
Html tag template in mustache
<!doctype html>
<a href="/">link</a>
<img src="/img.png">
<div contenteditable></div>
{{#tags}}
<{{name}}{{#attrs}} {{name}}{{#value}}="{{{value}}}"{{/value}}{{/attrs}}>{{^empty}}{{{content}}}</{{name}}>{{/empty}}
{{/tags}}
{
"tags": [
{
"name": "!doctype",
"attrs": [
{
"name": "html"
}
],
"empty": true
},
{
"name": "a",
"attrs": [
{
"name": "href",
"value": "/"
}
],
"content": "link"
},
{
"name": "img",
"attrs": [
{
"name": "src",
"value": "/img.png"
}
],
"empty": true
},
{
"name": "div",
"attrs": [
{
"name": "contenteditable"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment