Skip to content

Commit cc17f6e

Browse files
Update to Pandoc 3.1.1 (#4745)
* initial work on pandoc 3.1.1 * Inject mathjax polyfill if needed jgm/pandoc#8625 * Set CJKfont for xelatex jgm/pandoc#8656 * Set date properly in asciidoc if no authors jgm/pandoc#8637 * Add citation css From pandoc notes Use styles.citations.html partial in styles.html. Fix class name hanging -> hanging-indent in styles.citations.html. --------- Co-authored-by: JJ Allaire <[email protected]>
1 parent 77232b2 commit cc17f6e

File tree

10 files changed

+270
-5
lines changed

10 files changed

+270
-5
lines changed

configuration

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Binary dependencies
1111
export DENO=v1.28.2
1212
export DENO_DOM=v0.1.35-alpha-artifacts
13-
export PANDOC=3.1
13+
export PANDOC=3.1.1
1414
export DARTSASS=1.55.0
1515
export ESBUILD=0.15.6
1616

src/resources/formats/asciidoc/pandoc/asciidoc.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ $if(titleblock)$
22
= $title$
33
$if(author)$
44
$for(author)$$author$$sep$; $endfor$
5-
$endif$
65
$if(date)$
76
$date$
87
$endif$
8+
$elseif(date)$
9+
:revdate: $date$
10+
$endif$
911
$if(keywords)$
1012
:keywords: $for(keywords)$$keywords$$sep$, $endfor$
1113
$endif$

src/resources/formats/asciidoc/pandoc/template.asciidoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ $endif$
55
= $title$
66
$if(by-author)$
77
$for(by-author)$$it.name.literal$$if(it.email)$ <$it.email$>$endif$$sep$; $endfor$
8+
$if(date)$
9+
$date$
10+
$endif$
11+
$elseif(date)$
12+
:revdate: $date$
813
$endif$
914
$if(description)$
1015
:description: $description$
1116
$endif$
12-
$if(date)$
13-
$date$
14-
$endif$
1517
$if(keywords)$
1618
:keywords: $for(keywords)$$keywords$$sep$, $endfor$
1719
$endif$
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* CSS for citations */
2+
div.csl-bib-body { }
3+
div.csl-entry {
4+
clear: both;
5+
$if(csl-entry-spacing)$
6+
margin-bottom: $csl-entry-spacing$;
7+
$endif$
8+
}
9+
.hanging-indent div.csl-entry {
10+
margin-left:2em;
11+
text-indent:-2em;
12+
}
13+
div.csl-left-margin {
14+
min-width:2em;
15+
float:left;
16+
}
17+
div.csl-right-inline {
18+
margin-left:2em;
19+
padding-left:1em;
20+
}
21+
div.csl-indent {
22+
margin-left: 2em;
23+
}
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
$if(document-css)$
2+
html {
3+
$if(mainfont)$
4+
font-family: $mainfont$;
5+
$endif$
6+
$if(fontsize)$
7+
font-size: $fontsize$;
8+
$endif$
9+
$if(linestretch)$
10+
line-height: $linestretch$;
11+
$endif$
12+
color: $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$;
13+
background-color: $if(backgroundcolor)$$backgroundcolor$$else$#fdfdfd$endif$;
14+
}
15+
body {
16+
margin: 0 auto;
17+
max-width: $if(maxwidth)$$maxwidth$$else$36em$endif$;
18+
padding-left: $if(margin-left)$$margin-left$$else$50px$endif$;
19+
padding-right: $if(margin-right)$$margin-right$$else$50px$endif$;
20+
padding-top: $if(margin-top)$$margin-top$$else$50px$endif$;
21+
padding-bottom: $if(margin-bottom)$$margin-bottom$$else$50px$endif$;
22+
hyphens: auto;
23+
overflow-wrap: break-word;
24+
text-rendering: optimizeLegibility;
25+
font-kerning: normal;
26+
}
27+
@media (max-width: 600px) {
28+
body {
29+
font-size: 0.9em;
30+
padding: 12px;
31+
}
32+
h1 {
33+
font-size: 1.8em;
34+
}
35+
}
36+
@media print {
37+
html {
38+
background-color: $if(backgroundcolor)$$backgroundcolor$$else$white$endif$;
39+
}
40+
body {
41+
background-color: transparent;
42+
color: black;
43+
font-size: 12pt;
44+
}
45+
p, h2, h3 {
46+
orphans: 3;
47+
widows: 3;
48+
}
49+
h2, h3, h4 {
50+
page-break-after: avoid;
51+
}
52+
}
53+
p {
54+
margin: 1em 0;
55+
}
56+
a {
57+
color: $if(linkcolor)$$linkcolor$$else$#1a1a1a$endif$;
58+
}
59+
a:visited {
60+
color: $if(linkcolor)$$linkcolor$$else$#1a1a1a$endif$;
61+
}
62+
img {
63+
max-width: 100%;
64+
}
65+
h1, h2, h3, h4, h5, h6 {
66+
margin-top: 1.4em;
67+
}
68+
h5, h6 {
69+
font-size: 1em;
70+
font-style: italic;
71+
}
72+
h6 {
73+
font-weight: normal;
74+
}
75+
ol, ul {
76+
padding-left: 1.7em;
77+
margin-top: 1em;
78+
}
79+
li > ol, li > ul {
80+
margin-top: 0;
81+
}
82+
blockquote {
83+
margin: 1em 0 1em 1.7em;
84+
padding-left: 1em;
85+
border-left: 2px solid #e6e6e6;
86+
color: #606060;
87+
}
88+
$if(abstract)$
89+
div.abstract {
90+
margin: 2em 2em 2em 2em;
91+
text-align: left;
92+
font-size: 85%;
93+
}
94+
div.abstract-title {
95+
font-weight: bold;
96+
text-align: center;
97+
padding: 0;
98+
margin-bottom: 0.5em;
99+
}
100+
$endif$
101+
code {
102+
font-family: $if(monofont)$$monofont$$else$Menlo, Monaco, Consolas, 'Lucida Console', monospace$endif$;
103+
$if(monobackgroundcolor)$
104+
background-color: $monobackgroundcolor$;
105+
padding: .2em .4em;
106+
$endif$
107+
font-size: 85%;
108+
margin: 0;
109+
hyphens: manual;
110+
}
111+
pre {
112+
margin: 1em 0;
113+
$if(monobackgroundcolor)$
114+
background-color: $monobackgroundcolor$;
115+
padding: 1em;
116+
$endif$
117+
overflow: auto;
118+
}
119+
pre code {
120+
padding: 0;
121+
overflow: visible;
122+
overflow-wrap: normal;
123+
}
124+
.sourceCode {
125+
background-color: transparent;
126+
overflow: visible;
127+
}
128+
hr {
129+
background-color: #1a1a1a;
130+
border: none;
131+
height: 1px;
132+
margin: 1em 0;
133+
}
134+
table {
135+
margin: 1em 0;
136+
border-collapse: collapse;
137+
width: 100%;
138+
overflow-x: auto;
139+
display: block;
140+
font-variant-numeric: lining-nums tabular-nums;
141+
}
142+
table caption {
143+
margin-bottom: 0.75em;
144+
}
145+
tbody {
146+
margin-top: 0.5em;
147+
border-top: 1px solid $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$;
148+
border-bottom: 1px solid $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$;
149+
}
150+
th {
151+
border-top: 1px solid $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$;
152+
padding: 0.25em 0.5em 0.25em 0.5em;
153+
}
154+
td {
155+
padding: 0.125em 0.5em 0.25em 0.5em;
156+
}
157+
header {
158+
margin-bottom: 4em;
159+
text-align: center;
160+
}
161+
#TOC li {
162+
list-style: none;
163+
}
164+
#TOC ul {
165+
padding-left: 1.3em;
166+
}
167+
#TOC > ul {
168+
padding-left: 0;
169+
}
170+
#TOC a:not(:hover) {
171+
text-decoration: none;
172+
}
173+
$endif$
174+
code{white-space: pre-wrap;}
175+
span.smallcaps{font-variant: small-caps;}
176+
div.columns{display: flex; gap: min(4vw, 1.5em);}
177+
div.column{flex: auto; overflow-x: auto;}
178+
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
179+
ul.task-list{list-style: none;}
180+
ul.task-list li input[type="checkbox"] {
181+
width: 0.8em;
182+
margin: 0 0.8em 0.2em -1.6em;
183+
vertical-align: middle;
184+
}
185+
$if(quotes)$
186+
q { quotes: "“" "”" "‘" "’"; }
187+
$endif$
188+
$if(displaymath-css)$
189+
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
190+
$endif$
191+
$if(highlighting-css)$
192+
/* CSS for syntax highlighting */
193+
$highlighting-css$
194+
$endif$
195+
$if(csl-css)$
196+
$styles.citations.html()$
197+
$endif$

