Software /
code /
prosody
Comparison
plugins/mod_scansion_record.lua @ 10718:d229e4d31598
mod_scansion_record: Indent stanzas in recordings
Improves readability, easier to see structure.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 12 Apr 2020 17:30:16 +0200 |
parent | 9619:7172077c0a53 |
child | 11254:613035d6e5a0 |
comparison
equal
deleted
inserted
replaced
10717:05e4645fc9b3 | 10718:d229e4d31598 |
---|---|
35 local function record_event(session, event) | 35 local function record_event(session, event) |
36 record(session.scansion_id.." "..event.."\n\n"); | 36 record(session.scansion_id.." "..event.."\n\n"); |
37 end | 37 end |
38 | 38 |
39 local function record_stanza(stanza, session, verb) | 39 local function record_stanza(stanza, session, verb) |
40 local flattened = tostring(stanza):gsub("><", ">\n\t<"); | 40 local flattened = tostring(stanza:indent(2, "\t")); |
41 -- TODO Proper prettyprinting with indentation | |
42 record(session.scansion_id.." "..verb..":\n\t"..flattened.."\n\n"); | 41 record(session.scansion_id.." "..verb..":\n\t"..flattened.."\n\n"); |
43 end | 42 end |
44 | 43 |
45 local function record_stanza_in(stanza, session) | 44 local function record_stanza_in(stanza, session) |
46 if stanza.attr.xmlns == nil then | 45 if stanza.attr.xmlns == nil then |