diff options
| author | Georg Brandl <georg@python.org> | 2021-01-18 21:24:00 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2021-01-18 22:08:36 +0100 |
| commit | 2a3d3a7d5b9c60dedf6638d876161d9563faebcf (patch) | |
| tree | 809c0b4a686db98f5954afa1944404cd9652c6b2 /tests/lexers/html+handlebars | |
| parent | f0445be718da83541ea3401aad882f3937147263 (diff) | |
| download | pygments-git-examplefiles.tar.gz | |
Move test_examplefiles to new tests/lexers scheme.examplefiles
Diffstat (limited to 'tests/lexers/html+handlebars')
| -rw-r--r-- | tests/lexers/html+handlebars/example.txt | 276 | ||||
| -rw-r--r-- | tests/lexers/html+handlebars/example2.txt | 315 |
2 files changed, 591 insertions, 0 deletions
diff --git a/tests/lexers/html+handlebars/example.txt b/tests/lexers/html+handlebars/example.txt new file mode 100644 index 00000000..46409c9d --- /dev/null +++ b/tests/lexers/html+handlebars/example.txt @@ -0,0 +1,276 @@ +---input--- +<!-- post.handlebars --> + +<div class='intro'> + {{intro}} +</div> + +{{#if isExpanded}} + <div class='body'>{{body}}</div> + <button {{action contract}}>Contract</button> +{{else}} + <button {{action expand}}>Show More...</button> +{{/if}} + +{{> myPartial}} +{{> myPartial var="value" }} +{{> myPartial var=../value}} +{{> (myPartial)}} +{{> (myPartial) var="value"}} +{{> (lookup . "myPartial")}} +{{> ( lookup . "myPartial" ) var="value" }} +{{> (lookup ../foo "myPartial") var="value" }} +{{> @partial-block}} + +{{#>myPartial}} +... +{{/myPartial}} + +{{#*inline "myPartial"}} +... +{{/inline}} + +{{../name}} +{{./name}} +{{this/name}} + +---tokens--- +'<!--' Comment +' post.handlebars ' Comment +'-->' Comment +'\n\n' Text + +'<' Punctuation +'div' Name.Tag +' ' Text +'class' Name.Attribute +'=' Operator +"'intro'" Literal.String +'>' Punctuation +'\n ' Text +'{{' Comment.Preproc +'intro' Name.Variable +'}}' Comment.Preproc +'\n' Text + +'<' Punctuation +'/' Punctuation +'div' Name.Tag +'>' Punctuation +'\n\n' Text + +'{{' Comment.Preproc +'#' Literal.Number.Attribute +'if' Literal.Number.Attribute +' ' Text +'isExpanded' Name.Variable +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'div' Name.Tag +' ' Text +'class' Name.Attribute +'=' Operator +"'body'" Literal.String +'>' Punctuation +'{{' Comment.Preproc +'body' Name.Variable +'}}' Comment.Preproc +'<' Punctuation +'/' Punctuation +'div' Name.Tag +'>' Punctuation +'\n ' Text +'<' Punctuation +'button' Name.Tag +' ' Text +'{{' Comment.Preproc +'action' Name.Variable +' ' Text +'contract' Name.Variable +'}}' Comment.Preproc +'>' Punctuation +'Contract' Text +'<' Punctuation +'/' Punctuation +'button' Name.Tag +'>' Punctuation +'\n' Text + +'{{' Comment.Preproc +'else' Name.Variable +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'button' Name.Tag +' ' Text +'{{' Comment.Preproc +'action' Name.Variable +' ' Text +'expand' Name.Variable +'}}' Comment.Preproc +'>' Punctuation +'Show More...' Text +'<' Punctuation +'/' Punctuation +'button' Name.Tag +'>' Punctuation +'\n' Text + +'{{' Comment.Preproc +'/' Literal.Number.Attribute +'if' Literal.Number.Attribute +'}}' Comment.Preproc +'\n\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'myPartial' Name.Variable +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'myPartial' Name.Variable +' ' Text +'var' Name.Attribute +'=' Operator +'"value"' Literal.String.Double +' ' Text +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'myPartial' Name.Variable +' ' Text +'var' Name.Attribute +'=' Operator +'../value' Name.Variable +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'(' Punctuation +'myPartial' Name.Function +')' Punctuation +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'(' Punctuation +'myPartial' Name.Function +')' Punctuation +' ' Text +'var' Name.Attribute +'=' Operator +'"value"' Literal.String.Double +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'(' Punctuation +'lookup' Keyword +' ' Text +'.' Name.Variable +' ' Text +'"myPartial"' Literal.String.Double +')' Punctuation +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'(' Punctuation +' ' Text +'lookup' Keyword +' ' Text +'.' Name.Variable +' ' Text +'"myPartial"' Literal.String.Double +' ' Text +')' Punctuation +' ' Text +'var' Name.Attribute +'=' Operator +'"value"' Literal.String.Double +' ' Text +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'(' Punctuation +'lookup' Keyword +' ' Text +'../foo' Name.Variable +' ' Text +'"myPartial"' Literal.String.Double +')' Punctuation +' ' Text +'var' Name.Attribute +'=' Operator +'"value"' Literal.String.Double +' ' Text +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'>' Keyword +' ' Text +'@partial-block' Keyword +'}}' Comment.Preproc +'\n\n' Text + +'{{' Comment.Preproc +'#' Literal.Number.Attribute +'>myPartial' Literal.Number.Attribute +'}}' Comment.Preproc +'\n...\n' Text + +'{{' Comment.Preproc +'/' Literal.Number.Attribute +'myPartial' Literal.Number.Attribute +'}}' Comment.Preproc +'\n\n' Text + +'{{' Comment.Preproc +'#' Literal.Number.Attribute +'*inline' Literal.Number.Attribute +' ' Text +'"myPartial"' Literal.String.Double +'}}' Comment.Preproc +'\n...\n' Text + +'{{' Comment.Preproc +'/' Literal.Number.Attribute +'inline' Literal.Number.Attribute +'}}' Comment.Preproc +'\n\n' Text + +'{{' Comment.Preproc +'../name' Name.Variable +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'./name' Name.Variable +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'this' Name.Variable +'/name' Name.Variable +'}}' Comment.Preproc +'\n' Text diff --git a/tests/lexers/html+handlebars/example2.txt b/tests/lexers/html+handlebars/example2.txt new file mode 100644 index 00000000..d3fcd07c --- /dev/null +++ b/tests/lexers/html+handlebars/example2.txt @@ -0,0 +1,315 @@ +---input--- +{{#view EmberFirebaseChat.ChatView class="chat-container"}} + <div class="chat-messages-container"> + <ul class="chat-messages"> + {{#each message in content}} + <li> + [{{formatTimestamp "message.timestamp" fmtString="h:mm:ss A"}}] + <strong>{{message.sender}}</strong>: {{message.content}} + </li> + {{/each}} + </ul> + </div> + + {{! Comment }} + {{{unescaped value}}} + + {{#view EmberFirebaseChat.InputView class="chat-input-container"}} + <form class="form-inline"> + {{#if "auth.authed"}} + {{#if "auth.hasName"}} + <input type="text" id="message" placeholder="Message"> + <button {{action "postMessage" target="view"}} class="btn">Send</button> + {{else}} + <input type="text" id="username" placeholder="Enter your username..."> + <button {{action "pickName" target="view"}} class="btn">Send</button> + {{/if}} + {{else}} + <input type="text" placeholder="Log in with Persona to chat!" disabled="disabled"> + <button {{action "login"}} class="btn">Login</button> + {{/if}} + </form> + {{/view}} +{{/view}} + + +---tokens--- +'{{' Comment.Preproc +'#' Literal.Number.Attribute +'view' Literal.Number.Attribute +' ' Text +'EmberFirebaseChat' Name.Variable +'.ChatView' Name.Variable +' ' Text +'class' Name.Attribute +'=' Operator +'"chat-container"' Literal.String.Double +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'div' Name.Tag +' ' Text +'class' Name.Attribute +'=' Operator +'"chat-messages-container"' Literal.String +'>' Punctuation +'\n ' Text +'<' Punctuation +'ul' Name.Tag +' ' Text +'class' Name.Attribute +'=' Operator +'"chat-messages"' Literal.String +'>' Punctuation +'\n ' Text +'{{' Comment.Preproc +'#' Literal.Number.Attribute +'each' Literal.Number.Attribute +' ' Text +'message' Name.Variable +' ' Text +'in' Name.Variable +' ' Text +'content' Name.Variable +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'li' Name.Tag +'>' Punctuation +'\n [' Text +'{{' Comment.Preproc +'formatTimestamp' Name.Variable +' ' Text +'"message.timestamp"' Literal.String.Double +' ' Text +'fmtString' Name.Attribute +'=' Operator +'"h:mm:ss A"' Literal.String.Double +'}}' Comment.Preproc +'] \n ' Text +'<' Punctuation +'strong' Name.Tag +'>' Punctuation +'{{' Comment.Preproc +'message' Name.Variable +'.sender' Name.Variable +'}}' Comment.Preproc +'<' Punctuation +'/' Punctuation +'strong' Name.Tag +'>' Punctuation +': ' Text +'{{' Comment.Preproc +'message' Name.Variable +'.content' Name.Variable +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'/' Punctuation +'li' Name.Tag +'>' Punctuation +'\n ' Text +'{{' Comment.Preproc +'/' Literal.Number.Attribute +'each' Literal.Number.Attribute +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'/' Punctuation +'ul' Name.Tag +'>' Punctuation +'\n ' Text +'<' Punctuation +'/' Punctuation +'div' Name.Tag +'>' Punctuation +'\n\n ' Text +'{{! Comment }}' Comment +'\n ' Text +'{{{' Comment.Special +'unescaped' Name.Variable +' ' Text +'value' Name.Variable +'}}}' Comment.Special +'\n\n ' Text +'{{' Comment.Preproc +'#' Literal.Number.Attribute +'view' Literal.Number.Attribute +' ' Text +'EmberFirebaseChat' Name.Variable +'.InputView' Name.Variable +' ' Text +'class' Name.Attribute +'=' Operator +'"chat-input-container"' Literal.String.Double +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'form' Name.Tag +' ' Text +'class' Name.Attribute +'=' Operator +'"form-inline"' Literal.String +'>' Punctuation +'\n ' Text +'{{' Comment.Preproc +'#' Literal.Number.Attribute +'if' Literal.Number.Attribute +' ' Text +'"auth.authed"' Literal.String.Double +'}}' Comment.Preproc +'\n ' Text +'{{' Comment.Preproc +'#' Literal.Number.Attribute +'if' Literal.Number.Attribute +' ' Text +'"auth.hasName"' Literal.String.Double +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'input' Name.Tag +' ' Text +'type' Name.Attribute +'=' Operator +'"text"' Literal.String +' ' Text +'id' Name.Attribute +'=' Operator +'"message"' Literal.String +' ' Text +'placeholder' Name.Attribute +'=' Operator +'"Message"' Literal.String +'>' Punctuation +'\n ' Text +'<' Punctuation +'button' Name.Tag +' ' Text +'{{' Comment.Preproc +'action' Name.Variable +' ' Text +'"postMessage"' Literal.String.Double +' ' Text +'target' Name.Attribute +'=' Operator +'"view"' Literal.String.Double +'}}' Comment.Preproc +' ' Text +'class' Name.Attribute +'=' Operator +'"btn"' Literal.String +'>' Punctuation +'Send' Text +'<' Punctuation +'/' Punctuation +'button' Name.Tag +'>' Punctuation +'\n ' Text +'{{' Comment.Preproc +'else' Name.Variable +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'input' Name.Tag +' ' Text +'type' Name.Attribute +'=' Operator +'"text"' Literal.String +' ' Text +'id' Name.Attribute +'=' Operator +'"username"' Literal.String +' ' Text +'placeholder' Name.Attribute +'=' Operator +'"Enter your username..."' Literal.String +'>' Punctuation +'\n ' Text +'<' Punctuation +'button' Name.Tag +' ' Text +'{{' Comment.Preproc +'action' Name.Variable +' ' Text +'"pickName"' Literal.String.Double +' ' Text +'target' Name.Attribute +'=' Operator +'"view"' Literal.String.Double +'}}' Comment.Preproc +' ' Text +'class' Name.Attribute +'=' Operator +'"btn"' Literal.String +'>' Punctuation +'Send' Text +'<' Punctuation +'/' Punctuation +'button' Name.Tag +'>' Punctuation +'\n ' Text +'{{' Comment.Preproc +'/' Literal.Number.Attribute +'if' Literal.Number.Attribute +'}}' Comment.Preproc +'\n ' Text +'{{' Comment.Preproc +'else' Name.Variable +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'input' Name.Tag +' ' Text +'type' Name.Attribute +'=' Operator +'"text"' Literal.String +' ' Text +'placeholder' Name.Attribute +'=' Operator +'"Log in with Persona to chat!"' Literal.String +' ' Text +'disabled' Name.Attribute +'=' Operator +'"disabled"' Literal.String +'>' Punctuation +'\n ' Text +'<' Punctuation +'button' Name.Tag +' ' Text +'{{' Comment.Preproc +'action' Name.Variable +' ' Text +'"login"' Literal.String.Double +'}}' Comment.Preproc +' ' Text +'class' Name.Attribute +'=' Operator +'"btn"' Literal.String +'>' Punctuation +'Login' Text +'<' Punctuation +'/' Punctuation +'button' Name.Tag +'>' Punctuation +'\n ' Text +'{{' Comment.Preproc +'/' Literal.Number.Attribute +'if' Literal.Number.Attribute +'}}' Comment.Preproc +'\n ' Text +'<' Punctuation +'/' Punctuation +'form' Name.Tag +'>' Punctuation +'\n ' Text +'{{' Comment.Preproc +'/' Literal.Number.Attribute +'view' Literal.Number.Attribute +'}}' Comment.Preproc +'\n' Text + +'{{' Comment.Preproc +'/' Literal.Number.Attribute +'view' Literal.Number.Attribute +'}}' Comment.Preproc +'\n' Text |
