mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-23 15:36:52 +00:00
Added plain text parser
Now we display plain text tiddlers properly
This commit is contained in:
parent
2ce77b3839
commit
588bc550c0
@ -15,6 +15,7 @@ var WikiStore = require("./WikiStore.js").WikiStore,
|
||||
tiddlerOutput = require("./TiddlerOutput.js"),
|
||||
Renderer = require("./Renderer.js").Renderer,
|
||||
WikiTextParser = require("./WikiTextParser.js").WikiTextParser,
|
||||
PlainTextParser = require("./PlainTextParser.js").PlainTextParser,
|
||||
JavaScriptParser = require("./JavaScriptParser.js").JavaScriptParser,
|
||||
JSONParser = require("./JSONParser.js").JSONParser,
|
||||
ImageParser = require("./ImageParser.js").ImageParser;
|
||||
@ -27,6 +28,7 @@ var App = function() {
|
||||
this.store = new WikiStore();
|
||||
// Register the parsers
|
||||
this.store.registerParser("text/x-tiddlywiki",new WikiTextParser({store: this.store}));
|
||||
this.store.registerParser("text/plain",new PlainTextParser({store: this.store}));
|
||||
this.store.registerParser(["image/svg+xml",".svg","image/jpg",".jpg","image/jpeg",".jpeg","image/png",".png","image/gif",".gif"],new ImageParser({store: this.store}));
|
||||
this.store.registerParser(["application/javascript",".js"],new JavaScriptParser({store: this.store}));
|
||||
this.store.registerParser(["application/json",".json"],new JSONParser({store: this.store}));
|
||||
|
27
js/PlainTextParser.js
Normal file
27
js/PlainTextParser.js
Normal file
@ -0,0 +1,27 @@
|
||||
/*\
|
||||
title: js/PlainTextParser.js
|
||||
|
||||
Renders plain text tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true */
|
||||
"use strict";
|
||||
|
||||
var WikiTextParseTree = require("./WikiTextParseTree.js").WikiTextParseTree,
|
||||
Renderer = require("./Renderer.js").Renderer,
|
||||
Dependencies = require("./Dependencies.js").Dependencies,
|
||||
utils = require("./Utils.js");
|
||||
|
||||
var PlainTextParser = function(options) {
|
||||
this.store = options.store;
|
||||
};
|
||||
|
||||
PlainTextParser.prototype.parse = function(type,text) {
|
||||
return new WikiTextParseTree([Renderer.ElementNode("pre",{},[Renderer.TextNode(text)])],new Dependencies(),this.store);
|
||||
};
|
||||
|
||||
exports.PlainTextParser = PlainTextParser;
|
||||
|
||||
})();
|
Loading…
Reference in New Issue
Block a user