From divanov at aha.ru Tue Apr 15 13:29:44 2008 From: divanov at aha.ru (Dmitriy Ivanov) Date: Tue, 15 Apr 2008 17:29:44 +0400 Subject: [html-template-devel] More power of *format-non-strings* Message-ID: Hello folks, I suggest making *format-non-strings* more meaningful and differentiating among true values. It the value of *format-non-strings* equals to T, it uses (format nil "~A" ...). Otherwise it must be a function of one argument converting the variable value to a string. -- Sincerely, Dmitriy Ivanov lisp.ystok.ru From edi at agharta.de Tue Apr 15 14:43:41 2008 From: edi at agharta.de (Edi Weitz) Date: Tue, 15 Apr 2008 16:43:41 +0200 Subject: [html-template-devel] More power of *format-non-strings* In-Reply-To: (Dmitriy Ivanov's message of "Tue, 15 Apr 2008 17:29:44 +0400") References: Message-ID: On Tue, 15 Apr 2008 17:29:44 +0400, "Dmitriy Ivanov" wrote: > I suggest making *format-non-strings* more meaningful and > differentiating among true values. > > It the value of *format-non-strings* equals to T, it uses > (format nil "~A" ...). > > Otherwise it must be a function of one argument converting the > variable value to a string. Sounds good to me. Do you have a patch up your sleeve? From divanov at aha.ru Tue Apr 15 16:08:57 2008 From: divanov at aha.ru (Dmitriy Ivanov) Date: Tue, 15 Apr 2008 20:08:57 +0400 Subject: [html-template-devel] Re: More power of *format-non-strings* References: Message-ID: "Edi Weitz" wrote: EW> Sounds good to me. Do you have a patch up your sleeve? Almost. It is just a matter of replacing the line (cond (*format-non-strings* (format nil "~A" value)) by the two following (cond ((eq *format-non-strings* t) (princ-to-string value)) (*format-non-strings* (funcall *format-non-strings* value)) within create-var-printer in the file template.lisp. -- Sincerely, Dmitriy Ivanov lisp.ystok.ru From edi at agharta.de Tue Apr 15 16:19:36 2008 From: edi at agharta.de (Edi Weitz) Date: Tue, 15 Apr 2008 18:19:36 +0200 Subject: [html-template-devel] Re: More power of *format-non-strings* In-Reply-To: (Dmitriy Ivanov's message of "Tue, 15 Apr 2008 20:08:57 +0400") References: Message-ID: On Tue, 15 Apr 2008 20:08:57 +0400, "Dmitriy Ivanov" wrote: > Almost. It is just a matter of replacing the line > > (cond (*format-non-strings* (format nil "~A" value)) > > by the two following > > (cond ((eq *format-non-strings* t) (princ-to-string value)) > (*format-non-strings* (funcall *format-non-strings* value)) > > within create-var-printer in the file template.lisp. Yes, that's the easy part. The documentation is missing, though. http://weitz.de/patches.html From divanov at aha.ru Tue Apr 22 05:59:49 2008 From: divanov at aha.ru (Dmitriy Ivanov) Date: Tue, 22 Apr 2008 09:59:49 +0400 Subject: [html-template-devel] Re: Additions to html-template References: <1159815367.4091.47.camel@kfreedom.onshored.com> Message-ID: Hello folks, "Andrew Golding" wrote: AG> Recently at Onshore Development, we have started using AG> HTML-TEMPLATE to render web-pages in an application we call Woofie, AG> which provides an alternative interface to Webcheckout. AG> |...snip...| AG> I would appreciate any comments, and I will try to answer any AG> questions should there be any (I'm guessing there will). The code AG> can be found at AG> http://kfreedom.onshored.com/html-template-additions.lisp , and should work with AG> the standard html-template 0.7.0 package. Some of those suggestions look valueable to me though they are a bit old. Unfortunately, Andrew's page is not available now, and he has not replied to my private e-mail. Has anybody saved (a version of) the mentioned code? -- Sincerely, Dmitriy Ivanov lisp.ystok.ru From edi at agharta.de Tue Apr 22 06:13:34 2008 From: edi at agharta.de (Edi Weitz) Date: Tue, 22 Apr 2008 08:13:34 +0200 Subject: [html-template-devel] Re: Additions to html-template In-Reply-To: (Dmitriy Ivanov's message of "Tue, 22 Apr 2008 09:59:49 +0400") References: <1159815367.4091.47.camel@kfreedom.onshored.com> Message-ID: On Tue, 22 Apr 2008 09:59:49 +0400, "Dmitriy Ivanov" wrote: > Some of those suggestions look valueable to me Was the mail you're replying to sent to the list? I didn't see it. From divanov at aha.ru Tue Apr 22 07:10:19 2008 From: divanov at aha.ru (Dmitriy Ivanov) Date: Tue, 22 Apr 2008 11:10:19 +0400 Subject: [html-template-devel] Re: Additions to html-template References: <1159815367.4091.47.camel@kfreedom.onshored.com> Message-ID: "Edi Weitz" wrote: EW> Was the mail you're replying to sent to the list? I didn't see EW> it. Yes. It was dated as of 2006-10-02 and is kept in gmane along with your answer as of 2006-10-04. -- Sincerely, Dmitriy Ivanov lisp.ystok.ru From edi at agharta.de Tue Apr 22 07:17:53 2008 From: edi at agharta.de (Edi Weitz) Date: Tue, 22 Apr 2008 09:17:53 +0200 Subject: [html-template-devel] Re: Additions to html-template In-Reply-To: (Dmitriy Ivanov's message of "Tue, 22 Apr 2008 11:10:19 +0400") References: <1159815367.4091.47.camel@kfreedom.onshored.com> Message-ID: On Tue, 22 Apr 2008 11:10:19 +0400, "Dmitriy Ivanov" wrote: > Yes. It was dated as of 2006-10-02 and is kept in gmane along with > your answer as of 2006-10-04. Ah, OK. That's a /very/ old one then... :) From divanov at aha.ru Mon Apr 28 17:41:03 2008 From: divanov at aha.ru (Dmitriy Ivanov) Date: Mon, 28 Apr 2008 21:41:03 +0400 Subject: [html-template-devel] HTML_EVAL addition - "lispy" extension of tag attribute syntax Message-ID: Hello folks, This addition has been inspired by the suggestion of Andrew Golding posted more than one year and a half ago. Summary ----------- 1. A Lisp form in place of "plane attribute" is allowed. Forms are read by the standard read function. All starting tags except TMPL_INCLUDE accept forms instead of "old style" attributes. To force reading those tags in "compatibility" mode, set *attributes-are-lisp-forms*, a new special variable, to NIL. 2. Symbols follow standard Lisp syntax: a package specifier is allowed in front of the name. By default, symbols are interned into the package *template-package*, a new special variable. (Shall we reuse the same *template-symbol-package* instead?) 3. To interpret the forms in run-time, the template-eval was introduced. It is a simple evaluator akin to the standard eval function except for: - A limited number of special-forms is supported, namely: IF WHEN UNLESS AND OR NOT QUOTE. - The symbol with a name like *var* is treated as a dynamic variable and is retrieved via symbol-value. - The values of other symbols are looked up via *value-access-function*. 4. The TMPL_EVAL tag and create-eval-printer were introduced; the former should be used instead of the TMPL_VAR tag. 5. The value of *format-non-strings* has got an additional meaning. If eq to T, the result is produced by means of princ-to-string, i.e. (format nil "~A" ...). If it is true but not eq to T, the value must be a single-parameter function, which converts its argument to a string. Examples ------------ Some examples follow and illustrate the syntax proposed. They rely on alist instead of a plist structure binding template variables to values. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq template:*value-access-function* (lambda (symbol environment &optional in-loop-p) (let ((result (cdr (assoc symbol environment :test #'eq)))) (if (and in-loop-p template:*sequences-are-lists*) (loop for element in result ; keep values from upper levels collect (if (consp element) (append element environment) element)) result)))) (defvar *decimal-digits* 2) (template:fill-and-print-template "" '((foo . 234.5))) (let ((*decimal-digits* 3)) (template:fill-and-print-template "" '((foo . 234.5)))) (template:fill-and-print-template "[]" '((foo . "abc") (bar . "456") (baz . "xyz"))) (template:fill-and-print-template "[]" '((discr . t) (foo . "then") (bar . "else"))) (template:fill-and-print-template "[]" '((discr . t) (foo . "then") (bar . "else"))) (template:fill-and-print-template "[]" '((discr . t) (foo . "then") (bar . "else"))) (template:fill-and-print-template "[]def" '((foo . "abc"))) (template:fill-and-print-template ; "[1][2-two][3]" "[]" '((list . (((item . "1")) ((item . "2") (item2 . "-two")) ((item . "3")))))) (template:fill-and-print-template "" '((baz . "Q") (foo . (("" (bar . "U") (baz . "4")) ("X" (bar . "U")))))) (let ((template:*sequences-are-lists* nil)) (template:fill-and-print-template "[]" '((vector . #(((item . "1")) ((item . "2") (item2 . "-two")) ((item . "3")))))) (template:fill-and-print-template "" '((baz . "Q") (foo . #(("" (bar . "U") (baz . "4")) ("X" (bar . "U"))))))) (template:fill-and-print-template "[x]" '((foo . -3))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; The source code of the addition is not available as a patch at the moment. All the new and altered definitions are in template-eval.lisp. This separate file could be compiled and loaded after the html-template system to taste the addition. I am not sure about the proper way of integration with other code yet :-) -- Sincerely, Dmitriy Ivanov lisp.ystok.ru begin 666 template-eval.lisp M.SL[("TJ+2!-;V1E.B!,25-0.R!3>6YT87 at Z($-/34U/3BU,25-0.R!086-K M86=E.B!(5$U,+51%35!,051%.R!"87-E.B Q," M*BT-"CL[.R D2&5A9&5R M) T*#0H[.SL at 0V]P>7)I9VAT("AC*2 R,# S+3(P,#7)I9VAT#0H[.SL@(" @ M(&YO=&EC92P@=&AI2!T:&4@6YA;6EC('9A6UB;VPM=F%L=64N#0H[.SL@(" @ M+2!4:&4@=F%L=65S(&]F(&]T:&5R('-Y;6)O;', at 87)E(&QO;VME9"!U<"!V M:6$@*G9A;'5E+6%C8V5S2!M96%N2!A8V-E<'0@"X-"E5S960 at 8GDZ(&-R96%T92UT96UP;&%T M92UP"XB*0T*#0HH9&5F=F%R("IT96UP;&%T92UP86-K86=E M*B H9FEN9"UP86-K86=E("6UB;VQS(&%R92!I;G1EF5D. at T*(" @("!)1B!72$5. M(%5.3$534R!!3D0 at 3U(@3D]4(%%53U1%+ at T*(" @268@:70@:7, at 82!S>6UB M;VPL('1H92!E=F%L=6%T;W(@;&]O:W, at 870@:71S(&YA;64 at 9FER6YA;6EC('9A2!I;G9O:V4 at +3X@*&5R2!F=6YC=&EO M;@T*(" @(" @(" @(" @(" @(" @(" @*&QO;W @9F]R(&%R9R!I;B!A7=O2!C;VYS=&%N=',@:6X at 3&ES<"X-"B @(" @ M(" @(#L[(%1H92!B96QO=R!C;V1E('!R;W9I9&5S(&-O;7!A=&EB:6QI='D@ M8G5T(&QO;VMS('-L:6=H=&QY('5G;'DN#0H@(" @(" @(" H:68@*&ME>7=O M6UB;VPM;F%M92 H6UB;VP@:7, at 82!,:7-P('-P96-I M86P@=F%R:6%B;&4 at +2!T86ME(&ET6UA;FEC('9A;'5E+ T*(" @(" @ M(" @(" @(" @(" [.R!I+F4N(&5I=&AE&-U=&EO;B!P6UB;VP@:7, at 82 B=7-U86PB('1E;7!L871E('9A&EC86PB(&5N=FER;VYM M96YT#0H@(" @(" @(" @(" @(" @("AF=6YC86QL("IV86QU92UA8V-E'0M9FXI#0H@ M(")52!O9B!T:&4@ M;&]O<"X-"B!.15A4+49.(&ES('1H92!N97AT(&9U;F-T:6]N('1O(&)E(&-A M;&QE9"!I;B!T:&4 at 8VAA:6X@;V8 at 8VQO2UF;B!V86QU92DI#0H@(" @(" @(" @(" @("AF=6YC M86QL(&YE>'0M9FX at 96YV:7)O;FUE;G0I*2D-"B @(" @(" @(" H= T*(" @ M(" @(" @(" @*&QA;6)D82 H96YV:7)O;FUE;G0I#0H@(" @(" @(" @(" @ M("AW2UF;B!V86QU92DI#0H@(" @(" @(" @(" @("AF M=6YC86QL(&YE>'0M9FX at 96YV:7)O;FUE;G0I*2DI*2D-"@T**&1E9G5N(&-R M96%T92UR97!E870M<')I;G1E'0M9FXI#0H@(")56UB;VP at 87-S;V-I871E9"!W:71H('1H92!T862!O9B!T:&4@ M;&]O<"X at 3D585"U&3B!I2!T;R!C M6UB;VP at 87-S;V-I871E9"!W:71H('1H92!T862!O9B!T:&4@;&]O<"X at 3D585"U&3B!I'0M M9FX at 96YV:7)O;FUE;G0I*2D-"B @(" @(" @(" H= T*(" @(" @(" @(" H M;&%M8F1A("AE;G9I'!E8W0 at 8V5R=&%I;B!T86=S('1O#0H@(" @8VQO M'0@=7 @=&\@=&AE(&YE>'0@=&5M<&QA=&4@6YT87 at M97)R;W(-"B @(" @(" @(" @(" @(" @ M(" @(" @(" @(" @(" @(" @(" @(" B56YE>'!E8W1E9"!%3T8L('Y!('1A M9R!I6YT87 at M97)R;W(M;&]C871I;VX@*"D-"B @(" @(" @(" @ M(" @(" @("AS:6=N86PM=&5M<&QA=&4M6UB;VP-"B @(" @(" @(" @(" @(" @(" @ M(" @(" @(" @(" @(" @("!N97AT+69N*0T*(" @(" @(" @(" @(" @("!E M;'-E+69O;&QO=W,I*2DI#0H@(" @(" @(" @*"AO0T* M(" @(" @(" @(" @(" @(" @("AB;V1Y+69N("AW:71H+7-Y;G1A>"UE T*(" @(" @(" @(" @(" @ M(" @(" @(" @(" @(" @("AS:VEP+71R86EL:6YG+7=H:71E2!C2!P'0M9FX at 96QS92UF;VQL;W=S*0T*(" @(" @(" @(" @(" @(" @.SL@6UB;VP-"B @(" @(" @(" @(" @(" @(" @(" @(" @ M(" @(" @;F5X="UF;BD-"B @(" @(" @(" @(" @(" @(" @(" @96QS92UF M;VQL;W=S*2DI*0T*(" @(" @(" @("@H"UE0T*(" @(" @(" @(" @ M*&-R96%T92US:6UP;&4M<')I;G1E6UB M;VP@*&EF("IA='1R:6)U=&5S+6%R92UL:7-P+69O6YT M87 at M97)R;W(M;&]C871I;VX@*"D-"B @(" @(" @(" @(" @(" @(" @.SL@ M=&AE;B!R96%D('1H92!S=')E86T@=7 @=&\@=&AE(&-O T*(" @(" @(" @(" @(" @(" @(" @*'-K:7 M M=')A:6QI;F6YT87 at M M97)R;W(M;&]C871I;VX@*"D-"B @(" @(" @(" @(" @(" @(" @(" @(" @ M(" @(" @(" @*&-R96%T92UT96UP;&%T92UP T*(" @(" @ M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @*'-K:7 M=')A:6QI;F'!E8W0@=&\@" H6UB;VP-"B @(" @ M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @("!I9BUF;@T*(" @ M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(&5L"UE'!E8W1E9" O M5$U03%])1B!H97)E+"!I+F4N(&EF(&%N(&]P96X-"B @(" @(" @(" @(" @ M.SL at 5$U03%])1B!W87,@<&5N9&EN9PT*(" @(" @(" @(" @(" H=VET:"US M>6YT87 at M97)R;W(M;&]C871I;VX@*"D-"B @(" @(" @(" @(" @(" H"UE'!E8W1E9" O5$U03%]) M1B(I*2D-"B @(" @(" @(" @(#L[(')E860@=&AE(')E6YT87 at M M97)R;W(@(E5N97AP96-T960 at +U1-4$Q?54Y,15-3(BDI*0T*(" @(" @(" @ M(" @.SL@"UE"UE"UE'!E8W1E9"!^4R!B=70@6YT87 at M97)R;W(@(E5N97AP96-T960 at 14]&(BDI#0H@(" @(" @(" @(" @ M(" @*"AN=6QL(&5O9BUA8W1I;VXI#0H@(" @(" @(" @(" @(" @("!N:6PI M#0H@(" @(" @(" @(" @(" @*'0@*&9U;F-A;&P at 96]F+6%C=&EO;B!R97-T **2DI*2DI*2D-"@`` ` end