Software /
code /
prosody
Diff
util/stanza.lua @ 11642:7f2dee4249aa
util.stanza: Export pretty printing function
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 29 Jun 2021 16:06:54 +0200 |
parent | 11640:51598e46e136 |
child | 11786:39164ea2ab9e |
line wrap: on
line diff
--- a/util/stanza.lua Tue Jun 29 16:05:35 2021 +0200 +++ b/util/stanza.lua Tue Jun 29 16:06:54 2021 +0200 @@ -488,6 +488,7 @@ return new_stanza("presence", attr); end +local pretty; if do_pretty_printing then local getstyle, getstring = termcolours.getstyle, termcolours.getstring; @@ -512,7 +513,7 @@ 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 @@ error_reply = error_reply; presence = presence; xml_escape = xml_escape; + pretty_print = pretty; };