feat: tumblr grammar with highlights, injections, and tests
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
==================
|
||||
Simple block
|
||||
==================
|
||||
|
||||
{block:Posts}{/block:Posts}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(block_open
|
||||
(block_name))
|
||||
(block_close
|
||||
(block_name))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Block with content
|
||||
==================
|
||||
|
||||
{block:Posts}<article>{Body}</article>{/block:Posts}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(block_open
|
||||
(block_name))
|
||||
(content)
|
||||
(variable
|
||||
(variable_name))
|
||||
(content)
|
||||
(block_close
|
||||
(block_name))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Nested blocks
|
||||
==================
|
||||
|
||||
{block:Posts}{block:Text}{Body}{/block:Text}{/block:Posts}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(block_open
|
||||
(block_name))
|
||||
(block_open
|
||||
(block_name))
|
||||
(variable
|
||||
(variable_name))
|
||||
(block_close
|
||||
(block_name))
|
||||
(block_close
|
||||
(block_name))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Block with one attribute
|
||||
==================
|
||||
|
||||
{block:Photoset rows="3"}{Photoset}{/block:Photoset}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(block_open
|
||||
(block_name)
|
||||
(attributes
|
||||
(attribute
|
||||
(attribute_name)
|
||||
(attribute_value))))
|
||||
(variable
|
||||
(variable_name))
|
||||
(block_close
|
||||
(block_name))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Block with multiple attributes
|
||||
==================
|
||||
|
||||
{block:Photoset rows="3" gutter="10px"}{/block:Photoset}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(block_open
|
||||
(block_name)
|
||||
(attributes
|
||||
(attribute
|
||||
(attribute_name)
|
||||
(attribute_value))
|
||||
(attribute
|
||||
(attribute_name)
|
||||
(attribute_value))))
|
||||
(block_close
|
||||
(block_name))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Case insensitive block keyword
|
||||
==================
|
||||
|
||||
{Block:Photo}{/Block:Photo}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(block_open
|
||||
(block_name))
|
||||
(block_close
|
||||
(block_name))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Conditional block
|
||||
==================
|
||||
|
||||
{block:IfShowSidebar}{block:IfNotHidden}content{/block:IfNotHidden}{/block:IfShowSidebar}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(block_open
|
||||
(block_name))
|
||||
(block_open
|
||||
(block_name))
|
||||
(content)
|
||||
(block_close
|
||||
(block_name))
|
||||
(block_close
|
||||
(block_name))
|
||||
(content))
|
||||
@@ -0,0 +1,38 @@
|
||||
==================
|
||||
Plain HTML, no tags
|
||||
==================
|
||||
|
||||
<html><body><h1>Hello</h1></body></html>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content))
|
||||
|
||||
==================
|
||||
Stray opening brace
|
||||
==================
|
||||
|
||||
function foo() { return 1; }
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content))
|
||||
|
||||
==================
|
||||
CSS embedded in style
|
||||
==================
|
||||
|
||||
<style>
|
||||
body { background: {color:Background}; }
|
||||
</style>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(variable
|
||||
(variable_prefix)
|
||||
(prefix_argument))
|
||||
(content))
|
||||
@@ -0,0 +1,27 @@
|
||||
==================
|
||||
Simple lang tag
|
||||
==================
|
||||
|
||||
{lang:Source}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(lang_tag
|
||||
(lang_text))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Lang tag with spaces and punctuation
|
||||
==================
|
||||
|
||||
{lang:Read more, please}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(lang_tag
|
||||
(lang_text))
|
||||
(content))
|
||||
@@ -0,0 +1,103 @@
|
||||
==================
|
||||
Plain variable
|
||||
==================
|
||||
|
||||
{Title}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(variable
|
||||
(variable_name))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Variable with numeric size suffix
|
||||
==================
|
||||
|
||||
{PortraitURL-128}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(variable
|
||||
(variable_name)
|
||||
(variable_modifier))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Variable with named size suffix
|
||||
==================
|
||||
|
||||
{PhotoURL-HighRes}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(variable
|
||||
(variable_name)
|
||||
(variable_modifier))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Multiple variables with text between
|
||||
==================
|
||||
|
||||
<h1>{Title}</h1>
|
||||
<p>{Description}</p>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(variable
|
||||
(variable_name))
|
||||
(content)
|
||||
(variable
|
||||
(variable_name))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Prefixed variable
|
||||
==================
|
||||
|
||||
{color:Background} {font:Body} {image:Header} {text:Tagline}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(variable
|
||||
(variable_prefix)
|
||||
(prefix_argument))
|
||||
(content)
|
||||
(variable
|
||||
(variable_prefix)
|
||||
(prefix_argument))
|
||||
(content)
|
||||
(variable
|
||||
(variable_prefix)
|
||||
(prefix_argument))
|
||||
(content)
|
||||
(variable
|
||||
(variable_prefix)
|
||||
(prefix_argument))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Prefix argument with spaces
|
||||
==================
|
||||
|
||||
{text:Header Subtitle}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(variable
|
||||
(variable_prefix)
|
||||
(prefix_argument))
|
||||
(content))
|
||||
Reference in New Issue
Block a user