From 6c8060163435c991ba8680b617b4d4cbac5ee681 Mon Sep 17 00:00:00 2001 From: Steve Oliver Date: Thu, 3 Oct 2013 22:15:48 -0700 Subject: [PATCH] Update grammar of internals.rst Some changes that I think help the docs read easier. --- doc/internals.rst | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/doc/internals.rst b/doc/internals.rst index 9a9cb52..16f425a 100644 --- a/doc/internals.rst +++ b/doc/internals.rst @@ -42,7 +42,7 @@ an instance of ``Twig_Token``, and the stream is an instance of * ``Twig_Token::EOF_TYPE``: Ends of template. You can manually convert a source code into a token stream by calling the -``tokenize()`` of an environment:: +``tokenize()`` method of an environment:: $stream = $twig->tokenize($source, $identifier); @@ -63,7 +63,7 @@ Here is the output for the ``Hello {{ name }}`` template: .. note:: - You can change the default lexer use by Twig (``Twig_Lexer``) by calling + The default lexer (``Twig_Lexer``) can be changed by calling the ``setLexer()`` method:: $twig->setLexer($lexer); @@ -97,7 +97,7 @@ Here is the output for the ``Hello {{ name }}`` template: .. note:: - The default parser (``Twig_TokenParser``) can be also changed by calling the + The default parser (``Twig_TokenParser``) can be changed by calling the ``setParser()`` method:: $twig->setParser($parser); @@ -108,13 +108,11 @@ The Compiler The last step is done by the compiler. It takes a node tree as an input and generates PHP code usable for runtime execution of the template. -You can call the compiler by hand with the ``compile()`` method of an -environment:: +You can manually compile a node tree to PHP code with the ``compile()`` method +of an environment:: $php = $twig->compile($nodes); -The ``compile()`` method returns the PHP source code representing the node. - The generated template for a ``Hello {{ name }}`` template reads as follows (the actual output can differ depending on the version of Twig you are using):: @@ -134,7 +132,7 @@ using):: .. note:: - As for the lexer and the parser, the default compiler (``Twig_Compiler``) can - be changed by calling the ``setCompiler()`` method:: + The default compiler (``Twig_Compiler``) can be changed by calling the + ``setCompiler()`` method:: $twig->setCompiler($compiler); -- 1.7.2.5