file-syn.mklx /size: 1707 b    last modification: 2023-12-21 09:44
1%D \module
2%D   [       file=file-syn, % was core-fil,
3%D        version=20110701, % 1997.11.15,
4%D          title=\CONTEXT\ File Macros,
5%D       subtitle=Module Support,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\writestatus{loading}{ConTeXt File Macros / Synonyms}
15
16\unprotect
17
18\registerctxluafile{file-syn}{autosuffix}
19
20%D \macros
21%D   {definefilesynonym,definefilefallback}
22%D
23%D One of the problems with loading files is that their names can depend on the
24%D interface language. We therefore need a method to define filesynonyms. The actual
25%D synonyms are defined elsewhere, but look like:
26%D
27%D \starttyping
28%D \definefilesynonym [chemic]  [chemie]
29%D \definefilesynonym [einheit] [unit]
30%D \definefilesynonym [unit]    [unit]
31%D \stoptyping
32%D
33%D So we can say in english:
34%D
35%D \starttyping
36%D \usemodules[pictex,chemic,unit]
37%D \stoptyping
38%D
39%D and in dutch:
40%D
41%D \starttyping
42%D \usemodules[pictex,chemie,unit]
43%D \stoptyping
44
45% \permanent\tolerant\def\definefilesynonym     [#name]#spacer[#realname]{\clf_definefilesynonym {#name}{#realname}}
46% \permanent\tolerant\def\definefilefallback[#name]#spacer[#alternatives]{\clf_definefilefallback{#name}{#alternatives}}
47
48%D \macros
49%D   {truefilename}
50%D
51%D At the system level such a filename can be called upon by saying:
52%D
53%D \starttyping
54%D \truefilename{filename/filesynonym}
55%D \stoptyping
56%D
57%D The implementation shows that nesting is supported.
58
59% \permanent\def\truefilename#1{\clf_truefilename{#1}}
60
61\protect \endinput
62