1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-03-31 12:01:30 +00:00
Files
TiddlyWiki5/core/modules/parsers/htmlparser.js
Jeremy Ruston d8b0e041b6 Initial commit
2026-02-19 12:45:27 +00:00

31 lines
735 B
JavaScript

/*\
title: $:/core/modules/parsers/htmlparser.js
type: application/javascript
module-type: parser
\*/
"use strict";
var HtmlParser = function(type,text,options) {
var src;
if(options._canonical_uri) {
src = options._canonical_uri;
} else if(text) {
src = "data:text/html;charset=utf-8," + encodeURIComponent(text);
}
this.tree = [{
type: "element",
tag: "iframe",
attributes: {
src: {type: "string", value: src}
}
}];
if($tw.wiki.getTiddlerText("$:/config/HtmlParser/DisableSandbox","no") !== "yes") {
this.tree[0].attributes.sandbox = {type: "string", value: $tw.wiki.getTiddlerText("$:/config/HtmlParser/SandboxTokens","")};
}
this.source = text;
this.type = type;
};
exports["text/html"] = HtmlParser;