code>opf ( dir name files -- xml )


Vocabulary
codebook

Inputs
diran object
namean object
filesan object


Outputs
xmlan object


Definition


:: code>opf ( dir name files -- xml )
"Generating OPF manifest" print flush name ".ncx" append
:> ncx-name files [
name>> file-html-name dup 2 nenum T{ xml-chunk
{ seq
V{
""
T{ tag { name ~name~ } { attrs ~attrs~ } }
""
}
}
} interpolate-xml
] map :> html-manifest files [
name>> file-html-name 1 nenum T{ xml-chunk
{ seq
V{
""
T{ tag { name ~name~ } { attrs ~attrs~ } }
""
}
}
} interpolate-xml
] map :> html-spine H{
{ "html-manifest" html-manifest }
{ "name" name }
{ "ncx-name" ncx-name }
{ "html-spine" html-spine }
} T{ xml
{ prolog
T{ prolog { version "1.0" } { encoding "UTF-8" } }
}
{ before V{ "\n " } }
{ body
T{ tag
{ name
T{ name
{ space "" }
{ main "package" }
{ url "http://www.idpf.org/2007/opf" }
}
}
{ attrs T{ attrs { alist ~vector~ } } }
{ children
V{
"\n "
~tag~
"\n "
~tag~
"\n "
~tag~
"\n "
~tag~
"\n "
}
}
}
}
{ after V{ "" } }
} interpolate-xml ;