mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Add better comments to template parsers
This commit is contained in:
parent
b5cf446375
commit
44e1ed32a2
2 changed files with 35 additions and 3 deletions
|
|
@ -5,6 +5,18 @@ namespace Rhymix\Framework\Parsers\Template;
|
|||
use HTMLDisplayHandler;
|
||||
use Rhymix\Framework\Template;
|
||||
|
||||
/**
|
||||
* Template parser v1 for XE compatibility.
|
||||
*
|
||||
* Originally part of TemplateHandler, this parser is preserved here
|
||||
* for bug-for-bug compatibility with XE and older versions of Rhymix.
|
||||
* A significant part of this code dates back to the early days of XE,
|
||||
* though Rhymix has managed to squeeze in a few new features.
|
||||
*
|
||||
* Except in the case of a serious security issue, there will be no change
|
||||
* to the parsing and conversion logic, and no new features.
|
||||
* It is strongly recommended that new templates be written in v2.
|
||||
*/
|
||||
class TemplateParser_v1
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,22 +4,42 @@ namespace Rhymix\Framework\Parsers\Template;
|
|||
|
||||
use Rhymix\Framework\Template;
|
||||
|
||||
/**
|
||||
* Template parser v2
|
||||
*
|
||||
* This is a new template engine, rewritten from scratch to act as a bridge
|
||||
* between legacy XE-style templates and new Blade-style templates.
|
||||
*
|
||||
* It supports not only Blade directives but also a number of v1 features,
|
||||
* such as automatic path conversion and centralized asset management,
|
||||
* which are especially important given the modular structure of Rhymix.
|
||||
*
|
||||
* Commonly used elements of the v1 template language are also supported
|
||||
* for ease of migration, while some of the older and/or more bug-prone parts
|
||||
* of v1 have been dropped.
|
||||
*/
|
||||
class TemplateParser_v2
|
||||
{
|
||||
/**
|
||||
* Store template info here.
|
||||
* Cache template path info here.
|
||||
*/
|
||||
public $template;
|
||||
public $source_type;
|
||||
|
||||
/**
|
||||
* Temporary information for conversion.
|
||||
* Properties for internal bookkeeping.
|
||||
*/
|
||||
protected $_aliases = [];
|
||||
protected $_stack = [];
|
||||
protected $_uniq_order = 1;
|
||||
|
||||
// Loop definitions.
|
||||
/**
|
||||
* Definitions of loop and condition directives.
|
||||
*
|
||||
* %s : Full PHP code passed to the directive in parentheses.
|
||||
* %array : The array used in a foreach/forelse loop.
|
||||
* %uniq : A random string that identifies a specific loop or condition.
|
||||
*/
|
||||
protected static $_loopdef = [
|
||||
'if' => ['if (%s):', 'endif;'],
|
||||
'unless' => ['if (!(%s)):', 'endif;'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue