Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Biblio tests with Pandoc 3.1.8 #1003

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions hakyll.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ Data-files:
Extra-source-files:
CHANGELOG.md
tests/data/biblio/chicago.csl
tests/data/biblio/cites-meijer-pandoc2.golden
tests/data/biblio/cites-meijer-pandoc3.golden
tests/data/biblio/cites-multiple-pandoc2.golden
tests/data/biblio/cites-multiple-pandoc3.golden
tests/data/biblio/cites-meijer-pandoc-2.0.0plus.golden
tests/data/biblio/cites-meijer-pandoc-3.0.0plus.golden
tests/data/biblio/cites-meijer-pandoc-3.1.8plus.golden
tests/data/biblio/cites-multiple-pandoc-2.0.0plus.golden
tests/data/biblio/cites-multiple-pandoc-3.0.0plus.golden
tests/data/biblio/cites-multiple-pandoc-3.1.8plus.golden
tests/data/biblio/cites-multiple.markdown
tests/data/biblio/default.html
tests/data/biblio/page.markdown
Expand Down
43 changes: 23 additions & 20 deletions tests/Hakyll/Web/Pandoc/Biblio/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ goldenTest01 =
cleanTestEnv

return output)

where
goldenTest =
if pandocMajorVersion == 2
then "cites-meijer-pandoc2.golden"
else "cites-meijer-pandoc3.golden"

where
goldenTest =
#if MIN_VERSION_pandoc(3,1,8)
"cites-meijer-pandoc-3.1.8plus.golden"
#elif MIN_VERSION_pandoc(3,0,0)
"cites-meijer-pandoc-3.0.0plus.golden"
#else
"cites-meijer-pandoc-2.0.0plus.golden"
#endif

goldenTest02 :: TestTree
goldenTest02 =
Expand Down Expand Up @@ -107,10 +110,14 @@ goldenTest02 =

return output)
where
goldenTest =
if pandocMajorVersion == 2
then "cites-meijer-pandoc2.golden"
else "cites-meijer-pandoc3.golden"
goldenTest =
#if MIN_VERSION_pandoc(3,1,8)
"cites-meijer-pandoc-3.1.8plus.golden"
#elif MIN_VERSION_pandoc(3,0,0)
"cites-meijer-pandoc-3.0.0plus.golden"
#else
"cites-meijer-pandoc-2.0.0plus.golden"
#endif

goldenTest03 :: TestTree
goldenTest03 =
Expand Down Expand Up @@ -147,15 +154,11 @@ goldenTest03 =

return output)
where
goldenTest =
if pandocMajorVersion == 2
then "cites-multiple-pandoc2.golden"
else "cites-multiple-pandoc3.golden"

--------------------------------------------------------------------------------
pandocMajorVersion :: Int
#if MIN_VERSION_pandoc(3,0,0)
pandocMajorVersion = 3
goldenTest =
#if MIN_VERSION_pandoc(3,1,8)
"cites-multiple-pandoc-3.1.8plus.golden"
#elif MIN_VERSION_pandoc(3,0,0)
"cites-multiple-pandoc-3.0.0plus.golden"
#else
pandocMajorVersion = 2
"cites-multiple-pandoc-2.0.0plus.golden"
#endif
16 changes: 16 additions & 0 deletions tests/data/biblio/cites-meijer-pandoc-3.1.8plus.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>This page cites a paper.</title>
</head>
<body>
<h1>This page cites a paper.</h1>
<p>I would like to cite one of my favourite papers <span class="citation" data-cites="meijer1991functional">(Meijer, Fokkinga, and Paterson 1991)</span> here.</p>
<div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" role="list">
<div id="ref-meijer1991functional" class="csl-entry" role="listitem">
Meijer, Erik, Maarten Fokkinga, and Ross Paterson. 1991. <span>“Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire.”</span> In <em>Conference on Functional Programming Languages and Computer Architecture</em>, 124–44. Springer.
</div>
</div>
</body>
</html>
20 changes: 20 additions & 0 deletions tests/data/biblio/cites-multiple-pandoc-3.1.8plus.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>This page cites a paper and a book.</title>
</head>
<body>
<h1>This page cites a paper and a book.</h1>
<p>I would like to cite one of my favourite papers <span class="citation" data-cites="meijer1991functional">(Meijer, Fokkinga, and Paterson 1991)</span> here.</p>
<p>And also a book <span class="citation" data-cites="lipovaca2012">(Lipovača 2012)</span>.</p>
<div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" role="list">
<div id="ref-lipovaca2012" class="csl-entry" role="listitem">
Lipovača, Miran. 2012. <em>Learn You a Haskell for Great Good! A Beginner’s Guide</em>. San Francisco, CA: No Starch Press.
</div>
<div id="ref-meijer1991functional" class="csl-entry" role="listitem">
Meijer, Erik, Maarten Fokkinga, and Ross Paterson. 1991. <span>“Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire.”</span> In <em>Conference on Functional Programming Languages and Computer Architecture</em>, 124–44. Springer.
</div>
</div>
</body>
</html>