Skip to content

Instantly share code, notes, and snippets.

@davidtheclark
Last active January 31, 2019 01:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidtheclark/935a830eb58349052482 to your computer and use it in GitHub Desktop.
Save davidtheclark/935a830eb58349052482 to your computer and use it in GitHub Desktop.
Freemarker snippets for Atom Editor
# First install Freemarker language support with https://github.com/niltonheck/language-freemarker
'.text.html.ftl':
'Freemarker if':
'prefix': 'if'
'body': """
[#if ${1:condition}]
$2
[/#if]
"""
'Freemarker else':
'prefix': 'else'
'body': '[#else]'
'Freemarker elseif':
'prefix': 'elseif'
'body': '[#elseif ${1:condition}]'
'Freemarker ifelse':
'prefix': 'ifelse'
'body': """
[#if ${1:condition}]
$2
[#else]
$3
[/#if]
"""
'Freemarker assign':
'prefix': 'assign'
'body': '[#assign ${1:var} = "${2:value}" /]'
'Freemarker include':
'prefix': 'include'
'body': '[#include "${1:path}.ftl" /]'
'Freemarker import':
'prefix': 'import'
'body': '[#import "${1:path}.ftl" as ${2:var} /]'
'Freemarker list':
'prefix': 'list'
'body': """
[#list ${1:items} as ${2:item}]
${2}
[/#list]
"""
'Freemarker macro':
'prefix': 'macro'
'body': """
[#macro ${1:name} ${2:param}]
${2}
[/#macro]
"""
'Freemarker function':
'prefix': 'function'
'body': """
[#function ${1:name} ${2:param}]
${2}
[#return ${3:val} /]
[/#function]
"""
'Freemarker return':
'prefix': 'return'
'body': '[#return ${1:val} /]'
'Freemarker comment':
'prefix': 'cm'
'body': '[#-- ${1:comment} --]'
'Freemarker comment block':
'prefix': 'cmb'
'body': """
[#--
${1:comment}
--]
"""
'i18n message':
'prefix': 'i18'
'body': '\$\{i18n.message("${1:source}")\}'
'htcutil message':
'prefix': 'msg'
'body': '\$\{htcutil.message("${1:source}")\}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment