summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2007-06-18 17:35:49 +0000
committerpixel <pixel>2007-06-18 17:35:49 +0000
commit9921c38070f5cdd429accca750dee984d56229c8 (patch)
treed01e5eff56c5b82c2b1387346f74891c88464d44
parent3839686287a49edf94d4febcfdd90d261eae223d (diff)
Adding the cdata and jcdata renderers.
-rw-r--r--lib/xmllib.lua34
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,