From mail at chaitanyagupta.com Wed Nov 14 19:01:10 2007 From: mail at chaitanyagupta.com (Chaitanya Gupta) Date: Thu, 15 Nov 2007 00:31:10 +0530 Subject: [html-template-devel] Is this behaviour for SKIP-LEADING-WHITESPACE correct? Message-ID: Hello, I have come across a situation where SKIP-LEADING-WHITESPACE (HTML-TEMPLATE's internal function) throws an error while trying to create a template printer. I have narrowed it down to the following - CL-USER> (let ((html-template:*ignore-empty-lines* t)) (html-template::skip-leading-whitespace (make-array 4 :element-type 'character :fill-pointer 0))) This throws an error. Here's the debugger output - Index(s) to array function is/are out of the range of the array. [Condition of type TYPE-ERROR] Restarts: 0: [ABORT-REQUEST] Abort handling SLIME request. 1: [ABORT] Abort entirely from this (lisp) process. Backtrace: 0: (SWANK::DEBUG-IN-EMACS #) 1: (SWANK:SWANK-DEBUGGER-HOOK # #) 2: (ERROR TYPE-ERROR :DATUM NIL :EXPECTED-TYPE FIXNUM :FORMAT-CONTROL "Index(s) to array function is/are out of the range of the array." :FORMAT-ARGUMENTS (NIL)) 3: (HTML-TEMPLATE::SKIP-LEADING-WHITESPACE "") 4: (LET ((HTML-TEMPLATE:*IGNORE-EMPTY-LINES* T)) (HTML-TEMPLATE::SKIP-LEADING-WHITESPACE (MAKE-ARRAY 4 :ELEMENT-TYPE (QUOTE CHARACTER) :FILL-POINTER 0))) 5: (EVAL (LET ((HTML-TEMPLATE:*IGNORE-EMPTY-LINES* T)) (HTML-TEMPLATE::SKIP-LEADING-WHITESPACE (MAKE-ARRAY 4 :ELEMENT-TYPE # :FILL-POINTER 0)))) 6: (SWANK::EVAL-REGION "(let ((html-template:*ignore-empty-lines* t)) (html-template::skip-leading-whitespace (make-array 4 :element-type 'character :fill-pointer 0))) " T) ... [snipped remaining frames] Is the above behaviour for SKIP-LEADING-WHITESPACE correct? Thanks, Chaitanya From edi at agharta.de Fri Nov 16 21:12:18 2007 From: edi at agharta.de (Edi Weitz) Date: Fri, 16 Nov 2007 22:12:18 +0100 Subject: [html-template-devel] New release 0.9.1 (Re: Is this behaviour for SKIP-LEADING-WHITESPACE correct?) In-Reply-To: (Chaitanya Gupta's message of "Thu, 15 Nov 2007 00:31:10 +0530") References: Message-ID: On Thu, 15 Nov 2007 00:31:10 +0530, Chaitanya Gupta wrote: > I have come across a situation where SKIP-LEADING-WHITESPACE > (HTML-TEMPLATE's internal function) throws an error while trying to > create a template printer. I have narrowed it down to the following > [...] Yes, that looks like a bug. Should be fixed in the new release. Thanks for the report, Edi. From sohail at taggedtype.net Wed Nov 21 06:43:24 2007 From: sohail at taggedtype.net (Sohail Somani) Date: Wed, 21 Nov 2007 06:43:24 +0000 (UTC) Subject: [html-template-devel] Easier way to fill tmpl_var environment? Message-ID: Hi, First of all, thank you for a nice library. Now, I have a question. Is there a way to have html-template call back into the calling environment so I don't have to pass all slot values of a list of objects in as a list? So instead of: ;;; prints "b c" (fill-and-print-template "" (list :a (list :b "b" :c "c"))) I can do something like: ;;; prints "b c" (fill-and-print-template " " (list :a a)) Where b-of and c-of are readers. It is just very very tedious to make lists of all the values. Does that make any sense? Thanks for your time. -- Sohail Somani http://uint32t.blogspot.com From edi at agharta.de Thu Nov 22 17:30:44 2007 From: edi at agharta.de (Edi Weitz) Date: Thu, 22 Nov 2007 18:30:44 +0100 Subject: [html-template-devel] Easier way to fill tmpl_var environment? In-Reply-To: (Sohail Somani's message of "Wed, 21 Nov 2007 06:43:24 +0000 (UTC)") References: Message-ID: On Wed, 21 Nov 2007 06:43:24 +0000 (UTC), Sohail Somani wrote: > First of all, thank you for a nice library. You're welcome... :) > Now, I have a question. Is there a way to have html-template call > back into the calling environment so I don't have to pass all slot > values of a list of objects in as a list? > > So instead of: > > ;;; prints "b c" > (fill-and-print-template "" > (list :a (list :b "b" :c "c"))) > > I can do something like: > > ;;; prints "b c" > (fill-and-print-template > " " > (list :a a)) > > Where b-of and c-of are readers. It is just very very tedious to make > lists of all the values. > > Does that make any sense? Not for me. The design goal of HTML-TEMPLATE is to be as simple as possible - the idea is that the people working on the HTML don't have to learn yet another programming language. I don't understand why you can't achieve what you want within Lisp, something like (fill-and-print-template "" (my-function a)) where MY-FUNCTION builds and returns the structure you need. Edi. From sohail at taggedtype.net Thu Nov 22 17:44:43 2007 From: sohail at taggedtype.net (Sohail Somani) Date: Thu, 22 Nov 2007 17:44:43 +0000 (UTC) Subject: [html-template-devel] Re: Easier way to fill tmpl_var environment? References: Message-ID: On Thu, 22 Nov 2007 18:30:44 +0100, Edi Weitz wrote: > Not for me. The design goal of HTML-TEMPLATE is to be as simple as > possible - the idea is that the people working on the HTML don't have to > learn yet another programming language. > > I don't understand why you can't achieve what you want within Lisp, > something like > > (fill-and-print-template "" > (my-function a)) > > where MY-FUNCTION builds and returns the structure you need. Yes, you are right. That is what I ended up doing anyway. I have this nagging feeling that my-function should be generated somehow. -- Sohail Somani http://uint32t.blogspot.com