mod_latex/mod_latex.lua
changeset 1432 ee2302b78c74
parent 1343 7dbde05b48a9
child 1433 df8da7e4c2bf
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 });