Re: Line spacing in Jade

Subject: Re: Line spacing in Jade
From: christo@xxxxxxxxxxxxxxxxxx (Frank Christoph)
Date: Wed, 3 Sep 1997 10:18:41 +0900
A quasiquoted list `(...) evaluates to a list (if it terminates),
but in your example, `(make paragraph ....) is intended to be a procedure
call.  To do it that way, you would need macros to reify the expression at
run-time.

Here's an alternative:

(define (scale-lines scale-factor)
  `(font-size: (* (inherited-font-size) ,scale-factor)
    line-spacing: (* (inherited-line-spacing) ,scale-factor)))

(element title
   (apply make `(paragraph ,@(scale-lines 2) (process-children))))

> Chris Maden wrote:
> > (Really, what I should do
> > is write a function that always correlates font-size and
> > line-spacing...
> > 
> > (define (scale-lines scale-factor)
> >         font-size: (* (inherited-font-size) scale-factor)
> >         line-spacing: (* (inherited-line-spacing) scale-factor))
> > 
> > (element title (make paragraph
> >                      font-weight: 'bold
> >                      (scale-lines 2)))
> > 
> > Hmm... except that doesn't work.  Can a procedure give multiple
> > characteristic names and values?)
> >
> 
> I think you need to use the quasi-quotation mechanism described in
> section
> 8.3.2.7 of the standard. I have tried to do this but without success:
> 
> (element title
> 	`(make paragraph
> 		,@(scale-lines)
> 		(process-children)))
> 
> where (scale-lines) is defined as:
> 
> (define (scale-lines)
> 	`(font-size: ,(* (inherited-font-size) 2)
>           line-spacing: ,(* (inherited-line-spacing) 2))
> 
> So, does anyone else have an idea of how to go about specifying
> characteristics in a (make ...) expression using a list instead of
> specifying each characteristic explicitly in the (make ...)?

 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread