Skip to content

Commit

Permalink
add HTL template file
Browse files Browse the repository at this point in the history
  • Loading branch information
pmannel committed Oct 8, 2016
1 parent 93aba39 commit 3c0c026
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 1 deletion.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,46 @@
# htl-live-templates
HTL Live Templates
HTL Live Templates

# HTL Live Templates for IntelliJ IDEA

Simplifies writing [HTL](https://docs.adobe.com/docs/en/htl/docs/getting-started.html) Markup in IntelliJ via Live Templates

### Usage
Write "sly-command" or only $ in your html file and press Tab for auto-completion.
Depending on the command, the markup is generated automatically.

### Commands:
#### $
>${$VAR0$}
#### sly-use
><sly data-sly-use.$VAR0$="$className$" />
#### sly-text
>data-sly-text="${$VAR0$ @ context=$VAR1$}"
#### sly-test
>data-sly-test="${$VAR0$}"
#### sly-template
><template data-sly-template.$VAR0$="${ @ $VAR1$}">
$END$
</template>
#### sly-resource
>data-sly-resource="${'$VAR0$' @ resourceType='$VAR1$'}"
#### sly-repeat
>data-sly-repeat="${$VAR0$}"
#### sly-list
> <sly data-sly-list.$VAR0$="${$VAR1$}">
$END$
</sly>
#### sly-include
>data-sly-include="$VAR0$"
#### sly-comment
><!--/* $VAR0$ */-->
#### sly-call
>data-sly-call="${$VAR0$ @ $VAR1$}"
#### sly-attribute
>data-sly-attribute="${$VAR0$}"
### Installation

Download [latest release](https://github.com/pmannel/htl-live-templates/releases).

Install to IntelliJ IDEA, see https://www.jetbrains.com/help/idea/2016.2/sharing-live-templates.html
80 changes: 80 additions & 0 deletions templates/HTL.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<templateSet group="HTL">
<template name="sly-use" value="&lt;sly data-sly-use.$VAR0$=&quot;$className$&quot; /&gt;" description="data-sly-use" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="className" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-test" value="data-sly-test=&quot;${$VAR0$}&quot;" description="data-sly-test" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-resource" value="data-sly-resource=&quot;${'$VAR0$' @ resourceType='$VAR1$'}&quot;" description="data-sly-resource" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="VAR1" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-include" value="data-sly-include=&quot;$VAR0$&quot;" description="data-sly-include" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-template" value="&lt;template data-sly-template.$VAR0$=&quot;${ @ $VAR1$}&quot;&gt;&#10; $END$&#10;&lt;/template&gt;" description="data-sly-template" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="VAR1" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-call" value="data-sly-call=&quot;${$VAR0$ @ $VAR1$}&quot;" description="data-sly-call" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="VAR1" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-text" value="data-sly-text=&quot;${$VAR0$ @ context=$VAR1$}&quot;" description="data-sly-text" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="VAR1" expression="" defaultValue="unsafe" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-attribute" value="data-sly-attribute=&quot;${$VAR0$}&quot;" description="data-sly-attribute" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-list" value=" &lt;sly data-sly-list.$VAR0$=&quot;${$VAR1$}&quot;&gt;&#10; $END$&#10; &lt;/sly&gt;" description="data-sly-list" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="item" alwaysStopAt="true" />
<variable name="VAR1" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="$" value="${$VAR0$}" description="htl attribute" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-comment" value="&lt;!--/* $VAR0$ */--&gt;" description="htl comment" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
<template name="sly-repeat" value="data-sly-repeat=&quot;${$VAR0$}&quot;" description="data-sly-repeat" toReformat="false" toShortenFQNames="true">
<variable name="VAR0" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML" value="true" />
</context>
</template>
</templateSet>

0 comments on commit 3c0c026

Please sign in to comment.