mod_latex: get_child_text!
authorKim Alvefur <zash@zash.se>
Wed, 11 Jun 2014 20:38:07 +0200
changeset 1432 ee2302b78c74
parent 1431 33a796b2cb91
child 1433 df8da7e4c2bf
mod_latex: get_child_text!
mod_latex/mod_latex.lua
--- a/mod_latex/mod_latex.lua	Wed Jun 11 12:50:57 2014 +0200
+++ b/mod_latex/mod_latex.lua	Wed Jun 11 20:38:07 2014 +0200
@@ -7,11 +7,8 @@
 local function replace_latex(data)
 	module:log("debug", "Replacing latex...");
 	local origin, stanza = data.origin, data.stanza;
-	local body = stanza:child_with_name("body");
-	if not body then return; end
-
-	body = body:get_text();
-	if not body:match("%$%$") then
+	local body = stanza:get_child_text("body");
+	if not body or not body:match("%$%$") then
 		return;
 	end