git.iko.soy/typeable/pandoc
on master help sign in
Merge branch 'master' of github.com:jgm/pandoc
commit32f9dbbae5e3e1cce43d372db5564da378947388 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 21 Dec 2017, 21:45 (9 years ago) parent239cfb7a5d7be0
2 files changed+100−278
src/Text/Pandoc/Writers/JATS.hs+8−2 test/tables.jats+92−276
src/Text/Pandoc/Writers/JATS.hs+8−2
@@ -316,6 +316,9 @@ tableItemToJATS :: PandocMonad m
316316 -> Bool
317317 -> [Block]
318318 -> JATS m Doc
319+tableItemToJATS opts isHeader [Plain item] =
320+ inTags True (if isHeader then "th" else "td") [] <$>
321+ inlinesToJATS opts item
319322tableItemToJATS opts isHeader item =
320323 (inTags True (if isHeader then "th" else "td") [] . vcat) <$>
321324 mapM (blockToJATS opts) item
@@ -405,8 +408,11 @@ inlineToJATS opts (Link (ident,_,kvs) txt ('#':src, _)) = do
405408 [("alt", stringify txt) | not (null txt)] ++
406409 [("rid", src)] ++
407410 [(k,v) | (k,v) <- kvs, k `elem` ["ref-type", "specific-use"]]
408− contents <- inlinesToJATS opts txt
409− return $ inTags False "xref" attr contents
411+ if null txt
412+ then return $ selfClosingTag "xref" attr
413+ else do
414+ contents <- inlinesToJATS opts txt
415+ return $ inTags False "xref" attr contents
410416inlineToJATS opts (Link (ident,_,kvs) txt (src, tit)) = do
411417 let attr = [("id", ident) | not (null ident)] ++
412418 [("ext-link-type", "uri"),
test/tables.jats+92−276
@@ -15,92 +15,60 @@
1515 <thead>
1616 <tr>
1717 <th>
18− <p>
19− Right
20− </p>
18+ Right
2119 </th>
2220 <th>
23− <p>
24− Left
25− </p>
21+ Left
2622 </th>
2723 <th>
28− <p>
29− Center
30− </p>
24+ Center
3125 </th>
3226 <th>
33− <p>
34− Default
35− </p>
27+ Default
3628 </th>
3729 </tr>
3830 </thead>
3931 <tbody>
4032 <tr>
4133 <td>
42− <p>
43− 12
44− </p>
34+ 12
4535 </td>
4636 <td>
47− <p>
48− 12
49− </p>
37+ 12
5038 </td>
5139 <td>
52− <p>
53− 12
54− </p>
40+ 12
5541 </td>
5642 <td>
57− <p>
58− 12
59− </p>
43+ 12
6044 </td>
6145 </tr>
6246 <tr>
6347 <td>
64− <p>
65− 123
66− </p>
48+ 123
6749 </td>
6850 <td>
69− <p>
70− 123
71− </p>
51+ 123
7252 </td>
7353 <td>
74− <p>
75− 123
76− </p>
54+ 123
7755 </td>
7856 <td>
79− <p>
80− 123
81− </p>
57+ 123
8258 </td>
8359 </tr>
8460 <tr>
8561 <td>
86− <p>
87− 1
88− </p>
62+ 1
8963 </td>
9064 <td>
91− <p>
92− 1
93− </p>
65+ 1
9466 </td>
9567 <td>
96− <p>
97− 1
98− </p>
68+ 1
9969 </td>
10070 <td>
101− <p>
102− 1
103− </p>
71+ 1
10472 </td>
10573 </tr>
10674 </tbody>
@@ -117,92 +85,60 @@
11785 <thead>
11886 <tr>
11987 <th>
120− <p>
121− Right
122− </p>
88+ Right
12389 </th>
12490 <th>
125− <p>
126− Left
127− </p>
91+ Left
12892 </th>
12993 <th>
130− <p>
131− Center
132− </p>
94+ Center
13395 </th>
13496 <th>
135− <p>
136− Default
137− </p>
97+ Default
13898 </th>
13999 </tr>
140100 </thead>
141101 <tbody>
142102 <tr>
143103 <td>
144− <p>
145− 12
146− </p>
104+ 12
147105 </td>
148106 <td>
149− <p>
150− 12
151− </p>
107+ 12
152108 </td>
153109 <td>
154− <p>
155− 12
156− </p>
110+ 12
157111 </td>
158112 <td>
159− <p>
160− 12
161− </p>
113+ 12
162114 </td>
163115 </tr>
164116 <tr>
165117 <td>
166− <p>
167− 123
168− </p>
118+ 123
169119 </td>
170120 <td>
171− <p>
172− 123
173− </p>
121+ 123
174122 </td>
175123 <td>
176− <p>
177− 123
178− </p>
124+ 123
179125 </td>
180126 <td>
181− <p>
182− 123
183− </p>
127+ 123
184128 </td>
185129 </tr>
186130 <tr>
187131 <td>
188− <p>
189− 1
190− </p>
132+ 1
191133 </td>
192134 <td>
193− <p>
194− 1
195− </p>
135+ 1
196136 </td>
197137 <td>
198− <p>
199− 1
200− </p>
138+ 1
201139 </td>
202140 <td>
203− <p>
204− 1
205− </p>
141+ 1
206142 </td>
207143 </tr>
208144 </tbody>
@@ -224,92 +160,60 @@
224160 <thead>
225161 <tr>
226162 <th>
227− <p>
228− Right
229− </p>
163+ Right
230164 </th>
231165 <th>
232− <p>
233− Left
234− </p>
166+ Left
235167 </th>
236168 <th>
237− <p>
238− Center
239− </p>
169+ Center
240170 </th>
241171 <th>
242− <p>
243− Default
244− </p>
172+ Default
245173 </th>
246174 </tr>
247175 </thead>
248176 <tbody>
249177 <tr>
250178 <td>
251− <p>
252− 12
253− </p>
179+ 12
254180 </td>
255181 <td>
256− <p>
257− 12
258− </p>
182+ 12
259183 </td>
260184 <td>
261− <p>
262− 12
263− </p>
185+ 12
264186 </td>
265187 <td>
266− <p>
267− 12
268− </p>
188+ 12
269189 </td>
270190 </tr>
271191 <tr>
272192 <td>
273− <p>
274− 123
275− </p>
193+ 123
276194 </td>
277195 <td>
278− <p>
279− 123
280− </p>
196+ 123
281197 </td>
282198 <td>
283− <p>
284− 123
285− </p>
199+ 123
286200 </td>
287201 <td>
288− <p>
289− 123
290− </p>
202+ 123
291203 </td>
292204 </tr>
293205 <tr>
294206 <td>
295− <p>
296− 1
297− </p>
207+ 1
298208 </td>
299209 <td>
300− <p>
301− 1
302− </p>
210+ 1
303211 </td>
304212 <td>
305− <p>
306− 1
307− </p>
213+ 1
308214 </td>
309215 <td>
310− <p>
311− 1
312− </p>
216+ 1
313217 </td>
314218 </tr>
315219 </tbody>
@@ -332,70 +236,46 @@
332236 <thead>
333237 <tr>
334238 <th>
335− <p>
336− Centered Header
337− </p>
239+ Centered Header
338240 </th>
339241 <th>
340− <p>
341− Left Aligned
342− </p>
242+ Left Aligned
343243 </th>
344244 <th>
345− <p>
346− Right Aligned
347− </p>
245+ Right Aligned
348246 </th>
349247 <th>
350− <p>
351− Default aligned
352− </p>
248+ Default aligned
353249 </th>
354250 </tr>
355251 </thead>
356252 <tbody>
357253 <tr>
358254 <td>
359− <p>
360− First
361− </p>
255+ First
362256 </td>
363257 <td>
364− <p>
365− row
366− </p>
258+ row
367259 </td>
368260 <td>
369− <p>
370− 12.0
371− </p>
261+ 12.0
372262 </td>
373263 <td>
374− <p>
375− Example of a row that spans multiple lines.
376− </p>
264+ Example of a row that spans multiple lines.
377265 </td>
378266 </tr>
379267 <tr>
380268 <td>
381− <p>
382− Second
383− </p>
269+ Second
384270 </td>
385271 <td>
386− <p>
387− row
388− </p>
272+ row
389273 </td>
390274 <td>
391− <p>
392− 5.0
393− </p>
275+ 5.0
394276 </td>
395277 <td>
396− <p>
397− Here’s another one. Note the blank line between rows.
398− </p>
278+ Here’s another one. Note the blank line between rows.
399279 </td>
400280 </tr>
401281 </tbody>
@@ -412,70 +292,46 @@
412292 <thead>
413293 <tr>
414294 <th>
415− <p>
416− Centered Header
417− </p>
295+ Centered Header
418296 </th>
419297 <th>
420− <p>
421− Left Aligned
422− </p>
298+ Left Aligned
423299 </th>
424300 <th>
425− <p>
426− Right Aligned
427− </p>
301+ Right Aligned
428302 </th>
429303 <th>
430− <p>
431− Default aligned
432− </p>
304+ Default aligned
433305 </th>
434306 </tr>
435307 </thead>
436308 <tbody>
437309 <tr>
438310 <td>
439− <p>
440− First
441− </p>
311+ First
442312 </td>
443313 <td>
444− <p>
445− row
446− </p>
314+ row
447315 </td>
448316 <td>
449− <p>
450− 12.0
451− </p>
317+ 12.0
452318 </td>
453319 <td>
454− <p>
455− Example of a row that spans multiple lines.
456− </p>
320+ Example of a row that spans multiple lines.
457321 </td>
458322 </tr>
459323 <tr>
460324 <td>
461− <p>
462− Second
463− </p>
325+ Second
464326 </td>
465327 <td>
466− <p>
467− row
468− </p>
328+ row
469329 </td>
470330 <td>
471− <p>
472− 5.0
473− </p>
331+ 5.0
474332 </td>
475333 <td>
476− <p>
477− Here’s another one. Note the blank line between rows.
478− </p>
334+ Here’s another one. Note the blank line between rows.
479335 </td>
480336 </tr>
481337 </tbody>
@@ -491,68 +347,44 @@
491347 <tbody>
492348 <tr>
493349 <td>
494− <p>
495− 12
496− </p>
350+ 12
497351 </td>
498352 <td>
499− <p>
500− 12
501− </p>
353+ 12
502354 </td>
503355 <td>
504− <p>
505− 12
506− </p>
356+ 12
507357 </td>
508358 <td>
509− <p>
510− 12
511− </p>
359+ 12
512360 </td>
513361 </tr>
514362 <tr>
515363 <td>
516− <p>
517− 123
518− </p>
364+ 123
519365 </td>
520366 <td>
521− <p>
522− 123
523− </p>
367+ 123
524368 </td>
525369 <td>
526− <p>
527− 123
528− </p>
370+ 123
529371 </td>
530372 <td>
531− <p>
532− 123
533− </p>
373+ 123
534374 </td>
535375 </tr>
536376 <tr>
537377 <td>
538− <p>
539− 1
540− </p>
378+ 1
541379 </td>
542380 <td>
543− <p>
544− 1
545− </p>
381+ 1
546382 </td>
547383 <td>
548− <p>
549− 1
550− </p>
384+ 1
551385 </td>
552386 <td>
553− <p>
554− 1
555− </p>
387+ 1
556388 </td>
557389 </tr>
558390 </tbody>
@@ -568,46 +400,30 @@
568400 <tbody>
569401 <tr>
570402 <td>
571− <p>
572− First
573− </p>
403+ First
574404 </td>
575405 <td>
576− <p>
577− row
578− </p>
406+ row
579407 </td>
580408 <td>
581− <p>
582− 12.0
583− </p>
409+ 12.0
584410 </td>
585411 <td>
586− <p>
587− Example of a row that spans multiple lines.
588− </p>
412+ Example of a row that spans multiple lines.
589413 </td>
590414 </tr>
591415 <tr>
592416 <td>
593− <p>
594− Second
595− </p>
417+ Second
596418 </td>
597419 <td>
598− <p>
599− row
600− </p>
420+ row
601421 </td>
602422 <td>
603− <p>
604− 5.0
605− </p>
423+ 5.0
606424 </td>
607425 <td>
608− <p>
609− Here’s another one. Note the blank line between rows.
610− </p>
426+ Here’s another one. Note the blank line between rows.
611427 </td>
612428 </tr>
613429 </tbody>