|
Subject: Re: Changing the value of a variable From: Brandon Ibach <bibach@xxxxxxxxxxxxxx> Date: Thu, 29 Jul 1999 04:32:43 -0500 |
Quoting joseph, Gershon <Gershon_joseph@xxxxxxxxxxxxx>:
> I appear to have solved my problem regarding resetting the numbering when a
> specific element is encountered. For fellow newbies, the following is my
> code. Experts will undoubtedly suggest improvements ;-)
>
Yes, (element-number-list) is definitely the way to go. I was
actually playing with this a bit when your email arrived. :) I do
have a suggestion for one portion here:
> (literal ; Generated text on table title
> "Table "
> (format-number (ancestor-child-number "chap") "1")
> "-"
> (format-number (list-ref (element-number-list (list
> "chap" "table") (current-node)) 1) "1")
> ": "
> )
>
This could be done more simply with:
(literal
"Table "
(format-number-list (element-number-list
'("chap" "table") (current-node)) "1" "-")
": "
)
Basically, you're unnecessarily calculating the chapter number
with (ancestor-child-number), as this number is calculated for you by
(element-number-list). Just have (format-number-list) concatenate the
list returned by (element-number-list).
And, in the interest of reusable code, consider this variation:
(define (fmt-el-list elist #!key (fmt "1") (sep "-") (node (current-node)))
(format-number-list (element-number-list elist node) fmt sep))
... (literal "Table " (fmt-el-list '("chap" "table")) ": ")
-Brandon :)
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: Changing the value of a variabl, joseph, Gershon | Thread | RE: Changing the value of a variabl, Oisin McGuinness |
| RE: Changing the value of a variabl, joseph, Gershon | Date | Appending path to a filename resolv, joseph, Gershon |
| Month |