Re: Conditionally appending a period?

Subject: Re: Conditionally appending a period?
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: Wed, 14 Apr 1999 13:21:28 -0400
/ MARK.WROTH@xxxxxxxxxxx (Wroth, Mark) was heard to say:
| I need to conditionally append a period to an element's content if there is
| not already one there.  For example, if the element is 
[...]
| 	Can someone either give me a pointer to that solution, or suggest an
| approach?

The runinhead function in the DocBook stylesheets doesn't append
the separator character if the last character in the string is a
member of the relevant list of punctuation characters. It
doesn't handle the space case, though.

(define ($runinhead$)
  (let* ((title    (data (current-node)))
	 (titlelen (string-length title))
	 (lastchar (string-ref title (- titlelen 1)))
	 (punct    (if (member lastchar %content-title-end-punct%)
		       ""
		       %default-title-end-punct%)))
    (make sequence
      font-weight: 'bold
      (process-children)
      (literal punct " "))))

                                        Cheers,
                                          norm
-- 
Norman Walsh <ndw@xxxxxxxxxx>      | The fundamental delusion of
http://nwalsh.com/                 | humanity is to suppose that I am
                                   | here and you are out
                                   | there.--Yasutani Roshi


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


Current Thread