summaryrefslogtreecommitdiff
path: root/tex/context/base/l-boolean.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/l-boolean.lua')
-rw-r--r--tex/context/base/l-boolean.lua20
1 files changed, 14 insertions, 6 deletions
diff --git a/tex/context/base/l-boolean.lua b/tex/context/base/l-boolean.lua
index e1efa4ad4..098f0b3a1 100644
--- a/tex/context/base/l-boolean.lua
+++ b/tex/context/base/l-boolean.lua
@@ -11,12 +11,20 @@ function boolean.tonumber(b)
if b then return 1 else return 0 end
end
-function toboolean(str)
- if type(str) == "string" then
- return str == "true" or str == "yes" or str == "on" or str == "1"
- elseif type(str) == "number" then
- return tonumber(str) ~= 0
- elseif type(str) == "nil" then
+function toboolean(str,tolerant)
+ if tolerant then
+ if type(str) == "string" then
+ return str == "true" or str == "yes" or str == "on" or str == "1"
+ elseif type(str) == "number" then
+ return tonumber(str) ~= 0
+ elseif type(str) == "nil" then
+ return false
+ else
+ return str
+ end
+ elseif str == "true" then
+ return true
+ elseif str == "false" then
return false
else
return str