guard-mthaml 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +34 -0
- data/lib/guard/mthaml.rb +140 -0
- data/lib/guard/mthaml/compiler/MtHaml.php +255 -0
- data/lib/guard/mthaml/templates/Guardfile +12 -0
- data/lib/guard/mthaml/version.rb +5 -0
- data/vendor/autoload.php +7 -0
- data/vendor/coffeescript/coffeescript/LICENSE +22 -0
- data/vendor/coffeescript/coffeescript/README.md +96 -0
- data/vendor/coffeescript/coffeescript/composer.json +23 -0
- data/vendor/coffeescript/coffeescript/grammar.y +309 -0
- data/vendor/coffeescript/coffeescript/make.php +115 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Compiler.php +76 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Error.php +15 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Helpers.php +116 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Init.php +96 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Lexer.php +1356 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Nodes.php +105 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Parser.php +3326 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Rewriter.php +552 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Scope.php +196 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/SyntaxError.php +9 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Value.php +20 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Access.php +31 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Arr.php +69 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Assign.php +353 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Base.php +288 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Block.php +294 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Call.php +283 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Class.php +282 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Closure.php +49 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Code.php +203 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Comment.php +39 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php +42 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Extends.php +26 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/For.php +250 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/If.php +161 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/In.php +99 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Index.php +27 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Literal.php +96 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Obj.php +126 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Op.php +292 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Param.php +119 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Parens.php +45 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Range.php +225 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Return.php +56 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php +47 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Splat.php +100 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Switch.php +121 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Throw.php +37 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Try.php +79 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Value.php +210 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/While.php +112 -0
- data/vendor/coffeescript/coffeescript/tests/cases/arrays.coffee +77 -0
- data/vendor/coffeescript/coffeescript/tests/cases/assignment.coffee +352 -0
- data/vendor/coffeescript/coffeescript/tests/cases/booleans.coffee +21 -0
- data/vendor/coffeescript/coffeescript/tests/cases/classes.coffee +681 -0
- data/vendor/coffeescript/coffeescript/tests/cases/comments.coffee +207 -0
- data/vendor/coffeescript/coffeescript/tests/cases/compilation.coffee +72 -0
- data/vendor/coffeescript/coffeescript/tests/cases/comprehensions.coffee +501 -0
- data/vendor/coffeescript/coffeescript/tests/cases/control_flow.coffee +430 -0
- data/vendor/coffeescript/coffeescript/tests/cases/eval.coffee +29 -0
- data/vendor/coffeescript/coffeescript/tests/cases/exception_handling.coffee +102 -0
- data/vendor/coffeescript/coffeescript/tests/cases/formatting.coffee +146 -0
- data/vendor/coffeescript/coffeescript/tests/cases/function_invocation.coffee +552 -0
- data/vendor/coffeescript/coffeescript/tests/cases/functions.coffee +188 -0
- data/vendor/coffeescript/coffeescript/tests/cases/helpers.coffee +96 -0
- data/vendor/coffeescript/coffeescript/tests/cases/importing.coffee +18 -0
- data/vendor/coffeescript/coffeescript/tests/cases/interpolation.coffee +138 -0
- data/vendor/coffeescript/coffeescript/tests/cases/javascript_literals.coffee +10 -0
- data/vendor/coffeescript/coffeescript/tests/cases/numbers.coffee +76 -0
- data/vendor/coffeescript/coffeescript/tests/cases/objects.coffee +271 -0
- data/vendor/coffeescript/coffeescript/tests/cases/operators.coffee +277 -0
- data/vendor/coffeescript/coffeescript/tests/cases/option_parser.coffee +43 -0
- data/vendor/coffeescript/coffeescript/tests/cases/ranges.coffee +88 -0
- data/vendor/coffeescript/coffeescript/tests/cases/regexps.coffee +63 -0
- data/vendor/coffeescript/coffeescript/tests/cases/scope.coffee +43 -0
- data/vendor/coffeescript/coffeescript/tests/cases/slicing_and_splicing.coffee +143 -0
- data/vendor/coffeescript/coffeescript/tests/cases/soaks.coffee +134 -0
- data/vendor/coffeescript/coffeescript/tests/cases/strict.coffee +155 -0
- data/vendor/coffeescript/coffeescript/tests/cases/strings.coffee +107 -0
- data/vendor/coffeescript/coffeescript/tests/css/style.css +43 -0
- data/vendor/coffeescript/coffeescript/tests/index.php +119 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.1.1.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.2.0.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.0.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.1.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/diff.js +276 -0
- data/vendor/coffeescript/coffeescript/tests/js/main.js +123 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/LICENSE.txt +10 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/Lempar.php +948 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Action.php +257 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/ActionTable.php +299 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Config.php +574 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Data.php +1857 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Parser.php +851 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/PropagationLink.php +126 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Rule.php +144 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/State.php +283 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Symbol.php +288 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/cli.php +5 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/ParserGenerator.php +811 -0
- data/vendor/composer/ClassLoader.php +383 -0
- data/vendor/composer/autoload_classmap.php +9 -0
- data/vendor/composer/autoload_namespaces.php +12 -0
- data/vendor/composer/autoload_psr4.php +10 -0
- data/vendor/composer/autoload_real.php +50 -0
- data/vendor/composer/installed.json +166 -0
- data/vendor/michelf/php-markdown/License.md +36 -0
- data/vendor/michelf/php-markdown/Michelf/Markdown.inc.php +10 -0
- data/vendor/michelf/php-markdown/Michelf/Markdown.php +3117 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.inc.php +11 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php +38 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.inc.php +9 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php +37 -0
- data/vendor/michelf/php-markdown/Readme.md +305 -0
- data/vendor/michelf/php-markdown/Readme.php +31 -0
- data/vendor/michelf/php-markdown/composer.json +31 -0
- data/vendor/mthaml/mthaml/CHANGELOG +48 -0
- data/vendor/mthaml/mthaml/LICENSE +44 -0
- data/vendor/mthaml/mthaml/README.markdown +262 -0
- data/vendor/mthaml/mthaml/composer.json +45 -0
- data/vendor/mthaml/mthaml/docs/Makefile +153 -0
- data/vendor/mthaml/mthaml/docs/_static/mthaml.css +30 -0
- data/vendor/mthaml/mthaml/docs/_theme/mthaml/theme.conf +4 -0
- data/vendor/mthaml/mthaml/docs/conf.py +242 -0
- data/vendor/mthaml/mthaml/docs/index.rst +18 -0
- data/vendor/mthaml/mthaml/docs/twig-syntax.rst +274 -0
- data/vendor/mthaml/mthaml/examples/README.md +5 -0
- data/vendor/mthaml/mthaml/examples/autoload.php +8 -0
- data/vendor/mthaml/mthaml/examples/example-php.haml +5 -0
- data/vendor/mthaml/mthaml/examples/example-php.php +37 -0
- data/vendor/mthaml/mthaml/examples/example-twig-noext.twig +11 -0
- data/vendor/mthaml/mthaml/examples/example-twig.haml +9 -0
- data/vendor/mthaml/mthaml/examples/example-twig.php +60 -0
- data/vendor/mthaml/mthaml/examples/example.twig.haml +8 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Autoloader.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Environment.php +178 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Escaping.php +33 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Exception.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Exception/SyntaxErrorException.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/AbstractFilter.php +43 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Cdata.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/CoffeeScript.php +33 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Css.php +26 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Escaped.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/FilterInterface.php +15 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Javascript.php +26 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less.php +27 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/LeafoLess.php +20 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/OyejorgeLess.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown.php +58 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/CebeMarkdown.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Ciconia.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/MichelfMarkdown.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Parsedown.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Php.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Plain.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Preserve.php +19 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Scss.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Twig.php +47 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Indentation.php +96 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationException.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationInterface.php +50 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Undefined.php +41 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Comment.php +71 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Doctype.php +96 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/EscapableAbstract.php +19 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Filter.php +51 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Insert.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/InterpolatedString.php +73 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestAbstract.php +117 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestInterface.php +10 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NodeAbstract.php +77 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefClass.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefId.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Root.php +35 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Run.php +71 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Statement.php +45 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Tag.php +90 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttribute.php +62 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeInterpolation.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeList.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Text.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php +25 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Escaping.php +105 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/MergeAttrs.php +110 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Midblock.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorAbstract.php +226 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorInterface.php +97 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/PhpRenderer.php +288 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Printer.php +265 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/RendererAbstract.php +581 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/TwigRenderer.php +252 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Parser.php +862 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Parser/Buffer.php +147 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime.php +218 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeInterpolation.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeList.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Php/Executor.php +157 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Extension.php +47 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Lexer.php +48 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Loader.php +81 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/Php.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetAbstract.php +87 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetInterface.php +12 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/Twig.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilder.php +100 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilderException.php +9 -0
- data/vendor/mthaml/mthaml/phpunit.xml +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/EnvironmentTest.php +59 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/HamlSpecTest.php +83 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/IndentationTest.php +140 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/DoctypeTest.php +51 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/NodeTest.php +110 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/PhpRendererTest.php +113 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/TwigRendererTest.php +68 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php +44 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Parser/BufferTest.php +77 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/ParserTest.php +47 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/RuntimeTest.php +356 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Php/ExecutorTest.php +83 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Twig/LoaderTest.php +65 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCase.php +49 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCaseTest.php +50 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/Support/Php/Executor.001.haml +1 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_php.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_twig.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_php.test +16 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_twig.test +16 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_php.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_twig.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug42.test +13 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug8_twig.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/coffeescript_filter.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/comments.test +26 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/cond_cmt.test +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_html4.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid_xhtml.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_php.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_xhtml.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/filters.test +51 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_php.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_twig.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_php.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_twig.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_leafo.test +33 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_oyejorge.test +49 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_cebemarkdown.test +35 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_ciconia.test +36 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_michelf.test +34 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_parsedown.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_optimization_filter_michelf.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/mergeattrs.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_inner_whitespace.test +77 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_outer_whitespace.test +122 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_php.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_twig.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php.test +109 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping_once.test +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_blocks.test +29 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_filters.test +42 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/scss_filter.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/strip_inline_comments_php.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/test.test +24 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/trailing_semicolon_php.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/try_catch_php.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig.test +112 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_blocks.test +29 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_filters.test +37 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_whitespace.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/whitespace.test +63 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/autoclose.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_attr_once.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_html_false.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/mergeattrs.test +26 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock.test +54 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock_002.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attr_list.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs.test +42 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_002.test +35 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_003.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_html_linebreak.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks.test +27 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks_002.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/boolean_attr.test +19 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug28.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug8.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/cond_cmt.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/doctype.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/double_equal.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/empty_line_after_multiline.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_001.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_002.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_003.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_004.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_005.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_006.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_007.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_008.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_009.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_010.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_013.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_016.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_017.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_018.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_019.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_020.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_002.test +19 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_003.test +13 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_004.test +21 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_005.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_006.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/insertflags.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation.test +36 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation_in_html_attrs.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline_code.test +59 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiple_attr_kinds.test +47 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/non_rendered_comment.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ns.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error1.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error2.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/quotes_in_haml.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby19_attrs.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_001.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_002.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_003.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/standard.test +114 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/tagflags.test +39 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/php_filters.test +28 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/twig_filters.test +31 -0
- data/vendor/mthaml/mthaml/test/bootstrap.php +3 -0
- metadata +398 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
* 1.6.0 (2014-08-16)
|
2
|
+
|
3
|
+
* Code statements continue on the next line when the current one is terminated by
|
4
|
+
a comma
|
5
|
+
* Ruby-style attributes continue on the next line when braces are not balanced
|
6
|
+
and the current one is terminated by a comma
|
7
|
+
* Attributes defined by attribute methods or expressions are merged with
|
8
|
+
existing .class and #id instead of overriding them (%p.class{attrs()})
|
9
|
+
|
10
|
+
* 1.5.0 (2014-07-08)
|
11
|
+
|
12
|
+
* Improved the Twig Loader (hason)
|
13
|
+
|
14
|
+
* 1.4.0 (2014-05-23)
|
15
|
+
|
16
|
+
* Now attributes are escaped only if escape is activated (Hassan Amouhzi)
|
17
|
+
* Added an Executor that can easily execute php-based templates
|
18
|
+
|
19
|
+
* 1.3.0 (2013-10-04)
|
20
|
+
|
21
|
+
* Made filters modular (hason)
|
22
|
+
* Added filters: coffee, escaped, less, markdown, php, scss, twig (hason)
|
23
|
+
* Spec: Case insensitive doctype id after `!!!`
|
24
|
+
* Spec: `!!! XML` doctype ignored in non xhtml mode
|
25
|
+
* Spec: Do not output `/>` on empty elements in non xhtml mode
|
26
|
+
* Fixed handling of escaped string interpolations (hason)
|
27
|
+
* Improved Object Reference support: object name override (ronan-gloo)
|
28
|
+
* New examples
|
29
|
+
|
30
|
+
* 1.2.2 (2013-03-29)
|
31
|
+
|
32
|
+
* Flatten deeply-nested data attributes
|
33
|
+
|
34
|
+
* 1.2.0 (2013-02-09)
|
35
|
+
|
36
|
+
* Added support for interpolations in attributes: %form(action="" #{form_enctype(form)})
|
37
|
+
* Added support for object reference syntax: %div[object]
|
38
|
+
* Made the parser more permissive when parsing content of -# comments
|
39
|
+
* Fixed rendering of <?xml tags to not conflict with php short open tags
|
40
|
+
* Added ability to use inline comments in php code
|
41
|
+
* Added attribute expression support in ruby-like attributes: %html{get_attrs()}
|
42
|
+
* Added boolean attribute syntax in html-like attributes: %input(type="checkbox" checked)
|
43
|
+
|
44
|
+
* 1.1.0 (2012-09-24)
|
45
|
+
|
46
|
+
* Added handling of special attributes (e.g. id, class, data, and boolean attributes)
|
47
|
+
* Compiled MtHaml templates now need MtHaml at runtime in some cases (and a Twig extension, for Twig templates).
|
48
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
Copyright (c) 2006-2011 Arnaud Le Blanc
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
Some tests are derived from the original ruby-haml; the following
|
23
|
+
copyright notice apply to them:
|
24
|
+
|
25
|
+
Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
|
26
|
+
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
28
|
+
a copy of this software and associated documentation files (the
|
29
|
+
"Software"), to deal in the Software without restriction, including
|
30
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
31
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
32
|
+
permit persons to whom the Software is furnished to do so, subject to
|
33
|
+
the following conditions:
|
34
|
+
|
35
|
+
The above copyright notice and this permission notice shall be
|
36
|
+
included in all copies or substantial portions of the Software.
|
37
|
+
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
39
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
40
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
41
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
42
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
43
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
44
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,262 @@
|
|
1
|
+
# Multi target HAML
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/arnaud-lb/MtHaml.png)](http://travis-ci.org/arnaud-lb/MtHaml)
|
4
|
+
|
5
|
+
MtHaml is a PHP implementation of the [HAML language][1] which can target multiple languages.
|
6
|
+
|
7
|
+
Currently supported targets are PHP and [Twig][4], and new ones can be added easily.
|
8
|
+
|
9
|
+
Mt-Haml implements the exact same syntax as ruby-haml; the only difference is that any supported language can be used everywhere HAML expects Ruby code:
|
10
|
+
|
11
|
+
## HAML/Twig:
|
12
|
+
|
13
|
+
``` haml
|
14
|
+
%ul#users
|
15
|
+
- for user in users
|
16
|
+
%li.user
|
17
|
+
= user.name
|
18
|
+
Email: #{user.email}
|
19
|
+
%a(href=user.url) Home page
|
20
|
+
```
|
21
|
+
|
22
|
+
Rendered:
|
23
|
+
|
24
|
+
``` jinja
|
25
|
+
<ul id="users">
|
26
|
+
{% for user in users %}
|
27
|
+
<li class="user">
|
28
|
+
{{ user.name }}
|
29
|
+
Email: {{ user.email }}
|
30
|
+
<a href="{{ user.url }}">Home page</a>
|
31
|
+
</li>
|
32
|
+
{% endfor %}
|
33
|
+
</ul>
|
34
|
+
```
|
35
|
+
|
36
|
+
## HAML/PHP:
|
37
|
+
|
38
|
+
``` haml
|
39
|
+
%ul#users
|
40
|
+
- foreach($users as $user)
|
41
|
+
%li.user
|
42
|
+
= $user->getName()
|
43
|
+
Email: #{$user->getEmail()}
|
44
|
+
%a(href=$user->getUrl()) Home page
|
45
|
+
```
|
46
|
+
|
47
|
+
Rendered:
|
48
|
+
|
49
|
+
``` php
|
50
|
+
<ul id="users">
|
51
|
+
<?php foreach($users as $user) { ?>
|
52
|
+
<li class="user">
|
53
|
+
<?php echo $user->getName(); ?>
|
54
|
+
Email: <?php echo $user->getEmail(); ?>
|
55
|
+
<a href="<?php echo $user->getUrl(); ?>">Home page</a>
|
56
|
+
</li>
|
57
|
+
<?php } ?>
|
58
|
+
</ul>
|
59
|
+
```
|
60
|
+
|
61
|
+
## Usage
|
62
|
+
|
63
|
+
PHP:
|
64
|
+
|
65
|
+
``` php
|
66
|
+
<?php
|
67
|
+
$haml = new MtHaml\Environment('php');
|
68
|
+
$executor = new MtHaml\Support\Php\Executor($haml, array(
|
69
|
+
'cache' => sys_get_temp_dir().'/haml',
|
70
|
+
));
|
71
|
+
|
72
|
+
// Compiles and executes the HAML template, with variables given as second
|
73
|
+
// argument
|
74
|
+
$executor->display('template.haml', array(
|
75
|
+
'var' => 'value',
|
76
|
+
));
|
77
|
+
|
78
|
+
```
|
79
|
+
|
80
|
+
[Twig][4]:
|
81
|
+
|
82
|
+
``` php
|
83
|
+
<?php
|
84
|
+
$haml = new MtHaml\Environment('twig', array('enable_escaper' => false));
|
85
|
+
|
86
|
+
// Use a custom loader, whose responsibility is to convert HAML templates
|
87
|
+
// to Twig syntax, before handing them out to Twig:
|
88
|
+
$hamlLoader = new MtHaml\Support\Twig\Loader($haml, $twig->getLoader());
|
89
|
+
$twig->setLoader($hamlLoader);
|
90
|
+
|
91
|
+
// Register the Twig extension before executing a HAML template
|
92
|
+
$twig->addExtension(new MtHaml\Support\Twig\Extension());
|
93
|
+
|
94
|
+
// Render templates as usual
|
95
|
+
$twig->render('template.haml', ...);
|
96
|
+
```
|
97
|
+
|
98
|
+
See [examples][7] and [MtHaml with Twig](https://github.com/arnaud-lb/MtHaml/wiki/Use-MtHaml-with-Twig)
|
99
|
+
|
100
|
+
## Escaping
|
101
|
+
|
102
|
+
MtHaml escapes everything by default. Since Twig already supports
|
103
|
+
auto escaping it is recommended to enable it in Twig and disable it in MtHaml:
|
104
|
+
|
105
|
+
`new MtHaml\Environment('twig', array('enable_escaper' => false));`
|
106
|
+
|
107
|
+
HAML/PHP is rendered like this when auto escaping is enabled:
|
108
|
+
|
109
|
+
``` haml
|
110
|
+
Email #{$user->getEmail()}
|
111
|
+
%a(href=$user->getUrl()) Home page
|
112
|
+
```
|
113
|
+
|
114
|
+
``` php
|
115
|
+
Email <?php echo htmlspecialchars($user->getEmail(), ENT_QUOTES, 'UTF-8'); ?>
|
116
|
+
<a href="<?php echo htmlspecialchars($user->getUrl(), ENT_QUOTES, 'UTF-8'); ?>">Home page</a>
|
117
|
+
```
|
118
|
+
|
119
|
+
## Twig
|
120
|
+
|
121
|
+
Using [Twig][4] in HAML gives more control over what can be executed, what variables and functions are exposed to the templates, etc. This also allows to use all of Twig's awesome features like template inheritance, macros, blocks, filters, functions, tests, ...
|
122
|
+
|
123
|
+
``` haml
|
124
|
+
- extends "some-template.haml"
|
125
|
+
|
126
|
+
- macro printSomething()
|
127
|
+
%p something
|
128
|
+
|
129
|
+
- block body
|
130
|
+
%h1 Title
|
131
|
+
= _self.printSomething()
|
132
|
+
```
|
133
|
+
|
134
|
+
### Integration in Twig
|
135
|
+
|
136
|
+
MtHaml comes with an example Twig_Loader that will automatically convert HAML into Twig at loading time (Twig will then compile the resulting Twig script and cache it). Templates with a `.haml` extension, or whose source starts with `{% haml %}` will be converted, and the others will be left untouched.
|
137
|
+
|
138
|
+
The loader acts as a proxy and takes an other loader as parameter:
|
139
|
+
|
140
|
+
``` php
|
141
|
+
<?php
|
142
|
+
|
143
|
+
$haml = new MtHaml\Environment(...);
|
144
|
+
|
145
|
+
$twig_loader = new Twig_Loader_Filesystem(...);
|
146
|
+
$twig_loader = new MtHaml\Support\Twig\Loader($haml, $twig_loader);
|
147
|
+
```
|
148
|
+
|
149
|
+
### Runtime support
|
150
|
+
|
151
|
+
Compiled MtHaml/Twig templates need support from MtHaml at runtime in some cases. Because of this, a Twig extension must be loaded before executing the templates.
|
152
|
+
|
153
|
+
|
154
|
+
``` php
|
155
|
+
<?php
|
156
|
+
// Register the MtHaml extension before executing the template:
|
157
|
+
$twig->addExtension(new MtHaml\Support\Twig\Extension());
|
158
|
+
$twig->render("rendered_twig_template.twig");
|
159
|
+
```
|
160
|
+
|
161
|
+
## Syntax
|
162
|
+
|
163
|
+
The syntax is the same as [HAML/Ruby][1]'s syntax, except that PHP or Twig have to be used where Ruby is expected.
|
164
|
+
|
165
|
+
See the [tutorial][2] and the [reference][3]
|
166
|
+
|
167
|
+
## Performance
|
168
|
+
|
169
|
+
MtHaml converts HAML to PHP or Twig code. The resulting code can be cached and executed any number of times, and
|
170
|
+
doesn't depend on HAML at runtime.
|
171
|
+
|
172
|
+
MtHaml has no runtime overhead.
|
173
|
+
|
174
|
+
## Helpers
|
175
|
+
|
176
|
+
Helpers in HAML/Ruby are just ruby functions exposed to templates.
|
177
|
+
Any function can be made available to HAML templates by the target language
|
178
|
+
(the function only have to be available at runtime).
|
179
|
+
|
180
|
+
In HAML/Twig you can use all of Twig's functions, filters, and tags. In HAML/PHP, you can use all PHP functions.
|
181
|
+
|
182
|
+
## Filters
|
183
|
+
|
184
|
+
Filters take plain text input (with support for `#{...}` interpolations) and transform it, or wrap it.
|
185
|
+
|
186
|
+
Example with the `javascript` filter:
|
187
|
+
|
188
|
+
``` haml
|
189
|
+
%p something
|
190
|
+
:javascript
|
191
|
+
some.javascript.code("#{var|escape('js')}");
|
192
|
+
```
|
193
|
+
|
194
|
+
``` jinja
|
195
|
+
<p>something</p>
|
196
|
+
<script type="text/javascript">
|
197
|
+
//<![CDATA[
|
198
|
+
some.javascript.code("{{ var|escape('js') }}");
|
199
|
+
//]]>
|
200
|
+
</script>
|
201
|
+
```
|
202
|
+
|
203
|
+
The following filters are available:
|
204
|
+
|
205
|
+
- **css**: wraps with style tags
|
206
|
+
- **cdata**: wraps with CDATA markup
|
207
|
+
- **coffee***: compiles coffeescript to javascript
|
208
|
+
- **escaped**: html escapes
|
209
|
+
- **javascript**: wraps with script tags
|
210
|
+
- **less***: compiles as Lesscss
|
211
|
+
- **markdown***: converts markdown to html
|
212
|
+
- **php**: executes the input as php code
|
213
|
+
- **preseve**: preserves preformatted text
|
214
|
+
- **scss***: converts scss to css
|
215
|
+
- **twig**: executes the input as twig code
|
216
|
+
|
217
|
+
Filter marked with `*` have runtime dependencies and are not enabled by default. Such filters need to be provided to MtHaml\Environment explicitly.
|
218
|
+
|
219
|
+
Example with the Coffee filter:
|
220
|
+
|
221
|
+
``` php
|
222
|
+
<?php
|
223
|
+
|
224
|
+
$coffeeFilter = new MtHaml\Filter\CoffeeScript(new CoffeeScript\Compiler);
|
225
|
+
|
226
|
+
$env = new MtHaml\Environment('twig', array(
|
227
|
+
'enable_escaper' => false,
|
228
|
+
), array(
|
229
|
+
'coffee' => $coffeeFilter,
|
230
|
+
));
|
231
|
+
```
|
232
|
+
|
233
|
+
## Sass
|
234
|
+
|
235
|
+
[Sass][6] can be used in PHP projects without problem. It only depends on Ruby and does not need to be installed on production servers. So MtHaml will not re-implement Sass.
|
236
|
+
|
237
|
+
## Frameworks and CMS support
|
238
|
+
|
239
|
+
- CakePHP: https://github.com/TiuTalk/haml
|
240
|
+
- Drupal: https://github.com/antoinelafontaine/oxide
|
241
|
+
- FuelPHP: https://github.com/fuel/parser
|
242
|
+
- Laravel (PHP): https://github.com/BKWLD/laravel-haml
|
243
|
+
- Laravel (Twig): https://github.com/SimonDegraeve/laravel-twigbridge
|
244
|
+
- PHPixie: https://github.com/dracony/PHPixie-HAML
|
245
|
+
- Silex: https://github.com/arnaud-lb/Silex-MtHaml
|
246
|
+
- Sprockets-PHP: https://github.com/Nami-Doc/Sprockets-PHP
|
247
|
+
- Symfony2: https://github.com/arnaud-lb/MtHamlBundle
|
248
|
+
- Zend Framework 1: https://github.com/bonndan/mthaml-zf1
|
249
|
+
|
250
|
+
Add yours: https://github.com/arnaud-lb/MtHaml/edit/master/README.markdown
|
251
|
+
|
252
|
+
## License
|
253
|
+
|
254
|
+
MtHaml is released under the MIT license (same as HAML/Ruby).
|
255
|
+
|
256
|
+
[1]: http://haml-lang.com/
|
257
|
+
[2]: http://haml-lang.com/tutorial.html
|
258
|
+
[3]: http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html
|
259
|
+
[4]: http://www.twig-project.org/
|
260
|
+
[5]: http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#attribute_methods
|
261
|
+
[6]: http://sass-lang.com/
|
262
|
+
[7]: https://github.com/arnaud-lb/MtHaml/blob/master/examples/README.md
|
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"name": "mthaml/mthaml",
|
3
|
+
"type": "library",
|
4
|
+
"description": "HAML for PHP",
|
5
|
+
"keywords": ["HAML"],
|
6
|
+
"homepage": "https://github.com/arnaud-lb/MtHaml",
|
7
|
+
"license": "MIT",
|
8
|
+
"authors": [
|
9
|
+
{
|
10
|
+
"name": "Arnaud Le Blanc",
|
11
|
+
"email": "arnaud.lb@gmail.com"
|
12
|
+
}
|
13
|
+
],
|
14
|
+
"require": {
|
15
|
+
"php": ">=5.3.0"
|
16
|
+
},
|
17
|
+
"require-dev": {
|
18
|
+
"twig/twig": "~1.11",
|
19
|
+
"oyejorge/less.php": "*",
|
20
|
+
"leafo/lessphp": "*",
|
21
|
+
"leafo/scssphp": "*",
|
22
|
+
"coffeescript/coffeescript": "~1",
|
23
|
+
"michelf/php-markdown": "~1.3",
|
24
|
+
"erusev/parsedown": "*"
|
25
|
+
},
|
26
|
+
"suggest": {
|
27
|
+
"twig/twig": "If you want to use Twig templating engine",
|
28
|
+
"oyejorge/less.php": "If you want to use :less filter",
|
29
|
+
"leafo/lessphp": "If you want to use :less filter",
|
30
|
+
"leafo/scssphp": "If you want to use :scss filter",
|
31
|
+
"coffeescript/coffeescript": "If you want to use :coffee or :coffeescript filter",
|
32
|
+
"michelf/php-markdown": "If you want to use :markdown filter",
|
33
|
+
"erusev/parsedown": "If you want to use :markdown filter",
|
34
|
+
"cebe/markdown": "If you want to use :markdown filter",
|
35
|
+
"kzykhys/ciconia": "If you want to use :markdown filter"
|
36
|
+
},
|
37
|
+
"conflict": {
|
38
|
+
"mthaml/mthaml-bundle": "<1.1.0"
|
39
|
+
},
|
40
|
+
"autoload": {
|
41
|
+
"psr-0": {
|
42
|
+
"MtHaml\\": "lib/"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,153 @@
|
|
1
|
+
# Makefile for Sphinx documentation
|
2
|
+
#
|
3
|
+
|
4
|
+
# You can set these variables from the command line.
|
5
|
+
SPHINXOPTS =
|
6
|
+
SPHINXBUILD = sphinx-build
|
7
|
+
PAPER =
|
8
|
+
BUILDDIR = _build
|
9
|
+
|
10
|
+
# Internal variables.
|
11
|
+
PAPEROPT_a4 = -D latex_paper_size=a4
|
12
|
+
PAPEROPT_letter = -D latex_paper_size=letter
|
13
|
+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
14
|
+
# the i18n builder cannot share the environment and doctrees with the others
|
15
|
+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
16
|
+
|
17
|
+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
18
|
+
|
19
|
+
help:
|
20
|
+
@echo "Please use \`make <target>' where <target> is one of"
|
21
|
+
@echo " html to make standalone HTML files"
|
22
|
+
@echo " dirhtml to make HTML files named index.html in directories"
|
23
|
+
@echo " singlehtml to make a single large HTML file"
|
24
|
+
@echo " pickle to make pickle files"
|
25
|
+
@echo " json to make JSON files"
|
26
|
+
@echo " htmlhelp to make HTML files and a HTML help project"
|
27
|
+
@echo " qthelp to make HTML files and a qthelp project"
|
28
|
+
@echo " devhelp to make HTML files and a Devhelp project"
|
29
|
+
@echo " epub to make an epub"
|
30
|
+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
31
|
+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
32
|
+
@echo " text to make text files"
|
33
|
+
@echo " man to make manual pages"
|
34
|
+
@echo " texinfo to make Texinfo files"
|
35
|
+
@echo " info to make Texinfo files and run them through makeinfo"
|
36
|
+
@echo " gettext to make PO message catalogs"
|
37
|
+
@echo " changes to make an overview of all changed/added/deprecated items"
|
38
|
+
@echo " linkcheck to check all external links for integrity"
|
39
|
+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
40
|
+
|
41
|
+
clean:
|
42
|
+
-rm -rf $(BUILDDIR)/*
|
43
|
+
|
44
|
+
html:
|
45
|
+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
46
|
+
@echo
|
47
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
48
|
+
|
49
|
+
dirhtml:
|
50
|
+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
51
|
+
@echo
|
52
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
53
|
+
|
54
|
+
singlehtml:
|
55
|
+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
56
|
+
@echo
|
57
|
+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
58
|
+
|
59
|
+
pickle:
|
60
|
+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
61
|
+
@echo
|
62
|
+
@echo "Build finished; now you can process the pickle files."
|
63
|
+
|
64
|
+
json:
|
65
|
+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
66
|
+
@echo
|
67
|
+
@echo "Build finished; now you can process the JSON files."
|
68
|
+
|
69
|
+
htmlhelp:
|
70
|
+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
71
|
+
@echo
|
72
|
+
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
73
|
+
".hhp project file in $(BUILDDIR)/htmlhelp."
|
74
|
+
|
75
|
+
qthelp:
|
76
|
+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
77
|
+
@echo
|
78
|
+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
79
|
+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
80
|
+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MtHaml.qhcp"
|
81
|
+
@echo "To view the help file:"
|
82
|
+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MtHaml.qhc"
|
83
|
+
|
84
|
+
devhelp:
|
85
|
+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
86
|
+
@echo
|
87
|
+
@echo "Build finished."
|
88
|
+
@echo "To view the help file:"
|
89
|
+
@echo "# mkdir -p $$HOME/.local/share/devhelp/MtHaml"
|
90
|
+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MtHaml"
|
91
|
+
@echo "# devhelp"
|
92
|
+
|
93
|
+
epub:
|
94
|
+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
95
|
+
@echo
|
96
|
+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
97
|
+
|
98
|
+
latex:
|
99
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
100
|
+
@echo
|
101
|
+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
102
|
+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
103
|
+
"(use \`make latexpdf' here to do that automatically)."
|
104
|
+
|
105
|
+
latexpdf:
|
106
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
107
|
+
@echo "Running LaTeX files through pdflatex..."
|
108
|
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
109
|
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
110
|
+
|
111
|
+
text:
|
112
|
+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
113
|
+
@echo
|
114
|
+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
115
|
+
|
116
|
+
man:
|
117
|
+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
118
|
+
@echo
|
119
|
+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
120
|
+
|
121
|
+
texinfo:
|
122
|
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
123
|
+
@echo
|
124
|
+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
125
|
+
@echo "Run \`make' in that directory to run these through makeinfo" \
|
126
|
+
"(use \`make info' here to do that automatically)."
|
127
|
+
|
128
|
+
info:
|
129
|
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
130
|
+
@echo "Running Texinfo files through makeinfo..."
|
131
|
+
make -C $(BUILDDIR)/texinfo info
|
132
|
+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
133
|
+
|
134
|
+
gettext:
|
135
|
+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
136
|
+
@echo
|
137
|
+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
138
|
+
|
139
|
+
changes:
|
140
|
+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
141
|
+
@echo
|
142
|
+
@echo "The overview file is in $(BUILDDIR)/changes."
|
143
|
+
|
144
|
+
linkcheck:
|
145
|
+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
146
|
+
@echo
|
147
|
+
@echo "Link check complete; look for any errors in the above output " \
|
148
|
+
"or in $(BUILDDIR)/linkcheck/output.txt."
|
149
|
+
|
150
|
+
doctest:
|
151
|
+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
152
|
+
@echo "Testing of doctests in the sources finished, look at the " \
|
153
|
+
"results in $(BUILDDIR)/doctest/output.txt."
|