mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-26 10:00:34 +00:00
bf8b3cff03
* fix: overriding codeblock widget should not impact text parser * fix: whitespace changes
37 lines
975 B
JavaScript
37 lines
975 B
JavaScript
/*\
|
|
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: "genesis",
|
|
attributes: {
|
|
$type: {name: "$type", type: "string", value: "$codeblock"},
|
|
code: {name: "code", type: "string", value: text},
|
|
language: {name: "language", type: "string", value: type},
|
|
$remappable: {name: "$remappable", type:"string", value: "no"}
|
|
}
|
|
}];
|
|
this.source = text;
|
|
this.type = type;
|
|
};
|
|
|
|
exports["text/plain"] = TextParser;
|
|
exports["text/x-tiddlywiki"] = TextParser;
|
|
exports["application/javascript"] = TextParser;
|
|
exports["application/json"] = TextParser;
|
|
exports["text/css"] = TextParser;
|
|
exports["application/x-tiddler-dictionary"] = TextParser;
|
|
|
|
})();
|