aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-06-29 16:06:54 +0200
committerKim Alvefur <zash@zash.se>2021-06-29 16:06:54 +0200
commitf40173b4c7d7e31d0264964de0999559c4f4e28f (patch)
treef96a4d07f5f37955885414c3359917f9e66e56d6 /util
parent417846da58c448a45b5aba4e9a2d9d3b674c02dd (diff)
downloadprosody-f40173b4c7d7e31d0264964de0999559c4f4e28f.tar.gz
prosody-f40173b4c7d7e31d0264964de0999559c4f4e28f.zip
util.stanza: Export pretty printing function
Diffstat (limited to 'util')
-rw-r--r--util/stanza.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 86ec458b..7f321da8 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -488,6 +488,7 @@ local function presence(attr)
return new_stanza("presence", attr);
end
+local pretty;
if do_pretty_printing then
local getstyle, getstring = termcolours.getstyle, termcolours.getstring;
@@ -512,7 +513,7 @@ if do_pretty_printing then
getstring(green1, "%3") -- ;
);
- local function pretty(s)
+ function pretty(s)
-- Tag soup color
-- Outer gsub call takes each <tag>, applies colour to the brackets, the
-- tag name, then applies one inner gsub call to colour the attributes and
@@ -581,4 +582,5 @@ return {
error_reply = error_reply;
presence = presence;
xml_escape = xml_escape;
+ pretty_print = pretty;
};