1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-29 11:30:28 +00:00
TiddlyWiki5/core/modules/parsers/textparser.js

36 lines
815 B
JavaScript
Raw Normal View History

/*\
title: $:/core/modules/parsers/textparser.js
type: application/javascript
module-type: parser
The plain text parser processes blocks of source text into a degenerate parse tree consisting of a single text node
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var TextParser = function(type,text,options) {
this.tree = [{
type: "codeblock",
attributes: {
code: {type: "string", value: text},
language: {type: "string", value: type}
}
}];
this.source = text;
this.type = type;
};
exports["text/plain"] = TextParser;
exports["text/x-tiddlywiki"] = TextParser;
exports["application/javascript"] = TextParser;
exports["application/json"] = TextParser;
2013-04-25 08:05:17 +00:00
exports["text/css"] = TextParser;
exports["application/x-tiddler-dictionary"] = TextParser;
})();