2012-12-27 17:08:29 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/parsers/textparser.js
|
|
|
|
type: application/javascript
|
2013-01-16 13:56:11 +00:00
|
|
|
module-type: parser
|
2012-12-27 17:08:29 +00:00
|
|
|
|
|
|
|
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 = [{
|
2014-05-14 07:51:08 +00:00
|
|
|
type: "codeblock",
|
2014-04-24 18:41:07 +00:00
|
|
|
attributes: {
|
|
|
|
code: {type: "string", value: text},
|
|
|
|
language: {type: "string", value: type}
|
|
|
|
}
|
2012-12-27 17:08:29 +00:00
|
|
|
}];
|
2022-05-08 19:48:33 +00:00
|
|
|
this.source = text;
|
|
|
|
this.type = type;
|
2012-12-27 17:08:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports["text/plain"] = TextParser;
|
2013-08-25 21:06:28 +00:00
|
|
|
exports["text/x-tiddlywiki"] = TextParser;
|
2012-12-27 17:08:29 +00:00
|
|
|
exports["application/javascript"] = TextParser;
|
2013-03-19 18:26:55 +00:00
|
|
|
exports["application/json"] = TextParser;
|
2013-04-25 08:05:17 +00:00
|
|
|
exports["text/css"] = TextParser;
|
2014-01-12 11:58:32 +00:00
|
|
|
exports["application/x-tiddler-dictionary"] = TextParser;
|
2012-12-27 17:08:29 +00:00
|
|
|
|
|
|
|
})();
|
|
|
|
|