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,37 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Filter;
|
4
|
+
|
5
|
+
use MtHaml\NodeVisitor\RendererAbstract as Renderer;
|
6
|
+
use MtHaml\Node\Filter;
|
7
|
+
|
8
|
+
class Scss extends AbstractFilter
|
9
|
+
{
|
10
|
+
private $scss;
|
11
|
+
|
12
|
+
public function __construct($scss)
|
13
|
+
{
|
14
|
+
if (!is_object($scss) || (!is_a($scss, 'Leafo\ScssPhp\Compiler') && !is_a($scss, 'scssc'))) {
|
15
|
+
throw new \InvalidArgumentException(sprintf(
|
16
|
+
'Argument 1 passed to %s::__construct() must be an instance of %s or %s, %s given',
|
17
|
+
__CLASS__, 'Leafo\ScssPhp\Compiler', 'scssc', is_object($scss) ? 'instance of '.get_class($scss) : gettype($scss)
|
18
|
+
));
|
19
|
+
}
|
20
|
+
|
21
|
+
$this->scss = $scss;
|
22
|
+
}
|
23
|
+
|
24
|
+
public function optimize(Renderer $renderer, Filter $node, $options)
|
25
|
+
{
|
26
|
+
$renderer->write($this->filter($this->getContent($node), array(), $options));
|
27
|
+
}
|
28
|
+
|
29
|
+
public function filter($content, array $context, $options)
|
30
|
+
{
|
31
|
+
if (isset($options['cdata']) && $options['cdata'] === true) {
|
32
|
+
return "<style type=\"text/css\">\n/*<![CDATA[*/\n".$this->scss->compile($content)."\n/*]]>*/\n</style>";
|
33
|
+
}
|
34
|
+
|
35
|
+
return "<style type=\"text/css\">\n".$this->scss->compile($content)."\n</style>";
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Filter;
|
4
|
+
|
5
|
+
use MtHaml\Node\Filter;
|
6
|
+
use MtHaml\NodeVisitor\RendererAbstract as Renderer;
|
7
|
+
use MtHaml\NodeVisitor\TwigRenderer;
|
8
|
+
|
9
|
+
class Twig extends AbstractFilter
|
10
|
+
{
|
11
|
+
private $twig;
|
12
|
+
|
13
|
+
public function __construct(\Twig_Environment $twig = null)
|
14
|
+
{
|
15
|
+
$this->twig = $twig;
|
16
|
+
if (null !== $twig && !function_exists('twig_template_from_string')) {
|
17
|
+
$twig->addExtension(new \Twig_Extension_StringLoader());
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
public function isOptimizable(Renderer $renderer, Filter $node, $options)
|
22
|
+
{
|
23
|
+
if (!$renderer instanceof TwigRenderer) {
|
24
|
+
return false;
|
25
|
+
}
|
26
|
+
|
27
|
+
return parent::isOptimizable($renderer, $node, $options);
|
28
|
+
}
|
29
|
+
|
30
|
+
public function optimize(Renderer $renderer, Filter $node, $options)
|
31
|
+
{
|
32
|
+
foreach ($node->getChilds() as $line) {
|
33
|
+
$content = '';
|
34
|
+
foreach ($line->getContent()->getChilds() as $child) {
|
35
|
+
$content .= $child->getContent();
|
36
|
+
}
|
37
|
+
$renderer->write($content);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
public function filter($content, array $context, $options)
|
42
|
+
{
|
43
|
+
$template = twig_template_from_string($this->twig, $content);
|
44
|
+
|
45
|
+
return $template->render($context);
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Indentation;
|
4
|
+
|
5
|
+
class Indentation implements IndentationInterface
|
6
|
+
{
|
7
|
+
private $char;
|
8
|
+
private $width;
|
9
|
+
private $level;
|
10
|
+
|
11
|
+
public static function oneLevel($indent)
|
12
|
+
{
|
13
|
+
$char = self::getIndentChar($indent);
|
14
|
+
$width = strlen($indent);
|
15
|
+
|
16
|
+
return new self($char, $width, $indent);
|
17
|
+
}
|
18
|
+
|
19
|
+
public function newLevel($indent)
|
20
|
+
{
|
21
|
+
if (0 === strlen($indent)) {
|
22
|
+
return new self($this->char, $this->width, $indent);
|
23
|
+
}
|
24
|
+
|
25
|
+
$char = self::getIndentChar($indent);
|
26
|
+
|
27
|
+
$this->checkSameChar($char);
|
28
|
+
|
29
|
+
$new = new self($this->char, $this->width, $indent);
|
30
|
+
|
31
|
+
if ($new->level > $this->level + 1) {
|
32
|
+
throw new IndentationException('The line was indented more than one level deeper than the previous line');
|
33
|
+
}
|
34
|
+
|
35
|
+
return $new;
|
36
|
+
}
|
37
|
+
|
38
|
+
public function getChar()
|
39
|
+
{
|
40
|
+
return $this->char;
|
41
|
+
}
|
42
|
+
|
43
|
+
public function getWidth()
|
44
|
+
{
|
45
|
+
return $this->width;
|
46
|
+
}
|
47
|
+
|
48
|
+
public function getLevel()
|
49
|
+
{
|
50
|
+
return $this->level;
|
51
|
+
}
|
52
|
+
|
53
|
+
public function getString($levelOffset = 0, $fallback = null)
|
54
|
+
{
|
55
|
+
$length = $this->width * ($this->level + $levelOffset);
|
56
|
+
return str_repeat($this->char, $length);
|
57
|
+
}
|
58
|
+
|
59
|
+
private static function getIndentChar($indent)
|
60
|
+
{
|
61
|
+
$char = count_chars($indent, 3 /* 3 = return unique chars */);
|
62
|
+
|
63
|
+
if (1 !== strlen($char)) {
|
64
|
+
throw new IndentationException("Indentation can't use both tabs and spaces");
|
65
|
+
}
|
66
|
+
|
67
|
+
if (' ' !== $char && "\t" !== $char) {
|
68
|
+
throw new IndentationException("Indentation can use only tabs or spaces");
|
69
|
+
}
|
70
|
+
|
71
|
+
return $char;
|
72
|
+
}
|
73
|
+
|
74
|
+
private function __construct($char, $width, $indent)
|
75
|
+
{
|
76
|
+
$this->char = $char;
|
77
|
+
$this->width = $width;
|
78
|
+
|
79
|
+
if (0 !== (strlen($indent) % $width)) {
|
80
|
+
$msg = sprintf('Inconsistent indentation: %d is not a multiple of %d', strlen($indent), $this->width);
|
81
|
+
throw new IndentationException($msg);
|
82
|
+
}
|
83
|
+
|
84
|
+
$this->level = strlen($indent) / $width;
|
85
|
+
}
|
86
|
+
|
87
|
+
private function checkSameChar($char)
|
88
|
+
{
|
89
|
+
if ($char !== $this->char) {
|
90
|
+
$expected = $this->char === ' ' ? 'spaces' : 'tabs';
|
91
|
+
$actual = $char === ' ' ? 'spaces' : 'tabs';
|
92
|
+
$msg = sprintf('Inconsistent indentation: %s were used for indentation, but the rest of the document was indented using %s', $actual, $expected);
|
93
|
+
throw new IndentationException($msg);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Indentation;
|
4
|
+
|
5
|
+
interface IndentationInterface
|
6
|
+
{
|
7
|
+
/**
|
8
|
+
* Transitions to new indentation level
|
9
|
+
*
|
10
|
+
* @return IndentationInterface
|
11
|
+
*/
|
12
|
+
public function newLevel($indent);
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Returns the indentation char
|
16
|
+
*
|
17
|
+
* @return string|null
|
18
|
+
*/
|
19
|
+
public function getChar();
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Returns the indentation width
|
23
|
+
*
|
24
|
+
* @return int|null
|
25
|
+
*/
|
26
|
+
public function getWidth();
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Returns the indentation level
|
30
|
+
*
|
31
|
+
* @return int
|
32
|
+
*/
|
33
|
+
public function getLevel();
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Returns the indentation string for the current line
|
37
|
+
*
|
38
|
+
* Returns the string that should be used for indentation in regard to the
|
39
|
+
* current indentation state.
|
40
|
+
*
|
41
|
+
* @param int $levelOffset Identation level offset
|
42
|
+
* @param string $fallback Fallback indent string. If there is
|
43
|
+
* currently no indentation level and
|
44
|
+
* fallback is not null, the first char of
|
45
|
+
* $fallback is returned instead
|
46
|
+
* @return string A string of zero or more spaces or tabs
|
47
|
+
*/
|
48
|
+
public function getString($levelOffset = 0, $fallback = null);
|
49
|
+
}
|
50
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Indentation;
|
4
|
+
|
5
|
+
class Undefined implements IndentationInterface
|
6
|
+
{
|
7
|
+
public function newLevel($indent)
|
8
|
+
{
|
9
|
+
if (0 == strlen($indent)) {
|
10
|
+
return $this;
|
11
|
+
} else {
|
12
|
+
return Indentation::oneLevel($indent);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
public function getChar()
|
17
|
+
{
|
18
|
+
return null;
|
19
|
+
}
|
20
|
+
|
21
|
+
public function getWidth()
|
22
|
+
{
|
23
|
+
return null;
|
24
|
+
}
|
25
|
+
|
26
|
+
public function getLevel()
|
27
|
+
{
|
28
|
+
return 0;
|
29
|
+
}
|
30
|
+
|
31
|
+
public function getString($levelOffset = 0, $fallback = null)
|
32
|
+
{
|
33
|
+
$char = substr($fallback, 0, 1);
|
34
|
+
if (' ' === $char || "\t" === $char) {
|
35
|
+
return $char;
|
36
|
+
}
|
37
|
+
|
38
|
+
return '';
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Node;
|
4
|
+
|
5
|
+
use MtHaml\NodeVisitor\NodeVisitorInterface;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Comment Node
|
9
|
+
*/
|
10
|
+
class Comment extends NestAbstract
|
11
|
+
{
|
12
|
+
protected $rendered;
|
13
|
+
protected $condition;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @param array $position
|
17
|
+
* @param bool $rendered Whether the comment is rendered in the
|
18
|
+
* HTML output (as a HTML comment).
|
19
|
+
* @param string $condition IE condition. If not null, the HTML comment
|
20
|
+
* will be rendered as an IE conditional
|
21
|
+
* comment.
|
22
|
+
*/
|
23
|
+
public function __construct(array $position, $rendered, $condition = null)
|
24
|
+
{
|
25
|
+
parent::__construct($position);
|
26
|
+
$this->rendered = $rendered;
|
27
|
+
$this->condition = $condition;
|
28
|
+
}
|
29
|
+
|
30
|
+
public function isRendered()
|
31
|
+
{
|
32
|
+
return $this->rendered;
|
33
|
+
}
|
34
|
+
|
35
|
+
public function hasCondition()
|
36
|
+
{
|
37
|
+
return null !== $this->condition;
|
38
|
+
}
|
39
|
+
|
40
|
+
public function getCondition()
|
41
|
+
{
|
42
|
+
return $this->condition;
|
43
|
+
}
|
44
|
+
|
45
|
+
public function getNodeName()
|
46
|
+
{
|
47
|
+
return 'comment';
|
48
|
+
}
|
49
|
+
|
50
|
+
public function accept(NodeVisitorInterface $visitor)
|
51
|
+
{
|
52
|
+
if (false !== $visitor->enterComment($this)) {
|
53
|
+
|
54
|
+
if (false !== $visitor->enterCommentContent($this)) {
|
55
|
+
$this->visitContent($visitor);
|
56
|
+
}
|
57
|
+
$visitor->leaveCommentContent($this);
|
58
|
+
|
59
|
+
if (false !== $visitor->enterCommentChilds($this)) {
|
60
|
+
$this->visitChilds($visitor);
|
61
|
+
}
|
62
|
+
$visitor->leaveCommentChilds($this);
|
63
|
+
}
|
64
|
+
$visitor->leaveComment($this);
|
65
|
+
}
|
66
|
+
|
67
|
+
public function allowsNestingAndContent()
|
68
|
+
{
|
69
|
+
return ! $this->rendered;
|
70
|
+
}
|
71
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Node;
|
4
|
+
|
5
|
+
use MtHaml\NodeVisitor\NodeVisitorInterface;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Doctype Node
|
9
|
+
*/
|
10
|
+
class Doctype extends NodeAbstract
|
11
|
+
{
|
12
|
+
protected $doctypeId;
|
13
|
+
protected $options;
|
14
|
+
|
15
|
+
protected $doctypes = array(
|
16
|
+
'xhtml' => array(
|
17
|
+
'' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
18
|
+
'strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
19
|
+
'frameset' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
20
|
+
'5' => '<!DOCTYPE html>',
|
21
|
+
'1.1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
22
|
+
'basic' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
23
|
+
'mobile' => '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">',
|
24
|
+
'rdfa' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
|
25
|
+
),
|
26
|
+
'html4' => array(
|
27
|
+
'' => '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
28
|
+
'strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
29
|
+
'frameset' => '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
|
30
|
+
),
|
31
|
+
'html5' => array(
|
32
|
+
'' => '<!DOCTYPE html>',
|
33
|
+
'5' => '<!DOCTYPE html>',
|
34
|
+
),
|
35
|
+
);
|
36
|
+
|
37
|
+
public function __construct(array $position, $doctypeId, $options)
|
38
|
+
{
|
39
|
+
parent::__construct($position);
|
40
|
+
$this->doctypeId = $doctypeId;
|
41
|
+
$this->options = $options;
|
42
|
+
}
|
43
|
+
|
44
|
+
public function getDoctype($format)
|
45
|
+
{
|
46
|
+
$lcid = strtolower($this->doctypeId);
|
47
|
+
|
48
|
+
if ($lcid === 'xml') {
|
49
|
+
if ('xhtml' !== $format) {
|
50
|
+
return '';
|
51
|
+
}
|
52
|
+
if (!empty($this->options)) {
|
53
|
+
return sprintf("<?xml version='1.0' encoding='%s' ?>", $this->options);
|
54
|
+
} else {
|
55
|
+
return "<?xml version='1.0' encoding='utf-8' ?>";
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
if (empty($lcid)) {
|
60
|
+
return $this->doctypes[$format][''];
|
61
|
+
} elseif (isset($this->doctypes[$format][$lcid])) {
|
62
|
+
return $this->doctypes[$format][$lcid];
|
63
|
+
} else {
|
64
|
+
|
65
|
+
$doctypes = array();
|
66
|
+
foreach ($this->doctypes[$format] as $key => $doctype) {
|
67
|
+
$doctypes[] = "'".trim('!!! ' . $key)."'";
|
68
|
+
}
|
69
|
+
|
70
|
+
trigger_error(sprintf("No such doctype '!!! %s' for the format '%s'. Available doctypes for the current format are: %s", $this->doctypeId, $format, implode(', ', $doctypes)), E_USER_WARNING);
|
71
|
+
|
72
|
+
return $this->doctypes[$format][''];
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
public function getDoctypeId()
|
77
|
+
{
|
78
|
+
return $this->doctypeId;
|
79
|
+
}
|
80
|
+
|
81
|
+
public function getOptions()
|
82
|
+
{
|
83
|
+
return $this->options;
|
84
|
+
}
|
85
|
+
|
86
|
+
public function getNodeName()
|
87
|
+
{
|
88
|
+
return 'doctype';
|
89
|
+
}
|
90
|
+
|
91
|
+
public function accept(NodeVisitorInterface $visitor)
|
92
|
+
{
|
93
|
+
$visitor->enterDoctype($this);
|
94
|
+
$visitor->leaveDoctype($this);
|
95
|
+
}
|
96
|
+
}
|