Local functions
This commit is contained in:
parent
2de3d5ecf8
commit
c8a6a33d8b
4
init.lua
4
init.lua
@ -278,7 +278,7 @@ doc.entry_builders = {}
|
|||||||
|
|
||||||
-- Inserts line breaks into a single paragraph and collapses all whitespace (including newlines)
|
-- Inserts line breaks into a single paragraph and collapses all whitespace (including newlines)
|
||||||
-- into spaces
|
-- into spaces
|
||||||
function linebreaker_single(text)
|
local linebreaker_single = function(text)
|
||||||
local linelength = 80
|
local linelength = 80
|
||||||
local remain = linelength
|
local remain = linelength
|
||||||
local res = {}
|
local res = {}
|
||||||
@ -307,7 +307,7 @@ function linebreaker_single(text)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Inserts automatic line breaks into an entire text and preserves existing newlines
|
-- Inserts automatic line breaks into an entire text and preserves existing newlines
|
||||||
function linebreaker(text)
|
local linebreaker = function(text)
|
||||||
local out = ""
|
local out = ""
|
||||||
for s in string.gmatch(text, "([^\n]*)\n") do
|
for s in string.gmatch(text, "([^\n]*)\n") do
|
||||||
s = linebreaker_single(s)
|
s = linebreaker_single(s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user