src/resources/formats/html/pandoc/html.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ $for(header-includes)$
2727
$header-includes$
2828
$endfor$
2929
$if(math)$
30+
$if(mathjax)$
31+
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
32+
$endif$
3033
$math$
3134
$endif$
3235
<!--[if lt IE 9]>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* CSS for citations */
2+
div.csl-bib-body { }
3+
div.csl-entry {
4+
clear: both;
5+
$if(csl-entry-spacing)$
6+
margin-bottom: $csl-entry-spacing$;
7+
$endif$
8+
}
9+
.hanging-indent div.csl-entry {
10+
margin-left:2em;
11+
text-indent:-2em;
12+
}
13+
div.csl-left-margin {
14+
min-width:2em;
15+
float:left;
16+
}
17+
div.csl-right-inline {
18+
margin-left:2em;
19+
padding-left:1em;
20+
}
21+
div.csl-indent {
22+
margin-left: 2em;
23+
}

src/resources/formats/html/pandoc/template.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
$endfor$
1616

1717
$if(math)$
18+
$if(mathjax)$
19+
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
20+
$endif$
1821
$math$
1922
$endif$
2023

src/resources/formats/pdf/pandoc/latex.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ $if(CJKmainfont)$
162162
\ifXeTeX
163163
\usepackage{xeCJK}
164164
\setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
165+
$if(CJKsansfont)$
166+
\setCJKsansfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKsansfont$}
167+
$endif$
168+
$if(CJKmonofont)$
169+
\setCJKmonofont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmonofont$}
170+
$endif$
165171
\fi
166172
$endif$
167173
$if(luatexjapresetoptions)$

src/resources/formats/pdf/pandoc/template.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@
145145
\ifXeTeX
146146
\usepackage{xeCJK}
147147
\setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
148+
$if(CJKsansfont)$
149+
\setCJKsansfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKsansfont$}
150+
$endif$
151+
$if(CJKmonofont)$
152+
\setCJKmonofont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmonofont$}
153+
$endif$
148154
\fi
149155
$endif$
150156
$if(luatexjapresetoptions)$

0 commit comments

Comments
 (0)