diff --git a/autotests/folding/example.rmd.fold b/autotests/folding/example.rmd.fold --- a/autotests/folding/example.rmd.fold +++ b/autotests/folding/example.rmd.fold @@ -1,15 +1,15 @@ --- -title: "test" -author: "me" -date: "07.10.2014" +title: "test" +author: "me" +date: "07.10.2014" output: html_document --- This is a simple test document. It shows syntax highlighting switches between YAML (above), R blocks ```{r, echo=FALSE} -for (i in 1:10) { +for (i in 1:10) { if(i>=10) print(i) -} +} # two blank lines below sessionInfo() diff --git a/autotests/folding/highlight.php.fold b/autotests/folding/highlight.php.fold --- a/autotests/folding/highlight.php.fold +++ b/autotests/folding/highlight.php.fold @@ -16,10 +16,10 @@ > - .inputText { + .inputText { width: px; text-indent: 10px; - } + } > @@ -29,31 +29,31 @@ > type="text/babel"> - > > /* aaa */ ?> >> - function a(i) { + > > /* aaa */ ?> >> + function a(i) { - return >{ i + j }>; - } + return >{ i + j }>; + } > type="text/typescript"> - class DateTime { + class DateTime { info: string; - constructor() { this.info = ; } - get() { return this.info; } - } + constructor() { this.info = ; } + get() { return this.info; } + } > type="x-tmpl-mustache"> - {{! }} - {{#movie}} - > - >{{title}}> - src="{{poster}}" alt="{{title}}"/> + {{! }} + {{#movie}} + > +

{{title}}

+ {{title}} - {{ratings.critics_rating}} - > - {{/movie}} +
> + {{/movie}}
> diff --git a/autotests/folding/test.htm.fold b/autotests/folding/test.htm.fold --- a/autotests/folding/test.htm.fold +++ b/autotests/folding/test.htm.fold @@ -44,20 +44,26 @@ type="x-tmpl-mustache"> - {{#movie}} - > - >{{title}}> - src="{{poster}}" alt="{{title}}"/> - > - > + {{#movie}} + > +

{{title}}

+ {{title}} +
> + > Rating - {{ratings.critics_rating}} - > - {{/movie}} - {{^movie}} - > + > + {{/movie}} + {{^movie}} + > Movie Does Not Exist :( - > - {{/movie}} - {{! comment }} + > + {{/movie}} + {{! comment }}
> + + + type="text/html"> +
  • Hello
  • +
    > + diff --git a/autotests/folding/test.markdown.fold b/autotests/folding/test.markdown.fold --- a/autotests/folding/test.markdown.fold +++ b/autotests/folding/test.markdown.fold @@ -114,11 +114,11 @@ ## JSON ```json -[{ +[{ "hello": "world", "count": 1, "bool": true -}] +}] ``` ## KConfig @@ -137,42 +137,42 @@ use Zend\Mvc\Controller\AbstractActionController; class IndexController extends AbstractActionController -{ -} +{ +} ``` ## Python ```python -def addXToY(x, y): +def addXToY(x, y): total = x + y print total ``` ## QML ```qml -Text { +Text { id: hello width: 100 text: "Hello world!" -} +} ``` ## Rust ```rust -fn main() { +fn main() { println!("Hello world!"); -} +} ``` ## XML ```xml - attribute="3"> - /> -> + attribute="3"> + /> +> ``` ## No language specified diff --git a/autotests/folding/test.mustache.fold b/autotests/folding/test.mustache.fold new file mode 100644 --- /dev/null +++ b/autotests/folding/test.mustache.fold @@ -0,0 +1,110 @@ + +html> + + + + {{title}} + + + > + /* Mustache variable support in CSS is incomplete */ + {{mustache}} + [ {{other}} ] + body { + {{{other}}} + font-size: 15pt; + font-family: Verdana; + } + > + + > + var foo = {{bar}}; + `template {{foo}} ${ var a = {{b}} }` + > + + + {{#movie}} + > +

    {{title}}

    + {{title}} +
    > + > + Rating - {{ratings.critics_rating}} + > + {{/movie}} + {{^movie}} + > + Movie Does Not Exist :( + > + {{/movie}} + {{! this is a comment TODO ALERT }} + + This is a partial {{> partial1 }} + {{#block + param=foo + param2=bar}} + {{block foo=bar}} + {{/block}} + + + + {{#list people}}{{firstName}} {{lastName}}{{/list}} + {{#noop}}{{body}}{{/noop}} + {{#with story}} + class="intro">{{{intro}}}> + class="body">{{{body}}}> + {{/with}} + {{#each comments}} + class="comment"> +

    {{subject}}

    + {{{body}}} +
    > + {{/each}} + {{#list nav}} + {{title}} + {{/list}} + + {{!-- Conditionals --}} + {{#if isActive}} + Active + {{else if isInactive}} + Inactive + {{else}} + + {{/if}} + + {{!-- Escaping --}} + \{{escaped}} + {{{{raw}}}} + {{escaped}} + {{{{/raw}}}} + + {{!-- Whitespace Control --}} + {{#each nav ~}} + + {{~#if test}} + {{~title}} + {{~^~}} + Empty + {{~/if~}} + + {{~/each}} + + {{!-- Helpers --}} + {{link "See more..." story.url}} + {{log "Look at me!" level="error"}} + + {{!-- Partial --}} + {{> myPartial name=../name }} + {{#> myPartial }} + Failover content + {{/myPartial}} + {{#*inline "myPartial"}} + My Content + {{/inline}} + {{#each children}} + {{> myPartial}} + {{/each}} + + + diff --git a/autotests/html/highlight.php.html b/autotests/html/highlight.php.html --- a/autotests/html/highlight.php.html +++ b/autotests/html/highlight.php.html @@ -55,9 +55,9 @@ {{! <?php print "comment"; ?> }} {{#movie}} <div> - <h1>{{title}}</h1> - <img src="{{poster}}" alt="{{title}}"/> - <?php echo $movierating; ?> - {{ratings.critics_rating}} + <h1>{{title}}</h1> + <img src="{{poster}}" alt="{{title}}"/> + <?php echo $movierating; ?> - {{ratings.critics_rating}} </div> {{/movie}} </script> diff --git a/autotests/html/test.htm.html b/autotests/html/test.htm.html --- a/autotests/html/test.htm.html +++ b/autotests/html/test.htm.html @@ -52,19 +52,25 @@ <script type="x-tmpl-mustache"> {{#movie}} <div> - <h1>{{title}}</h1> - <img src="{{poster}}" alt="{{title}}"/> + <h1>{{title}}</h1> + <img src="{{poster}}" alt="{{title}}"/> </div> <div> - Rating - {{ratings.critics_rating}} + Rating - {{ratings.critics_rating}} </div> {{/movie}} {{^movie}} <div> Movie Does Not Exist :( </div> {{/movie}} - {{! comment }} + {{! comment }} </script> + + <!-- HTML template --> + <script type="text/html"> + <li><a href="link">Hello</a></li> + </script> + </html> diff --git a/autotests/html/test.mustache.html b/autotests/html/test.mustache.html new file mode 100644 --- /dev/null +++ b/autotests/html/test.mustache.html @@ -0,0 +1,117 @@ + + + +test.mustache + +
    +<!-- Mustache / Handlebars / Ractive template -->
    +<!DOCTYPE html>
    +<html>
    +    <head>
    +        <meta charset="UTF-8" />
    +        <title>{{title}}</title>
    +    </head>
    +    <!-- CSS -->
    +    <style>
    +        /* Mustache variable support in CSS is incomplete */
    +        {{mustache}}
    +        [ {{other}} ]
    +        body {
    +            {{{other}}}
    +            font-size: 15pt;
    +            font-family: Verdana;
    +        }
    +    </style>
    +    <!-- JavaScript -->
    +    <script>
    +        var foo = {{bar}};
    +        `template {{foo}} ${ var a = {{b}} }`
    +    </script>
    +
    +    <body>
    +    {{#movie}}
    +        <div>
    +            <h1>{{title}}</h1>
    +            <img src="{{poster}}" alt="{{title}}"/>
    +        </div>
    +        <div>
    +            Rating - {{ratings.critics_rating}}
    +        </div>
    +    {{/movie}}
    +    {{^movie}}
    +        <div>
    +            Movie Does Not Exist :(
    +        </div>
    +    {{/movie}}
    +    {{! this is a comment TODO ALERT }}
    +
    +    This is a partial {{> partial1 }}
    +    {{#block
    +        param=foo
    +        param2=bar}}
    +        {{block foo=bar}}
    +    {{/block}}
    +
    +    <!-- Handlebars -->
    +
    +    {{#list people}}{{firstName}} {{lastName}}{{/list}}
    +    {{#noop}}{{body}}{{/noop}}
    +    {{#with story}}
    +        <div class="intro">{{{intro}}}</div>
    +        <div class="body">{{{body}}}</div>
    +    {{/with}}
    +    {{#each comments}}
    +        <div class="comment">
    +            <h2>{{subject}}</h2>
    +            {{{body}}}
    +        </div>
    +    {{/each}}
    +    {{#list nav}}
    +        <a href="{{url}}">{{title}}</a>
    +    {{/list}}
    +
    +    {{!-- Conditionals --}}
    +    {{#if isActive}}
    +        <img src="star.gif" alt="Active">
    +    {{else if isInactive}}
    +        <img src="cry.gif" alt="Inactive">
    +    {{else}}
    +        <img src="cry.gif" alt="">
    +    {{/if}}
    +
    +    {{!-- Escaping --}}
    +    \{{escaped}}
    +    {{{{raw}}}}
    +        {{escaped}}
    +    {{{{/raw}}}}
    +
    +    {{!-- Whitespace Control --}}
    +    {{#each nav ~}}
    +        <a href="{{url}}">
    +            {{~#if test}}
    +                {{~title}}
    +            {{~^~}}
    +                Empty
    +            {{~/if~}}
    +        </a>
    +    {{~/each}}
    +
    +    {{!-- Helpers --}}
    +    {{link "See more..." story.url}}
    +    {{log "Look at me!" level="error"}}
    +
    +    {{!-- Partial --}}
    +    {{> myPartial name=../name }}
    +    {{#> myPartial }}
    +        Failover content
    +    {{/myPartial}}
    +    {{#*inline "myPartial"}}
    +        My Content
    +    {{/inline}}
    +    {{#each children}}
    +        {{> myPartial}}
    +    {{/each}}
    +
    +    </body>
    +</html>
    +
    diff --git a/autotests/input/test.htm b/autotests/input/test.htm --- a/autotests/input/test.htm +++ b/autotests/input/test.htm @@ -58,6 +58,12 @@ Movie Does Not Exist :( {{/movie}} - {{! comment }} + {{! comment }} + + + + diff --git a/autotests/input/test.mustache b/autotests/input/test.mustache new file mode 100644 --- /dev/null +++ b/autotests/input/test.mustache @@ -0,0 +1,110 @@ + + + + + + {{title}} + + + + + + + + {{#movie}} +
    +

    {{title}}

    + {{title}} +
    +
    + Rating - {{ratings.critics_rating}} +
    + {{/movie}} + {{^movie}} +
    + Movie Does Not Exist :( +
    + {{/movie}} + {{! this is a comment TODO ALERT }} + + This is a partial {{> partial1 }} + {{#block + param=foo + param2=bar}} + {{block foo=bar}} + {{/block}} + + + + {{#list people}}{{firstName}} {{lastName}}{{/list}} + {{#noop}}{{body}}{{/noop}} + {{#with story}} +
    {{{intro}}}
    +
    {{{body}}}
    + {{/with}} + {{#each comments}} +
    +

    {{subject}}

    + {{{body}}} +
    + {{/each}} + {{#list nav}} + {{title}} + {{/list}} + + {{!-- Conditionals --}} + {{#if isActive}} + Active + {{else if isInactive}} + Inactive + {{else}} + + {{/if}} + + {{!-- Escaping --}} + \{{escaped}} + {{{{raw}}}} + {{escaped}} + {{{{/raw}}}} + + {{!-- Whitespace Control --}} + {{#each nav ~}} + + {{~#if test}} + {{~title}} + {{~^~}} + Empty + {{~/if~}} + + {{~/each}} + + {{!-- Helpers --}} + {{link "See more..." story.url}} + {{log "Look at me!" level="error"}} + + {{!-- Partial --}} + {{> myPartial name=../name }} + {{#> myPartial }} + Failover content + {{/myPartial}} + {{#*inline "myPartial"}} + My Content + {{/inline}} + {{#each children}} + {{> myPartial}} + {{/each}} + + + diff --git a/autotests/reference/highlight.php.ref b/autotests/reference/highlight.php.ref --- a/autotests/reference/highlight.php.ref +++ b/autotests/reference/highlight.php.ref @@ -46,14 +46,14 @@

    type="x-tmpl-mustache">
    - {{! print "comment"; ?> }}
    - {{#movie}}
    + {{! print "comment"; ?> }}
    + {{#movie}}

    -

    {{title}}


    - src="{{poster}}" alt="{{title}}"/>
    - echo $movierating; ?> - {{ratings.critics_rating}}
    +

    {{title}}


    + src="{{poster}}" alt="{{title}}"/>
    + echo $movierating; ?> - {{ratings.critics_rating}}

    - {{/movie}}
    + {{/movie}}



    diff --git a/autotests/reference/test.htm.ref b/autotests/reference/test.htm.ref --- a/autotests/reference/test.htm.ref +++ b/autotests/reference/test.htm.ref @@ -44,20 +44,26 @@

    type="x-tmpl-mustache">
    - {{#movie}}
    + {{#movie}}

    -

    {{title}}


    - src="{{poster}}" alt="{{title}}"/>
    -

    +

    {{title}}


    + src="{{poster}}" alt="{{title}}"/>
    +

    - Rating - {{ratings.critics_rating}}
    + Rating - {{ratings.critics_rating}}

    - {{/movie}}
    - {{^movie}}
    + {{/movie}}
    + {{^movie}}

    - Movie Does Not Exist :(
    -

    - {{/movie}}
    - {{! comment }}
    + Movie Does Not Exist :(
    +
    + {{/movie}}
    + {{! comment }}

    +
    +
    + type="text/html">
    +
  • href="link">Hello

  • +
    +

    diff --git a/autotests/reference/test.mustache.ref b/autotests/reference/test.mustache.ref new file mode 100644 --- /dev/null +++ b/autotests/reference/test.mustache.ref @@ -0,0 +1,110 @@ +
    +html>
    +
    +
    + charset="UTF-8" />
    + </Element Tag><Mustache Variable>{{</Mustache Variable><Mustache Inside>title</Mustache Inside><Mustache Variable>}}</Mustache Variable><Element Tag>
    +
    +
    +
    +
    +
    +
    +
    + {{#movie}}
    +

    +

    {{title}}


    + src="{{poster}}" alt="{{title}}"/>
    +

    +

    + Rating - {{ratings.critics_rating}}
    +

    + {{/movie}}
    + {{^movie}}
    +

    + Movie Does Not Exist :(
    +

    + {{/movie}}
    + {{! this is a comment TODO ALERT }}
    +
    + This is a partial {{> partial1 }}
    + {{#block
    + param=foo
    + param2=bar}}
    + {{block foo=bar}}
    + {{/block}}
    +
    +
    +
    + {{#list people}}{{firstName}} {{lastName}}{{/list}}
    + {{#noop}}{{body}}{{/noop}}
    + {{#with story}}
    + class="intro">{{{intro}}}
    + class="body">{{{body}}}
    + {{/with}}
    + {{#each comments}}
    + class="comment">
    +

    {{subject}}


    + {{{body}}}
    +
    + {{/each}}
    + {{#list nav}}
    + href="{{url}}">{{title}}
    + {{/list}}
    +
    + {{!-- Conditionals --}}
    + {{#if isActive}}
    + src="star.gif" alt="Active">
    + {{else if isInactive}}
    + src="cry.gif" alt="Inactive">
    + {{else}}
    + src="cry.gif" alt="">
    + {{/if}}
    +
    + {{!-- Escaping --}}
    + \{{escaped}}
    + {{{{raw}}}}
    + {{escaped}}
    + {{{{/raw}}}}
    +
    + {{!-- Whitespace Control --}}
    + {{#each nav ~}}
    + href="{{url}}">
    + {{~#if test}}
    + {{~title}}
    + {{~^~}}
    + Empty
    + {{~/if~}}
    +
    + {{~/each}}
    +
    + {{!-- Helpers --}}
    + {{link "See more..." story.url}}
    + {{log "Look at me!" level="error"}}
    +
    + {{!-- Partial --}}
    + {{> myPartial name=../name }}
    + {{#> myPartial }}
    + Failover content
    + {{/myPartial}}
    + {{#*inline "myPartial"}}
    + My Content
    + {{/inline}}
    + {{#each children}}
    + {{> myPartial}}
    + {{/each}}
    +
    +
    +
    diff --git a/autotests/syntaxrepository_test.cpp b/autotests/syntaxrepository_test.cpp --- a/autotests/syntaxrepository_test.cpp +++ b/autotests/syntaxrepository_test.cpp @@ -260,15 +260,15 @@ QStringLiteral("Doxygen"), QStringLiteral("JavaScript React/PHP"), QStringLiteral("TypeScript/PHP"), - QStringLiteral("MustacheJS/PHP"), + QStringLiteral("Mustache/Handlebars (HTML)/PHP"), QStringLiteral("Modelines"), QStringLiteral("HTML"), QStringLiteral("CSS"), QStringLiteral("SQL (MySQL)"), QStringLiteral("JavaScript"), QStringLiteral("JavaScript React"), QStringLiteral("TypeScript"), - QStringLiteral("MustacheJS") + QStringLiteral("Mustache/Handlebars (HTML)") }; QStringList definitionNames; for (auto d : defs) { diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -11,7 +11,7 @@ generate_php_syntax_definition(html-php.xml html.xml) generate_php_syntax_definition(javascript-react-php.xml javascript-react.xml) generate_php_syntax_definition(typescript-php.xml typescript.xml) -generate_php_syntax_definition(mustache-js-php.xml mustache-js.xml) +generate_php_syntax_definition(mustache-php.xml mustache.xml) # find all definitions file(GLOB src_defs "${CMAKE_CURRENT_SOURCE_DIR}/syntax/*.xml") @@ -22,7 +22,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/javascript-php.xml ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/javascript-react-php.xml ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/typescript-php.xml - ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/mustache-js-php.xml + ${CMAKE_CURRENT_BINARY_DIR}/generated/syntax/mustache-php.xml ) # theme data resource diff --git a/data/syntax/html.xml b/data/syntax/html.xml --- a/data/syntax/html.xml +++ b/data/syntax/html.xml @@ -5,7 +5,7 @@ ]> - + @@ -229,12 +229,17 @@ + + + + + @@ -260,8 +265,21 @@ - - + + + + + + + + + + + + + + + diff --git a/data/syntax/mustache-js.xml b/data/syntax/mustache-js.xml deleted file mode 100644 --- a/data/syntax/mustache-js.xml +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - - - -]> - - - - - diff --git a/data/syntax/mustache.xml b/data/syntax/mustache.xml new file mode 100644 --- /dev/null +++ b/data/syntax/mustache.xml @@ -0,0 +1,470 @@ + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +