File: node-2-string.sgm

package info (click to toggle)
docbook-dsssl-doc 1.75-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,672 kB
  • ctags: 8
  • sloc: makefile: 37
file content (64 lines) | stat: -rw-r--r-- 1,467 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<RefEntry id="node-list-X3Estring">
<!-- This file is generated automatically from the DSSSL source. -->
<!-- Do not edit this file! -->
<?html-filename node-2-string.html>

<RefMeta>
  <RefEntryTitle>node-list->string</RefEntryTitle>
  <RefMiscInfo Role="file">dblib.dsl</RefMiscInfo>
</RefMeta>

<RefNameDiv>
  <RefName>node-list->string</RefName>
  <RefPurpose>Return a string representation of the node list</RefPurpose>
</RefNameDiv>

<RefSynopsisDiv><Title>Synopsis</Title>
<Synopsis>
(node-list->string nodelist)
</Synopsis>
</RefSynopsisDiv>

<RefSect1><Title>Description</Title>

<para>
Builds a string representation of the node list and returns it.
The representation is 
</para>
<para>
"gi(firstchildgi()secondchildgi(firstgrandchildgi())) secondgi()..."
</para>
<para>
This is a debugging function, in case that wasn't obvious...</para>


</RefSect1>

<RefSect1><Title>Author</Title>

<para>
Norman Walsh, &lt;ndw@nwalsh.com&gt;
</para>
</RefSect1>
<RefSect1><Title>Source Code</Title>

<ProgramListing>
(define (node-list->string nodelist)
  ;; Return a string representation of the node list
  (let loop ((nl nodelist) (res ""))
    (if (node-list-empty? nl)
	res
	(loop (node-list-rest nl)
	      (string-append res 
			     (if (gi (node-list-first nl))
				 (string-append
				  (gi (node-list-first nl))
				  "("
				  (node-list->string 
				   (children (node-list-first nl)))
				  ")")
				 ""))))))
</ProgramListing>
</RefSect1>

</RefEntry>