Software /
code /
prosody
Diff
util/stanza.lua @ 11960:12a3c05aa12d
util.stanza: Adjust pretty printing for symmetry
Self-closing <tags/> and <?processing instructions?> had some
asymmetries in applied colors.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 29 Nov 2021 02:13:45 +0100 |
parent | 11786:39164ea2ab9e |
child | 12138:644ca3583837 |
line wrap: on
line diff
--- a/util/stanza.lua Sun Nov 28 23:14:31 2021 +0100 +++ b/util/stanza.lua Mon Nov 29 02:13:45 2021 +0100 @@ -526,7 +526,7 @@ -- 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 -- another for any text content. - return (s:gsub("(</?)([^ >]*)(.-)([?/]?>)([^<]*)", function(opening_bracket, tag_name, attrs, closing_bracket, content) + return (s:gsub("(<[?/]?)([^ >/?]*)(.-)([?/]?>)([^<]*)", function(opening_bracket, tag_name, attrs, closing_bracket, content) return getstring(blue1, opening_bracket)..getstring(blue2, tag_name).. attrs:gsub("([^=]+)(=)([\"'])(.-)([\"'])", attr_replace) .. getstring(blue1, closing_bracket) ..