mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 11:16:33 +00:00
Lua: remove pandoc.utils.text (#7720)
The new `pandoc.Inlines` function behaves identical on string input, but
allows other Inlines-like arguments as well.
The `pandoc.utils.text` function could be written as
function pandoc.utils.text (x)
assert(type(x) == 'string')
return pandoc.Inlines(x)
end
This commit is contained in:
@@ -82,34 +82,6 @@ return {
|
||||
end)
|
||||
},
|
||||
|
||||
group 'text' {
|
||||
test('string is converted to inlines', function ()
|
||||
local expected = {
|
||||
pandoc.Str 'Madness', pandoc.Space(), pandoc.Str '-', pandoc.Space(),
|
||||
pandoc.Str 'Our', pandoc.Space(), pandoc.Str 'House'
|
||||
}
|
||||
assert.are_same(pandoc.utils.text('Madness - Our House'), expected)
|
||||
end),
|
||||
test('tabs are treated as space', function ()
|
||||
local expected = {
|
||||
pandoc.Str 'Linkin', pandoc.Space(), pandoc.Str 'Park', pandoc.Space(),
|
||||
pandoc.Str '-', pandoc.Space(), pandoc.Str 'Papercut'
|
||||
}
|
||||
assert.are_same(pandoc.utils.text('Linkin Park\t-\tPapercut'), expected)
|
||||
end),
|
||||
test('newlines are treated as softbreaks', function ()
|
||||
local expected = {
|
||||
pandoc.Str 'Porcupine', pandoc.Space(), pandoc.Str 'Tree',
|
||||
pandoc.SoftBreak(), pandoc.Str '-', pandoc.SoftBreak(),
|
||||
pandoc.Str 'Blackest', pandoc.Space(), pandoc.Str 'Eyes'
|
||||
}
|
||||
assert.are_same(
|
||||
pandoc.utils.text('Porcupine Tree\n-\nBlackest Eyes'),
|
||||
expected
|
||||
)
|
||||
end),
|
||||
},
|
||||
|
||||
group 'to_roman_numeral' {
|
||||
test('convertes number', function ()
|
||||
assert.are_equal('MDCCCLXXXVIII', utils.to_roman_numeral(1888))
|
||||
|
||||
Reference in New Issue
Block a user