diff options
-rw-r--r-- | lib/xmllib.lua | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/xmllib.lua b/lib/xmllib.lua index f9ac9bf..de0c7a5 100644 --- a/lib/xmllib.lua +++ b/lib/xmllib.lua @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: xmllib.lua,v 1.14 2007-06-16 13:57:41 pixel Exp $ */ +/* $Id: xmllib.lua,v 1.15 2007-06-18 17:35:49 pixel Exp $ */ ]]-- @@ -68,6 +68,26 @@ local function process_raw(xm, a) } end +local function process_cdata(xm, a) + return { + istop = true, + nodes = { + a + }, + type = "cdata", + } +end + +local function process_jcdata(xm, a) + return { + istop = true, + nodes = { + a + }, + type = "jcdata", + } +end + local function process_empty(xm) return { istop = true, @@ -179,6 +199,14 @@ local function render_raw(depth, v) return v.nodes[1], true end +local function render_cdata(depth, v) + return "<![CDATA[\n" .. v.nodes[1] .. "\n]]>", true +end + +local function render_jcdata(depth, v) + return "//<![CDATA[\n" .. v.nodes[1] .. "\n//]]>", true +end + local function render_empty(depth, v) return "", false end @@ -187,6 +215,8 @@ local special_renders = { comment = render_comment, lf = render_lf, raw = render_raw, + cdata = render_cdata, + jcdata = render_jcdata, empty = render_empty, } @@ -254,6 +284,8 @@ function NewXmlMarkup() comment = process_comment, lf = process_lf, raw = process_raw, + cdata = process_cdata, + jcdata = process_jcdata, empty = process_empty, tops = {}, render = do_render, |