2013-04-10 16:02:37 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/parsers/htmlparser.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: parser
|
|
|
|
|
|
|
|
The HTML parser displays text as raw HTML
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var HtmlParser = function(type,text,options) {
|
2014-06-11 22:04:58 +00:00
|
|
|
var src;
|
|
|
|
if(options._canonical_uri) {
|
|
|
|
src = options._canonical_uri;
|
|
|
|
} else if(text) {
|
2014-11-03 16:20:49 +00:00
|
|
|
src = "data:text/html;charset=utf-8," + encodeURIComponent(text);
|
2014-06-11 22:04:58 +00:00
|
|
|
}
|
2013-04-10 16:02:37 +00:00
|
|
|
this.tree = [{
|
2014-06-11 22:04:58 +00:00
|
|
|
type: "element",
|
|
|
|
tag: "iframe",
|
|
|
|
attributes: {
|
|
|
|
src: {type: "string", value: src}
|
|
|
|
}
|
2013-04-10 16:02:37 +00:00
|
|
|
}];
|
|
|
|
};
|
|
|
|
|
|
|
|
exports["text/html"] = HtmlParser;
|
|
|
|
|
|
|
|
})();
|
|
|
|
|