x-pandoc.mkiv /size: 3353 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=m-pandoc,
3%D        version=2019.05.30,
4%D          title=\CONTEXT\ Extra Modules,
5%D       subtitle=Pandoc Docbook Rendering,
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% just a test
15
16\startxmlsetups xml:docbook:article
17    \xmlflush{#1}
18\stopxmlsetups
19
20\startxmlsetups xml:docbook:section
21    \startsectionlevel[title={\xmltext{#1}{/title}},reference={\xmlatt{#1}{xml:id}}]
22        \xmlall{#1}{./!title}
23    \stopsectionlevel
24\stopxmlsetups
25
26\startxmlsetups xml:docbook:para
27    \dontleavehmode\ignorespaces
28        \xmlflush{#1}
29    \removeunwantedspaces\par
30\stopxmlsetups
31
32\startxmlsetups xml:docbook:emphasis
33    \dontleavehmode\begingroup
34        \em \xmlflush{#1}
35    \endgroup
36\stopxmlsetups
37
38\startxmlsetups xml:docbook:literal
39    \doifelse {\xmlatt{#1}{class}} {math} {
40        % what kind of math? inline or display?
41        \starttexcode
42            \startimath
43                \xmlflush{#1}
44            \stopimath
45        \stoptexcode
46    } {
47        \dontleavehmode\begingroup
48            \tttf \xmlflush{#1}
49           % \xmlinlineverbatim{#1}
50        \endgroup
51    }
52\stopxmlsetups
53
54\startxmlsetups xml:docbook:programlisting
55    \xmldisplayverbatim{#1}
56\stopxmlsetups
57
58\startxmlsetups xml:docbook:link
59    \doifsomethingelse {\xmlatt{#1}{xlink:href}} {
60        \goto{\xmlflush{#1}}[url(\xmllastatt)]
61    } {
62        \doifsomethingelse {\xmlatt{#1}{linkend}} {
63            \in{\xmlflush{#1}}[\xmllastatt]
64        } {
65            \xmlflush{#1}
66        }
67    }
68\stopxmlsetups
69
70\startxmlsetups xml:docbook:anchor
71    \pagereference[\xmlatt{id}]
72\stopxmlsetups
73
74\startxmlsetups xml:docbook:itemizedlist
75    \doifelse {\xmlatt{#1}{spacing}} {compact} {
76        \startitemize[packed]
77            \xmlflush{#1}
78        \stopitemize
79    } {
80        \startitemize
81            \xmlflush{#1}
82        \stopitemize
83    }
84\stopxmlsetups
85
86\startxmlsetups xml:docbook:orderedlist
87    \doifelse {\xmlatt{#1}{spacing}} {compact} {
88        \startitemize[n,packed]
89            \xmlflush{#1}
90        \stopitemize
91    } {
92        \startitemize[n]
93            \xmlflush{#1}
94        \stopitemize
95    }
96\stopxmlsetups
97
98\startxmlsetups xml:docbook:listitem
99    \startitem
100        \xmlflush{#1}
101    \stopitem
102\stopxmlsetups
103
104\startxmlsetups xml:docbook:variablelist
105    \startitemize
106        \xmlflush{#1}
107    \stopitemize
108\stopxmlsetups
109
110\startxmlsetups xml:docbook:varlistentry
111    \xmlflush{#1}
112\stopxmlsetups
113
114\startxmlsetups xml:docbook:term
115    \xmlflush{#1}
116\stopxmlsetups
117
118\usemodule[cals]
119
120\startxmlsetups cals:table:before
121    \startlinecorrection
122\stopxmlsetups
123
124\startxmlsetups cals:table:after
125    \stoplinecorrection
126\stopxmlsetups
127
128\startxmlsetups xml:docbook
129    \xmlsetsetup {#1} {*} {xml:docbook:*}
130    \xmlsetfunction {#1} {informaltable} {moduledata.cals.table}
131\stopxmlsetups
132
133\continueifinputfile{x-pandoc.mkiv}
134
135\usemodule[article-basic]
136
137\setupinteraction
138  [state=start]
139
140\setupalign
141  [flushleft,tolerant]
142
143\starttext
144
145    % running:
146    %
147    % pandoc -s -t docbook5  pandoc.txt
148
149    \xmlregisterdocumentsetup{main}{xml:docbook}
150    \xmlprocessfile{main}{d:/pandoc/pandoc.xml}{}
151
152\stoptext
153