Re: selectivity

Subject: Re: selectivity
From: "Henry S. Thompson" <ht@xxxxxxxxxxxxxxx>
Date: Thu, 24 Apr 97 16:28:06 BST
Geir Ove clarified his desires as follows:

>  I would like to simulate Viewport's VISIBLE property. What I hope I could
>  do is to put a label on all my element-rules that says 'hide', 'show' or
>  'inherit'.
>  
>  If an element has been flagged 'hide', all of its content should be
>  discarded, except any subelements that have been flagged as 'show'.
>  
>  I would like to do something like this:
>  
>  . . .

OK, that is indeed nice and simple, just like this (works in 0.5):
-------------------------------
(root (make simple-page-sequence
	    (make scroll
		  content-map: '((show #f))
		  (sosofo-discard-labeled (make sequence (relabel))
					  'hide))))

(element CHAPTER (hide))

(element (CHAPTER TITLE) (show))

(element SECTION (show))

(define (hide)
  (make sequence label: 'hide))

(define (show)
  (make paragraph label: 'show
	content-map: '((show #f))
	(relabel)))

(define (relabel)
  ;; note this only labels unlabeled members
  (sosofo-label
   (process-children)
   'show))
------------------------
Inheritance is the default, and we start out showing everything.  If
you only wanted (DOC TITLE) to show, but not other DOC daughters, you
would need:

(element DOC (hide))

and change (CHAPTER TITLE) to TITLE.

Note the only real complexity is to deal with a subtle potential bug --
the 'relabel' procedure is necessary, or with the revised style as
just described, (SECTION TITLE)'s would appear out of order.  The
reason for this is left as an exercise to the standard mavens :-).

ht


Current Thread
  • Re: selectivity
    • Henry S. Thompson - Thu, 24 Apr 1997 11:25:44 -0400 (EDT) <=