diff --git a/.travis.yml b/.travis.yml
index 93fc5c7..96aaed2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,7 +16,7 @@ notifications:
script: sh build-package.sh
env:
- - APM_TEST_PACKAGES="language-typescript language-marko language-tss"
+ - APM_TEST_PACKAGES="language-typescript language-marko language-tss language-html-swig"
cache:
- pip
diff --git a/examples/simple-jsbeautifyrc/swig/expected/test.swig b/examples/simple-jsbeautifyrc/swig/expected/test.swig
new file mode 100644
index 0000000..a90804d
--- /dev/null
+++ b/examples/simple-jsbeautifyrc/swig/expected/test.swig
@@ -0,0 +1,47 @@
+{# Comment #}
+
+{# Unindented without and with HTML indentation#}
+{% block blockname %}
+
+ {% for foo in bar %}
+ {% if condition %}
+
+ {% else %}
+
+ TestText3
+
+ {% endif %}
+ {% endfor %}
+{% endblock %}
+
+{# On the same line #}
+
+{% set name = value %}
+
+{% include "file" with context only %}
+
+{% extends "file" %}
+
+{# Indented wrong #}
+
+{% parent %}
+
+{% import "file" as varname %}
+
+{% macro name args %}
+ TestText4
+{% endmacro %}
+
+{% tag %}
+ TestText5
+{% end %}
+
+{% autoescape on "js" %}
+ TestText6
+{% endautoescape %}
\ No newline at end of file
diff --git a/examples/simple-jsbeautifyrc/swig/original/_test.swig b/examples/simple-jsbeautifyrc/swig/original/_test.swig
new file mode 100644
index 0000000..609e165
--- /dev/null
+++ b/examples/simple-jsbeautifyrc/swig/original/_test.swig
@@ -0,0 +1,43 @@
+{# Comment #}
+
+{# Unindented without and with HTML indentation#}
+{% block blockname %}
+
+{% for foo in bar %}
+{% if condition %}
+
+{% else %}
+
+TestText3
+
+{% endif %}
+{% endfor %}
+{% endblock %}
+
+{# On the same line #}
+
+{% set name = value %} {% include "file" with context only %} {% extends "file" %}
+
+ {# Indented wrong #}
+
+ {% parent %}
+
+ {% import "file" as varname %}
+
+{% macro name args %}
+ TestText4
+{% endmacro %}
+
+ {% tag %}
+ TestText5
+{% end %}
+
+{% autoescape on "js" %}
+ TestText6
+ {% endautoescape %}
\ No newline at end of file
diff --git a/spec/beautify-languages-spec.coffee b/spec/beautify-languages-spec.coffee
index 3e43551..31793fb 100644
--- a/spec/beautify-languages-spec.coffee
+++ b/spec/beautify-languages-spec.coffee
@@ -21,7 +21,7 @@ describe "BeautifyLanguages", ->
"mustache", "objective-c", "perl", "php",
"python", "ruby", "sass", "sql",
"typescript", "xml", "csharp", "gfm", "marko",
- "tss", "go"
+ "tss", "go", "html-swig"
]
beforeEach ->
@@ -134,6 +134,7 @@ describe "BeautifyLanguages", ->
beautifyCompleted = false
completionFun = (text) ->
+ # console.log(expectedTestPath, text) if ext is ".swig"
expect(text instanceof Error).not.toEqual(true, text)
# if text instanceof Error
# return beautifyCompleted = text # text == Error
diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee
index 266502f..51c2308 100644
--- a/src/beautifiers/prettydiff.coffee
+++ b/src/beautifiers/prettydiff.coffee
@@ -29,6 +29,7 @@ module.exports = class PrettyDiff extends Beautifier
JSON: true
TSS: true
LESS: true
+ Swig: true
}
beautify: (text, language, options) ->
@@ -45,7 +46,7 @@ module.exports = class PrettyDiff extends Beautifier
when "EJS", "ERB", \
"Handlebars", "Mustache", \
# "Markup", "JSTL", "SGML", \ # Currently unsupported
- "Spacebars", "XML"
+ "Spacebars", "XML", "Swig"
lang = "markup"
when "HTML"
lang = "html"
diff --git a/src/languages/index.coffee b/src/languages/index.coffee
index 2b11a5f..9e42db1 100644
--- a/src/languages/index.coffee
+++ b/src/languages/index.coffee
@@ -49,6 +49,7 @@ module.exports = class Languages
"scss"
"spacebars"
"sql"
+ "swig"
"tss"
"typescript"
"vala"
diff --git a/src/languages/swig.coffee b/src/languages/swig.coffee
new file mode 100644
index 0000000..d26fba3
--- /dev/null
+++ b/src/languages/swig.coffee
@@ -0,0 +1,24 @@
+module.exports = {
+
+ name: "Swig"
+ namespace: "swig"
+ fallback: ['html']
+
+ ###
+ Supported Grammars
+ ###
+ grammars: [
+ "HTML (Swig)"
+ "SWIG"
+ ]
+
+ ###
+ Supported extensions
+ ###
+ extensions: [
+ 'swig'
+ ]
+
+ options: []
+
+}
\ No newline at end of file