comparison mod_latex/mod_latex.lua @ 1432:ee2302b78c74

mod_latex: get_child_text!
author Kim Alvefur <zash@zash.se>
date Wed, 11 Jun 2014 20:38:07 +0200
parents 7dbde05b48a9
children df8da7e4c2bf
comparison
equal deleted inserted replaced
1431:33a796b2cb91 1432:ee2302b78c74
5 local xmlns_xhtml = "http://www.w3.org/1999/xhtml"; 5 local xmlns_xhtml = "http://www.w3.org/1999/xhtml";
6 6
7 local function replace_latex(data) 7 local function replace_latex(data)
8 module:log("debug", "Replacing latex..."); 8 module:log("debug", "Replacing latex...");
9 local origin, stanza = data.origin, data.stanza; 9 local origin, stanza = data.origin, data.stanza;
10 local body = stanza:child_with_name("body"); 10 local body = stanza:get_child_text("body");
11 if not body then return; end 11 if not body or not body:match("%$%$") then
12
13 body = body:get_text();
14 if not body:match("%$%$") then
15 return; 12 return;
16 end 13 end
17 14
18 local html = st.stanza("html", { xmlns = xmlns_xhtmlim }) 15 local html = st.stanza("html", { xmlns = xmlns_xhtmlim })
19 :tag("body", { xmlns = xmlns_xhtml }); 16 :tag("body", { xmlns = xmlns_xhtml });