![]() |
The tmdoc style and its packages | ![]() |
The use of the documentation markup is described for authors in the tmdoc style and automatic traversal of the documentation. This page describes how that markup is implemented and how it behaves in the three contexts in which documentation is shown: a single page in the editor, an expanded article or book, and a web page.
(
styles/documentation/texmacs/tmdoc.ts
) loads std, env, title-generic, header-article, section-article, doc and pagella-font. It sets the page layout and paragraph spacing, disables saving of auxiliary data (save-aux is false), sets the CSS and JavaScript used on export to HTML, redefines the sectional titles with the Fira font, and defines the inline and block code markup: verbatim, shell, scm, cpp, python, scilab, mmx and the session environments.
(
packages/documentation/doc.ts
) just loads tmdoc-markup, tmdoc-gui, tmdoc-traversal and tmdoc-framed. It is also used by tmmanual, the style of compiled books, together with tmbook.
The styles of the pages of the web site; they add tmdoc-web (respectively tmdoc-web2) to tmdoc.
tmdoc-title (
tmdoc-traversal.ts
) draws the logo and the title in the title font, with a rule below. tmdoc-title* adds a subtitle and tmdoc-title** a line above the title as well. tmdoc-copyright takes a period and any number of holders and prints them after a rule; tmdoc-license prints its body in a small grey font, always in English.
These tags are also the hooks of the expansion into articles and books (next page): tmdoc-title becomes a sectional heading, and the copyright and license blocks are removed.
In the editor, the traversal tags are plain markup:
An itemize environment.
An item with a hyperlink to the destination; the last three use different colors. The destination is resolved by tmdoc-file (see below).
Their real meaning appears only in the expansion, where branch inserts the target one sectional level deeper, continue inserts it at the same level and without its title, extra-branch inserts it as an appendix and optional-branch is dropped. Hyperlinks inside the page and tmdoc-include are handled by the expansion as well.
Links and branches give file names without language: name.en.tm is common, but name alone is also accepted. The macro tmdoc-file (
tmdoc-markup.ts
) tries, in this order,
the name itself (find-file);
name.xx.tm, where xx is the two letter code of the language of the user interface (language-suffix, which calls the Scheme function ext-language-suffix), searched in the directory of the document and upwards up to a directory named doc, web or texmacs (find-file-upwards);
name.en.tm in the same way;
the name unchanged.
The expansion code uses the same rules (tmdoc-relative in
progs/doc/tmdoc.scm
), so that a page written in one language can be read in a translation wherever one exists.
tmdoc-translations takes a file name without suffix and shows a row of flags, one for each of the languages de, en, es, fr, it, … for which name.xx.tm exists (tmdoc-translation). The flag images are fetched from https://www.texmacs.org/Images/, so they only appear when the machine is online.
The language of a page itself is not taken from its file name. Translated pages set it in their initial environment (<associate|language|french>), some in the style tuple (<style|<tuple|tmdoc|chinese>>); this matters for hyphenation, quotes and the language of the translated menu names shown by the menu tag.
An ordinary hyperlink with a relative file name, as used throughout the documentation. In expanded documents, links to pages which are part of the same expansion are turned into internal links (tmdoc-internalize).
(
tmdoc-markup.ts
) builds the URL tmfs://help/article/tm/doc/name.xx.tm from a path relative to
doc/
and opens it as an article. Unlike tmdoc-file, it does not fall back to English; see the pitfalls on the last page.
Inserts the expanded contents of another documentation file (computed by the Scheme function tmdoc-include, which expands the file at chapter level and removes chapter headings and hyperlinks).
When a document uses tmdoc and is edited directly, that is, not opened through a tmfs:// URL (the mode in-manual? of
kernel/texmacs/tm-modes.scm
), the files
tmdoc-edit.scm
,
tmdoc-menu.scm
,
tmdoc-kbd.scm
and
tmdoc-drd.scm
texmacs/menus/main-menu.scm
) and icons with entries to insert the title, copyright and license (tmdoc-insert-title, tmdoc-insert-copyright, tmdoc-insert-license, tmdoc-insert-gnu-fdl), traversal tags (tmdoc-make-branch inserts a new item after the current one), explain blocks and the markup for keys, menus and GUI elements.
tmdoc-drd.scm
declares tag groups such as tmdoc-traversal-tag and tmdoc-link-tag, which drive the variants and the focus toolbar (see the DRD from Scheme). The same files hold the corresponding tmweb entries for the pages of the web site (title, license and classification).