Giter VIP home page Giter VIP logo

tage's People

Contributors

13leaf avatar bigbigant avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

bigbigant yywody

tage's Issues

Discuss how to handle tag wrap.

Like this

{{foreach from=$list item='it' key='i'}}
{{$i}},{{$it}}
{{endforeach}}

After Lex,the tokens will like that:foreachTag,newLineText,print $i,print $it,newLineText,endforeachTag.
So the output(with list=[1,3]) should be:
newLine
0,1
newLine
1,3
newLine

That may not be expected.

New Features

  1. ?? operator
    $a ?? $b
    is equals to !empty($a)?$a:$b
  2. set not nullable value
    {{set x!=$a}},indicates x must not be null
    when we try set $x , if $x === null , tage will auto raise an Exception:
if($x === null){
throw new NotNullableException();
}
  1. capture set
    like twig,we can define that powerful set syntax,just like old block works
{{set capture}}
<div></div>
{{endset}}
{{$capture}}

实现Lexer

实现Lexer及TokenStream并能够跑通LexTest的测试。

Enhance Tpl Preparer safety.

I see the t include path was simply get by 'tplDir+id'.
I think we should protect id inject (which may try to access out of tplDir).

To support PHP short tag.

I just added some scenarios to LexTest.
I found that Lex doesn't support PHP short tag yet.
So there's a failed assertion.

By the way, the Lex's demonstration is pretty cool!

expressions

$foo
$foo.bar
$foo.bar()
字符串:'string', "string"

布尔值:true, false

空: null

数字

逻辑运算符:&&,||,!

数学运算符:+,-,,/,*(幂乘),//(整除)

字符串连接运算符: ~

range运算符: .. (如1..9 或 'a'..'z')

in 操作符: 如 $item in $items

数组:此处所说的数组是php中得通用array概念。(既是map也是数组)。如 [$a,$b,$c] 、 [3:$a,'mykey':$b,]

Milestone1的讨论

  1. Etag中对+操作符的编译结果是否考虑覆盖php默认+的实现?
    例如{{a+b}}转换到etag_add(a,b)而不是((a)+(b))。好处是可以直接实现ab为字符串时的连接行为,无需增加新的字符串concat符。(在其它模板引擎中使用~来做字符串连接)。覆盖的问题会增加函数开销,导致解释结果的性能下降。
  2. Etag转换过程中使用的一些内置函数(原属api)Runtime怎么安置?
    例如1中的etag_add,是否直接在Runtime实现并作为一个全局函数?

下面是参考其它模板引擎的一些比较有趣的feature,看看是否有必要在后续考虑引入:

jade为代表的依靠缩写表达式来节约html的冗余性。以slim举例:

body
  p
    |
      This is a test of the text block.

结果将是

<body><p>This is a test of the text block.</p></body>

list作用域

类似Handlebars可以这样使用.
{{#list people}}{{firstName}} {{lastName}}{{/list}}
等同于{{people.firstName}} {{people.lastName}}

View的数据绑定与共享传递

laravel中可以对View绑定数据提供者,以此实现MVC。还可以让视图之间做数据传递(可以解决之前专题组件的联动更新问题?)。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.