Skip to content

Instantly share code, notes, and snippets.

@mk-pmb
Last active October 4, 2016 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mk-pmb/1cfa5d53bad0698b1ec3582fbc41ecab to your computer and use it in GitHub Desktop.
Save mk-pmb/1cfa5d53bad0698b1ec3582fbc41ecab to your computer and use it in GitHub Desktop.
/*jslint indent: 2, maxlen: 80, node: true */
'use strict';
var xmldefuse = require("xmldefuse"),
rawXY = "X &amp& <lt< >gt> 'apos' \"quot\" Y",
rawCD = "Have <![CDATA[ marks ]]> in ]]> text",
eq = require("assert").strictEqual;
eq(xmldefuse.cdata(rawXY),
"<![CDATA[X &amp& <lt< >gt> 'apos' \"quot\" Y]]>");
eq(xmldefuse.cdata(rawCD),
"<![CDATA[Have <![CDATA[ marks ]]]]><![CDATA[> in ]]]]><![CDATA[> text]]>");
console.log('+OK test passed');
!!! 5
%html
%head
%meta{ 'http-equiv': "Content-Type", content: "text/html; charset=UTF-8" }
- var pageTitle = 'Test cdata mode of xmldefuse'
%title #{pageTitle}
%meta{ 'http-equiv': "Content-Script-Type", content: "text/javascript" }
%body.page.screen
%h2 #{pageTitle}
:javascript
/*jslint indent: 2, maxlen: 80, node: true */
'use strict';
var xmldefuse = require("xmldefuse"),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment