Changeset 31589 in project


Ignore:
Timestamp:
10/05/14 05:51:49 (6 years ago)
Author:
Ivan Raikov
Message:

ersatz: updates for better consistency with jinja

Location:
release/4/ersatz/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/4/ersatz/trunk/ersatz-lib.scm

    r31479 r31589  
    6666         op-capitalize op-title op-escape-html op-urlize op-striptags op-trim op-pad
    6767         op-wordcount op-sort op-dictsort
    68          op-list op-sublist op-group-by
     68         op-list op-sublist op-batch
    6969         )
    7070
     
    460460    (striptags  . ,(func-arg1 op-striptags))
    461461    (sort       . ,(func-arg1 op-sort))
    462     (dict       . ,(func-arg1 op-dict))
    463462    (upper      . ,(func-arg1 op-upper))
    464463    (reverse    . ,(func-arg1 op-reverse))
     
    470469    (urlize     . ,(func-arg1 op-urlize))
    471470    (wordcount  . ,(func-arg1 op-wordcount))
    472    
     471
     472    (dict    . ,(func-arg1 op-dict))
     473    (keys    . ,(func-arg1 op-keys))
    473474    (attr    . ,(func-arg2 op-attr))
    474475    (haskey  . ,(func-arg2 op-haskey))
     476
    475477    (batch   . ,(func-arg2 op-batch))
    476478    (default . ,(func-arg2 op-default))
     
    486488    (substring . ,(func-arg3 op-substring))
    487489    (sublist   . ,(func-arg3 op-sublist))
    488 
    489     (groupBy   . ,(func-arg2 op-group-by))
     490    (btach     . ,(func-arg2 op-batch))
    490491   
    491492    ;; built-in tests
  • release/4/ersatz/trunk/ersatz.setup

    r31435 r31589  
    44  (make-pathname #f fn ##sys#load-dynamic-extension))   
    55
    6 (define version 1.17)
     6(define version 1.18)
    77
    88(use make)
  • release/4/ersatz/trunk/runtime.scm

    r31435 r31589  
    11041104
    11051105
    1106 (define (op-group-by base lst kwargs)
     1106(define (op-batch base lst kwargs)
    11071107  (let ((base (unbox-int base))
    11081108        (lst  (unbox-list lst)))
     
    12011201                       
    12021202
     1203(define (op-keys val kwargs)
     1204  (let ((alst (unbox-obj val)))
     1205    (Tlist (map (lambda (key.val)
     1206                  (let ((name (car key.val)))
     1207                    (Tstr (->string name))))
     1208                alst))
     1209    ))
     1210                       
     1211
    12031212(define (func-arg0 f)
    12041213  (Tfun (lambda (args kwargs)
  • release/4/ersatz/trunk/tests/run.scm

    r31397 r31589  
    229229  (test-assert "sublist" (tval-equal? (op-sublist (Tint 1) (Tint 3) (Tlist (list (Tint 0) (Tint 1) (Tint 2) (Tint 3))) kwargs)
    230230                                      (Tlist (list (Tint 1) (Tint 2) (Tint 3)))))
    231 
    232   (test-assert "groupBy" (tval-equal? (op-group-by (Tint 3) (Tlist (list (Tint 0) (Tint 1) (Tint 2) (Tint 3))) kwargs)
    233                                       (Tlist (list (Tlist (list (Tint 0) (Tint 1) (Tint 2))) (Tlist (list (Tint 3)))))))
     231 
     232  (test-assert "batch" (tval-equal? (op-batch (Tint 3) (Tlist (list (Tint 0) (Tint 1) (Tint 2) (Tint 3))) kwargs)
     233                                    (Tlist (list (Tlist (list (Tint 0) (Tint 1) (Tint 2))) (Tlist (list (Tint 3)))))))
    234234
    235235  (test-assert "expand and escape"
Note: See TracChangeset for help on using the changeset viewer.