Skip to content

Commit 346e407

Browse files
committed
fix: lipsum shortcode should have the ability to not randomize
Fixes #11664
1 parent a5b92f9 commit 346e407

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/resources/extensions/quarto/lipsum/lipsum.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ local barePattern = '^(%d+)$'
3636
return {
3737
['lipsum'] = function(args, kwargs, meta)
3838

39+
local isRandom = false
40+
if kwargs and kwargs["random"] then
41+
local randomVal = pandoc.utils.stringify(kwargs["random"])
42+
if randomVal == "true" then
43+
isRandom = true
44+
end
45+
end
46+
3947
local paraStart = 1
4048
local paraEnd = 5
4149

@@ -58,7 +66,9 @@ return {
5866
-- a number of paragraphs is specified, like 10
5967
local _,_,bareVal = range:find(barePattern)
6068
if bareVal then
61-
paraStart = math.random(1, 17)
69+
if isRandom then
70+
paraStart = math.random(1, 17)
71+
end
6272
local endNumber = tonumber(bareVal)
6373
if endNumber ~= nil then
6474
paraEnd = paraStart + endNumber - 1

0 commit comments

Comments
 (0)