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,83 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Tests\Support\Php;
|
4
|
+
|
5
|
+
use MtHaml\Support\Php\Executor;
|
6
|
+
|
7
|
+
class ExecutorTest extends \PHPUnit_Framework_TestCase
|
8
|
+
{
|
9
|
+
private $cacheDir;
|
10
|
+
|
11
|
+
public function setUp()
|
12
|
+
{
|
13
|
+
$this->cacheDir = $this->tempdir(sys_get_temp_dir());
|
14
|
+
}
|
15
|
+
|
16
|
+
public function tearDown()
|
17
|
+
{
|
18
|
+
if (null !== $this->cacheDir) {
|
19
|
+
$this->unlinkr($this->cacheDir);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
public function testRender()
|
24
|
+
{
|
25
|
+
$tpl = __DIR__ . '/../../fixtures/Support/Php/Executor.001.haml';
|
26
|
+
|
27
|
+
$env = $this->getMockBuilder('MtHaml\Environment')
|
28
|
+
->disableOriginalConstructor()
|
29
|
+
->getMock();
|
30
|
+
|
31
|
+
$env->expects($this->any())
|
32
|
+
->method('compileString')
|
33
|
+
->with("%p= 6 * \$var\n", $tpl)
|
34
|
+
->will($this->returnValue('<p><?php echo 6 * $var; ?></p>'));
|
35
|
+
|
36
|
+
$executor = new Executor($env, array(
|
37
|
+
'cache' => $this->cacheDir,
|
38
|
+
));
|
39
|
+
|
40
|
+
$vars = array(
|
41
|
+
'var' => 7,
|
42
|
+
);
|
43
|
+
$result = $executor->render($tpl, $vars);
|
44
|
+
|
45
|
+
$this->assertSame('<p>42</p>', $result);
|
46
|
+
}
|
47
|
+
|
48
|
+
private function tempdir($root)
|
49
|
+
{
|
50
|
+
if (!is_dir($root) || !is_writeable($root)) {
|
51
|
+
throw new \Exception(sprintf(
|
52
|
+
"Cannot create directory at `%s`"
|
53
|
+
, $root
|
54
|
+
));
|
55
|
+
}
|
56
|
+
|
57
|
+
for ($i = 0; $i < 100; $i++) {
|
58
|
+
$name = bin2hex(pack('d', rand()));
|
59
|
+
if (mkdir($root . '/' . $name)) {
|
60
|
+
return $root . '/' . $name;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
throw new \Exception(sprintf(
|
65
|
+
"Failed creating temporary directory at `%s`"
|
66
|
+
, $root
|
67
|
+
));
|
68
|
+
}
|
69
|
+
|
70
|
+
private function unlinkr($dir)
|
71
|
+
{
|
72
|
+
$it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
|
73
|
+
$it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
|
74
|
+
foreach ($it as $fileinfo) {
|
75
|
+
if ($fileinfo->isDir()) {
|
76
|
+
rmdir($fileinfo->getPathname());
|
77
|
+
} else {
|
78
|
+
unlink($fileinfo->getPathname());
|
79
|
+
}
|
80
|
+
}
|
81
|
+
rmdir($dir);
|
82
|
+
}
|
83
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<?php
|
2
|
+
namespace MtHaml\Tests\Support\Twig;
|
3
|
+
|
4
|
+
use MtHaml\Support\Twig\Loader;
|
5
|
+
|
6
|
+
class LoaderTest extends \PHPUnit_Framework_TestCase
|
7
|
+
{
|
8
|
+
public function testLoadSimpleTwigTemplate()
|
9
|
+
{
|
10
|
+
$env = $this->getMockBuilder('MtHaml\Environment')
|
11
|
+
->disableOriginalConstructor()
|
12
|
+
->getMock();
|
13
|
+
|
14
|
+
$env->expects($this->never())
|
15
|
+
->method('compileString');
|
16
|
+
|
17
|
+
$loader = $this->getMock('Twig_LoaderInterface');
|
18
|
+
$loader->expects($this->once())
|
19
|
+
->method('getSource')
|
20
|
+
->will($this->returnValue('<h1>{{ title }}</h1>'));
|
21
|
+
|
22
|
+
$hamlLoader = new Loader($env, $loader);
|
23
|
+
$hamlLoader->getSource('template.twig');
|
24
|
+
}
|
25
|
+
|
26
|
+
public function testLoadHamlTemplate()
|
27
|
+
{
|
28
|
+
$env = $this->getMockBuilder('MtHaml\Environment')
|
29
|
+
->disableOriginalConstructor()
|
30
|
+
->getMock();
|
31
|
+
|
32
|
+
$env->expects($this->once())
|
33
|
+
->method('compileString')
|
34
|
+
->with('%h1= title')
|
35
|
+
->will($this->returnValue('<h1>{{ title }}</h1>'));
|
36
|
+
|
37
|
+
$loader = $this->getMock('Twig_LoaderInterface');
|
38
|
+
$loader->expects($this->once())
|
39
|
+
->method('getSource')
|
40
|
+
->will($this->returnValue('%h1= title'));
|
41
|
+
|
42
|
+
$hamlLoader = new Loader($env, $loader);
|
43
|
+
$hamlLoader->getSource('template.haml');
|
44
|
+
}
|
45
|
+
|
46
|
+
public function testLoadTwigWithHamlTemplate()
|
47
|
+
{
|
48
|
+
$env = $this->getMockBuilder('MtHaml\Environment')
|
49
|
+
->disableOriginalConstructor()
|
50
|
+
->getMock();
|
51
|
+
|
52
|
+
$env->expects($this->once())
|
53
|
+
->method('compileString')
|
54
|
+
->with(' %h1= title')
|
55
|
+
->will($this->returnValue('<h1>{{ title }}</h1>'));
|
56
|
+
|
57
|
+
$loader = $this->getMock('Twig_LoaderInterface');
|
58
|
+
$loader->expects($this->once())
|
59
|
+
->method('getSource')
|
60
|
+
->will($this->returnValue('{% haml %} %h1= title'));
|
61
|
+
|
62
|
+
$hamlLoader = new Loader($env, $loader);
|
63
|
+
$hamlLoader->getSource('template.twig');
|
64
|
+
}
|
65
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Tests;
|
4
|
+
|
5
|
+
class TestCase extends \PHPUnit_Framework_TestCase
|
6
|
+
{
|
7
|
+
public function assertException($parts, \Exception $e = null)
|
8
|
+
{
|
9
|
+
if (empty($parts['EXCEPTION'])) {
|
10
|
+
if (null !== $e) {
|
11
|
+
throw $e;
|
12
|
+
}
|
13
|
+
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
|
17
|
+
list($class, $message) = explode("\n", $parts['EXCEPTION'], 2);
|
18
|
+
|
19
|
+
if (!empty($class)) {
|
20
|
+
if (null === $e) {
|
21
|
+
$this->assertThat(
|
22
|
+
NULL,
|
23
|
+
new \PHPUnit_Framework_Constraint_Exception($class)
|
24
|
+
);
|
25
|
+
}
|
26
|
+
if (get_class($e) !== $class) {
|
27
|
+
throw $e;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
if (!empty($message)) {
|
31
|
+
$re = addcslashes($message, '~');
|
32
|
+
$re = "~^($re)$~";
|
33
|
+
$this->assertRegexp($re, $e->getMessage());
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
public function parseTestFile($file)
|
38
|
+
{
|
39
|
+
$contents = file_get_contents($file);
|
40
|
+
$splits = preg_split('#^--(.*)--$#m', $contents, -1, PREG_SPLIT_DELIM_CAPTURE);
|
41
|
+
$parts = array();
|
42
|
+
|
43
|
+
while (false !== $key = next($splits)) {
|
44
|
+
$parts[$key] = substr(next($splits), 1, -1);
|
45
|
+
}
|
46
|
+
|
47
|
+
return $parts;
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Tests;
|
4
|
+
|
5
|
+
require_once __DIR__ . '/TestCase.php';
|
6
|
+
|
7
|
+
class TestCaseTest extends TestCase
|
8
|
+
{
|
9
|
+
public function testAssertExceptionReturnsIfNothingExceptedAndThrown()
|
10
|
+
{
|
11
|
+
$this->assertException(array(), null);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @expectedException LogicException
|
16
|
+
*/
|
17
|
+
public function testAssertExceptionThrowsIfNothingExpectedButThrown()
|
18
|
+
{
|
19
|
+
$e = new \LogicException;
|
20
|
+
$this->assertException(array(), $e);
|
21
|
+
}
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @expectedException PHPUnit_Framework_ExpectationFailedException
|
25
|
+
* @expectedExceptionMessage Failed asserting that exception of type "Foo"
|
26
|
+
*/
|
27
|
+
public function testAssertExceptionFailsIfExpectedButNothingThrown()
|
28
|
+
{
|
29
|
+
$this->assertException(array('EXCEPTION' => "Foo\n"), null);
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* @expectedException LogicException
|
34
|
+
*/
|
35
|
+
public function testAssertExceptionThrowsIfWrongExceptionClass()
|
36
|
+
{
|
37
|
+
$e = new \LogicException;
|
38
|
+
$this->assertException(array('EXCEPTION' => "Foo\n"), $e);
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* @expectedException PHPUnit_Framework_ExpectationFailedException
|
43
|
+
* @expectedExceptionMessage Failed asserting that 'foo' matches PCRE pattern "~^(bar)$~".
|
44
|
+
*/
|
45
|
+
public function testAssertExceptionFailsIfMessageDoesNotMatch()
|
46
|
+
{
|
47
|
+
$e = new \Exception('foo');
|
48
|
+
$this->assertException(array('EXCEPTION' => "Exception\nbar"), $e);
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
%p= 6 * $var
|
@@ -0,0 +1,20 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('php', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
|
6
|
+
--HAML--
|
7
|
+
%html{html_attrs()}
|
8
|
+
%html{html_attrs(1, 2, 3)}
|
9
|
+
%html{html_attrs(1, 2, 3, array("foo" => "bar"))}
|
10
|
+
%html{html_attrs(1, 2, 3, array("foo" => "bar")), $foo}
|
11
|
+
%p{$list}
|
12
|
+
%p{$list, :foo => "bar"}
|
13
|
+
--EXPECT--
|
14
|
+
<html <?php echo MtHaml\Runtime::renderAttributes(array(MtHaml\Runtime\AttributeList::create((html_attrs()))), 'html5', 'UTF-8', false); ?>></html>
|
15
|
+
<html <?php echo MtHaml\Runtime::renderAttributes(array(MtHaml\Runtime\AttributeList::create((html_attrs(1, 2, 3)))), 'html5', 'UTF-8', false); ?>></html>
|
16
|
+
<html <?php echo MtHaml\Runtime::renderAttributes(array(MtHaml\Runtime\AttributeList::create((html_attrs(1, 2, 3, array("foo" => "bar"))))), 'html5', 'UTF-8', false); ?>></html>
|
17
|
+
<html <?php echo MtHaml\Runtime::renderAttributes(array(MtHaml\Runtime\AttributeList::create((html_attrs(1, 2, 3, array("foo" => "bar")))), MtHaml\Runtime\AttributeList::create($foo)), 'html5', 'UTF-8', false); ?>></html>
|
18
|
+
<p <?php echo MtHaml\Runtime::renderAttributes(array(MtHaml\Runtime\AttributeList::create($list)), 'html5', 'UTF-8', false); ?>></p>
|
19
|
+
<p <?php echo MtHaml\Runtime::renderAttributes(array(MtHaml\Runtime\AttributeList::create($list), array('foo', 'bar')), 'html5', 'UTF-8', false); ?>></p>
|
20
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('twig', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
|
6
|
+
--HAML--
|
7
|
+
%p{list}
|
8
|
+
%p{list, :foo => "bar"}
|
9
|
+
--EXPECT--
|
10
|
+
<p {{ mthaml_attributes([mthaml_attribute_list(list)], 'html5', 'UTF-8', false)|raw }}></p>
|
11
|
+
<p {{ mthaml_attributes([mthaml_attribute_list(list), ['foo', 'bar']], 'html5', 'UTF-8', false)|raw }}></p>
|
12
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('php', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
|
6
|
+
--HAML--
|
7
|
+
%p(foo bar="baz")
|
8
|
+
%p(foo)
|
9
|
+
%p(bar="baz" foo)
|
10
|
+
%p(foo class=baz)
|
11
|
+
--EXPECT--
|
12
|
+
<p <?php echo MtHaml\Runtime::renderAttributes(array(array('foo', TRUE), array('bar', 'baz')), 'html5', 'UTF-8', false); ?>></p>
|
13
|
+
<p <?php echo MtHaml\Runtime::renderAttributes(array(array('foo', TRUE)), 'html5', 'UTF-8', false); ?>></p>
|
14
|
+
<p <?php echo MtHaml\Runtime::renderAttributes(array(array('bar', 'baz'), array('foo', TRUE)), 'html5', 'UTF-8', false); ?>></p>
|
15
|
+
<p <?php echo MtHaml\Runtime::renderAttributes(array(array('foo', TRUE), array('class', baz)), 'html5', 'UTF-8', false); ?>></p>
|
16
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('twig', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
|
6
|
+
--HAML--
|
7
|
+
%p(foo bar="baz")
|
8
|
+
%p(foo)
|
9
|
+
%p(bar="baz" foo)
|
10
|
+
%p(foo class=baz)
|
11
|
+
--EXPECT--
|
12
|
+
<p {{ mthaml_attributes([['foo', true], ['bar', 'baz']], 'html5', 'UTF-8', false)|raw }}></p>
|
13
|
+
<p {{ mthaml_attributes([['foo', true]], 'html5', 'UTF-8', false)|raw }}></p>
|
14
|
+
<p {{ mthaml_attributes([['bar', 'baz'], ['foo', true]], 'html5', 'UTF-8', false)|raw }}></p>
|
15
|
+
<p {{ mthaml_attributes([['foo', true], ['class', baz]], 'html5', 'UTF-8', false)|raw }}></p>
|
16
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('php', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
--HAML--
|
6
|
+
- if ($a)
|
7
|
+
|
8
|
+
- else
|
9
|
+
1
|
10
|
+
--EXPECT--
|
11
|
+
<?php if ($a) { ?>
|
12
|
+
<?php } else { ?>
|
13
|
+
1
|
14
|
+
<?php } ?>
|
15
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('twig', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
--HAML--
|
6
|
+
- if a
|
7
|
+
|
8
|
+
- else
|
9
|
+
1
|
10
|
+
--EXPECT--
|
11
|
+
{% if a %}
|
12
|
+
{% line 3 %}{% else %}
|
13
|
+
1
|
14
|
+
{% endif %}
|
15
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('twig', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
|
6
|
+
--HAML--
|
7
|
+
- trans with {'%x%': elem.courses.count}
|
8
|
+
\%x% courses are sharing the same %element%.
|
9
|
+
--EXPECT--
|
10
|
+
{% trans with {'%x%': elem.courses.count} %}
|
11
|
+
%x% courses are sharing the same %element%.
|
12
|
+
{% endtrans %}
|
13
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('twig', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
|
6
|
+
--HAML--
|
7
|
+
%foo(bar="" data=trigger_dyn_attrs)
|
8
|
+
--EXPECT--
|
9
|
+
<foo {{ mthaml_attributes([['bar', ''], ['data', trigger_dyn_attrs]], 'html5', 'UTF-8', false)|raw }}></foo>
|
10
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$filter = new MtHaml\Filter\CoffeeScript(new CoffeeScript\Compiler);
|
4
|
+
$env = new MtHaml\Environment('twig', array('enable_escaper' => false), array('coffee' => $filter));
|
5
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
6
|
+
|
7
|
+
--HAML--
|
8
|
+
:coffee
|
9
|
+
square = (x) -> x * x
|
10
|
+
:coffee
|
11
|
+
number = #{number}
|
12
|
+
square = (x) -> x * x
|
13
|
+
--EXPECT--
|
14
|
+
<script type="text/javascript">
|
15
|
+
//<![CDATA[
|
16
|
+
// Generated by CoffeeScript PHP 1.3.1
|
17
|
+
(function() {
|
18
|
+
var square;
|
19
|
+
|
20
|
+
square = function(x) {
|
21
|
+
return x * x;
|
22
|
+
};
|
23
|
+
|
24
|
+
}).call(this);
|
25
|
+
|
26
|
+
//]]
|
27
|
+
</script>
|
28
|
+
{% filter mthaml_coffee %}number = {% line 4 %}{{ number }}
|
29
|
+
square = (x) -> x * x
|
30
|
+
{% endfilter %}
|
31
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
--FILE--
|
2
|
+
<?php
|
3
|
+
$env = new MtHaml\Environment('twig', array('enable_escaper' => false));
|
4
|
+
echo $env->compileString($parts['HAML'], "$file.haml");
|
5
|
+
|
6
|
+
--HAML--
|
7
|
+
%html
|
8
|
+
/ foo
|
9
|
+
%p / foo
|
10
|
+
/
|
11
|
+
foo
|
12
|
+
bar
|
13
|
+
-# foo
|
14
|
+
-#
|
15
|
+
foo
|
16
|
+
bar
|
17
|
+
--EXPECT--
|
18
|
+
<html>
|
19
|
+
<!-- foo -->
|
20
|
+
<p><!-- foo --></p>
|
21
|
+
<!--
|
22
|
+
foo
|
23
|
+
bar
|
24
|
+
-->
|
25
|
+
</html>
|
26
|
+
|