aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-11-29 18:12:30 +0100
committerGitHub <noreply@github.com>2021-11-29 09:12:30 -0800
commitfa838deefc6badc62b9ca4d93aba55e9fbd747ec (patch)
treef3280f320ce9652185b85fdbac473a898409f3d5
parent136739b7ed6dbd4052be582febf4ff3beea32d87 (diff)
downloadpandoc-fa838deefc6badc62b9ca4d93aba55e9fbd747ec.tar.gz
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
-rw-r--r--doc/lua-filters.md18
-rw-r--r--src/Text/Pandoc/Lua/Module/Utils.hs8
-rw-r--r--test/lua/module/pandoc-utils.lua28
3 files changed, 0 insertions, 54 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index ff56e1a8e..ac682a90d 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -3121,24 +3121,6 @@ Usage:
-- outputs "Moin"
print(pandoc.utils.stringify(inline))
-### text {#pandoc.utils.text}
-
-`text (words)`
-
-Converts a string to `Inlines`, treating interword spaces as
-`Space`s or `SoftBreak`s. If you want a single `Str` with literal
-spaces, use `pandoc.Str`.
-
-Parameters:
-
-`words`
-: markup-less text (string)
-
-Returns:
-
-- List of inline elements split into words (Inlines)
-
-
### to\_roman\_numeral {#pandoc.utils.to_roman_numeral}
`to_roman_numeral (integer)`
diff --git a/src/Text/Pandoc/Lua/Module/Utils.hs b/src/Text/Pandoc/Lua/Module/Utils.hs
index 917f2e627..8bb185500 100644
--- a/src/Text/Pandoc/Lua/Module/Utils.hs
+++ b/src/Text/Pandoc/Lua/Module/Utils.hs
@@ -115,14 +115,6 @@ documentedModule = Module
<#> parameter peekAstElement "AST element" "elem" "some pandoc AST element"
=#> functionResult pushText "string" "stringified element"
- , defun "text"
- ### liftPure (B.toList . B.text)
- <#> parameter peekText "string" "words" "markup-less inlines text"
- =#> functionResult pushInlines "Inlines" "list of inline elements"
- #? ("Converts a string to `Inlines`, treating interword spaces as " <>
- "`Space`s or `SoftBreak`s. If you want a `Str` with literal " <>
- "spaces, use `pandoc.Str`.")
-
, defun "from_simple_table"
### from_simple_table
<#> parameter peekSimpleTable "SimpleTable" "simple_tbl" ""
diff --git a/test/lua/module/pandoc-utils.lua b/test/lua/module/pandoc-utils.lua
index 21f550177..9bd903f2d 100644
--- a/test/lua/module/pandoc-utils.lua
+++ b/test/lua/module/pandoc-utils.lua
@@ -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))