Skip to content

Commit 7d63e09

Browse files
committed
spellcheck: require pandoc 2.1 or later
1 parent e90cba3 commit 7d63e09

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spellcheck/spellcheck.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
-- lua filter for spell checking: requires 'aspell'.
22
-- Copyright (C) 2017-2020 John MacFarlane, released under MIT license
33

4+
-- pandoc.utils.stringify works on MetaValue elements since pandoc 2.1
5+
if PANDOC_VERSION == nil then -- if pandoc_version < 2.1
6+
error("ERROR: pandoc >= 2.1 required for spellcheck.lua filter")
7+
end
8+
49
local text = require('text')
510
local words = {}
611
local deflang
@@ -15,10 +20,7 @@ local function add_to_dict(lang, t)
1520
end
1621

1722
local function get_deflang(meta)
18-
deflang = (meta.lang and meta.lang[1] and meta.lang[1].c) or 'en'
19-
-- the following is better but won't work in pandoc 2.0.6.
20-
-- it requires pandoc commit ecc46e229fde934f163d1f646383d24bfe2039e1:
21-
-- deflang = (meta.lang and pandoc.utils.stringify(meta.lang)) or 'en'
23+
deflang = (meta.lang and pandoc.utils.stringify(meta.lang)) or 'en'
2224
return {} -- eliminate meta so it doesn't get spellchecked
2325
end
2426

0 commit comments

Comments
 (0)