status = xmldoctotypst(source_dirs, destination_dir, main_title, overwrite)
[status, msg] = xmldoctotypst(source_dirs, destination_dir, main_title, overwrite)
[status, msg] = xmldoctotypst(source_dirs, destination_dir, main_title, overwrite, index_dirs)
| Parameter | Description |
|---|---|
| source_dirs | a cell of string: list of xml directories. |
| destination_dir | a string: directory destination. |
| main_title | a string: title of main document. |
| overwrite | a logical: force overwrite if file destination already exists |
| index_dirs | a cell of string: XML help roots of other modules, used to resolve cross-module links (optional). |
| Parameter | Description |
|---|---|
| status | a logical: files generated or not. |
| msg | a string: error message when generation fails. |
xmldoctotypst converts xml Nelson help files to Typst sources.
Each help page becomes a .typ file whose title carries the label <module:page>. The destination directory also receives main.typ (chapters, list of functions, and every page included one heading level below), toc.typ (table of contents) and nelson_help.typ (shared helpers imported by the pages).
Cross-references use the nlink helper: a reference becomes a link when the target page is part of the compiled document and plain text otherwise. LaTeX fragments are typeset with the mitex Typst package (latex helper). A source_code element with start and end bounds is printed as a code listing; without bounds, the whole file is only cited by its path (source-ref helper), which keeps the manual compact.
Compile the result with the typst compiler: typst compile main.typ.
source = [modulepath('help_tools'), '/help/en_US/xml'];
destination = [tempdir(), 'help_tools_typst'];
status = xmldoctotypst(source, destination, 'help_tools')
dir(destination)
| Version | Description |
|---|---|
| 2.0.0 | initial version |