summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-present-common.mkiv
blob: b4b422ca59f10bc3bd8d1bff0ca61e1a31ec876d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
%D \module
%D   [      file=s-present-common,
%D        version=2016.10.20,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Common Helpers,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\startmodule[present-common]

\startluacode

    -- sources               -> presentations
    -- tex/context/base/mkiv -> doc/context/presentations

    function commands.inputpresentationfile(name)
        local mkivpath = file.pathpart(resolvers.findfile("context.mkiv"))
        local filename = file.join(mkivpath,"../presentations",name)
        if lfs.isfile(filename) then
            context.input(filename)
            return
        end
        filename = file.join(mkivpath,"../../../../doc/context/presentations",name)
        if lfs.isfile(filename) then
            context.input(filename)
            return
        end
        context.starttext()
        context.formatted.type("missing file: %s",name)
        context.stoptext()
    end

\stopluacode

\unexpanded\def\inputpresentationfile#1%
  {\ctxcommand{inputpresentationfile("#1")}}

\stopmodule