![]() |
Web site, search and API documentation | ![]() |
The TeXmacs web site is built from a directory tree of TeXmacs documents by
progs/doc/tmweb.scm
. The entry points are
Convert, or update, the tree tm-dir into html-dir. They are called by the command line options -W in out and -U in out (see command line options).
The same, but the .tm files are copied as well.
Interactive variants which ask for the two directories; the last one opens a dialog and remembers the directories in the preferences website:src-dir and website:dest-dir. They are declared lazily in
init-texmacs.scm
but no menu calls them.
tmweb-convert-directory enumerates all files below the source directory. Every .tm file is exported to HTML (or XHTML, if the preference texmacs->html:mathml is on) with export-buffer-main, at the same relative place in the destination; the auxiliary data are generated first (with-aux). All other files (images, style sheets, …) are copied, except backup files, files below hidden directories and version control directories. Missing destination directories are created. In update mode a file is only converted or copied if the destination is missing or older than the source (url-newer?); a known problem of url-newer? with the file attribute cache can make updates skip changed files (see the system layer).
The HTML conversion itself is described in the HTML export; the web pages use the tmweb styles, whose packages add the navigation bars and the classification of pages (tmweb-insert-classifiers).
Help\(\rightarrow\)Search\(\rightarrow\)Documentation and the neighbouring entries call docgrep-in-doc, docgrep-in-src and docgrep-in-recent (
progs/doc/docgrep.scm
). They open tmfs://grep/type=type&what=words, whose handler collects the candidate files and ranks them:
All files *.xx.tm and *.xx.tmml of $TEXMACS_DOC_PATH for the current output language xx.
The Scheme files, style files and C++ sources (the latter under $TEXMACS_SOURCE_PATH/src).
The 50 most recent files, or the documents in $TEXMACS_FILE_PATH.
Each file is scored by the C++ routine search_score (
src/src/System/Files/file.cpp
, glue system-search-score): the scores of the individual words are multiplied, a word counts ten times more when it is a whole word, and in .tm files occurrences inside tag names do not count while occurrences in name, tmstyle, explain-macro and a few other tags count more. Words are lower cased and, for .tm files, converted to the escaped Cork form used in the files. The result page lists the matching files with their titles (help-file-title), sorted by score in percent of the best one. The lists of files are cached per path and pattern for the whole session.
progs/doc/tmdoc-search.scm
finds the explain block which documents a given item, that is, whose header contains the item in the corresponding markup: tmdoc-search-tag for a tag (explain-macro or markup), tmdoc-search-style for a style or package (tmstyle or tmpackage), tmdoc-search-parameter for an environment variable (var-val or src-var) and tmdoc-search-scheme for a Scheme function (scm with the function name at the start). It first selects the files of the help path which contain the corresponding markup as a string (url-grep) and then searches their trees; if nothing is found for the output language, English files are searched. These routines are used by the contextual help of the focus toolbar (
generic/generic-doc.scm
) and by the macro editor (
source/macro-widgets.scm
).
The tmfs://apidoc/ pages (Help\(\rightarrow\)Scheme extensions\(\rightarrow\)Browse modules documentation, Browse symbols documentation, and the module and symbol browsers of the developer menu) show, for Scheme functions and macros, their documentation together with their source code and module. The documentation comes from a cache of explain blocks (
progs/doc/apidoc-collect.scm
):
The cache is built the first time documentation is requested in a language for which it has not been built yet (doc-check-cache, which consults the preferences doc:collect-timestamp and doc:collect-languages).
doc-collect-all starts from a fixed list of root pages (devel/scheme/scheme, devel/plugin/plugin, devel/plugin/plugins, devel/source/source, devel/style/style and main/man-reference), follows their branch links recursively, and stores every explain block whose header contains scm or explain-macro under each documented name.
The entries are kept in two persistent tables in $TEXMACS_HOME_PATH/system/cache/ whose names are stored in the preferences doc:doc-scm-cache and doc:doc-macro-cache. Each entry records the name, the language, the source file and the tree; doc-retrieve returns the entries for the output language, or the English ones.
The C++ routines exported to Scheme are documented separately in the glue auto-documentation. That file and
progs/prog/glue-symbols.scm
are generated from the glue declarations by
src/src/Scheme/Glue/build-auto-doc
(with
make-apidoc-doc.scm
and
make-apidoc-module.scm
); see the glue generator.