Handbook
Glossary
code>ncx ( dir name files -- xml )
Vocabulary
codebook
Inputs
dir
an
object
name
an
object
files
an
object
Outputs
xml
an
object
Definition
USING:
accessors
io
math
math.parser
sequences
xml.data
xml.syntax.private
;
IN:
codebook
::
code>ncx
( dir name files -- xml )
"Generating NCX table of contents"
print
flush
files
[|
file
i |
file
name>>
:>
name name
file-html-name
:>
filename i 2
+
number>string
:>
istr
H{
{
"name"
name
}
{
"istr"
istr
}
{
"filename"
filename
}
}
T{
xml-chunk
{
seq
V{
""
T{
tag
{
name ~name~
}
{
attrs ~attrs~
}
{
children ~vector~
}
}
""
}
}
}
interpolate-xml
]
map-index
:>
file-nav-points
H{
{
"file-nav-points"
file-nav-points
}
}
T{
xml
{
prolog
T{
prolog
{
version
"1.0"
}
{
encoding
"UTF-8"
}
}
}
{
before
V{
"\n "
}
}
{
body
T{
tag
{
name
T{
name
{
space
""
}
{
main
"ncx"
}
{
url
"http://www.daisy.org/z3986/2005/ncx/"
}
}
}
{
attrs
T{
attrs
{
alist ~vector~
}
}
}
{
children
V{
"\n "
~tag~
"\n "
}
}
}
}
{
after
V{
""
}
}
}
interpolate-xml
;