mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Added support for SVG tiddlers
Which means adding a parser for SVG, even though it doesn't actually do any parsing at the moment
This commit is contained in:
parent
6f247640c6
commit
ecabcd676b
BIN
docs/High Level Architecture.graffle
Normal file
BIN
docs/High Level Architecture.graffle
Normal file
Binary file not shown.
3
docs/High Level Architecture.svg
Normal file
3
docs/High Level Architecture.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 31 KiB |
3
docs/High Level Architecture.svg.meta
Normal file
3
docs/High Level Architecture.svg.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
title: High Level Architecture.svg
|
||||||
|
modifier: JeremyRuston
|
||||||
|
type: image/svg+xml
|
@ -15,6 +15,7 @@ var WikiStore = require("./WikiStore.js").WikiStore,
|
|||||||
tiddlerOutput = require("./TiddlerOutput.js"),
|
tiddlerOutput = require("./TiddlerOutput.js"),
|
||||||
WikiTextParser = require("./WikiTextParser.js").WikiTextParser,
|
WikiTextParser = require("./WikiTextParser.js").WikiTextParser,
|
||||||
JavaScriptParser = require("./JavaScriptParser.js").JavaScriptParser,
|
JavaScriptParser = require("./JavaScriptParser.js").JavaScriptParser,
|
||||||
|
SVGParser = require("./SVGParser.js").SVGParser,
|
||||||
Navigators = require("./Navigators.js").Navigators,
|
Navigators = require("./Navigators.js").Navigators,
|
||||||
StoryNavigator = require("./StoryNavigator.js").StoryNavigator;
|
StoryNavigator = require("./StoryNavigator.js").StoryNavigator;
|
||||||
|
|
||||||
@ -24,10 +25,11 @@ var App = function() {
|
|||||||
this.isBrowser = typeof window !== "undefined";
|
this.isBrowser = typeof window !== "undefined";
|
||||||
// Create the main store
|
// Create the main store
|
||||||
this.store = new WikiStore();
|
this.store = new WikiStore();
|
||||||
// Register the wikitext parser
|
// Register the wikitext parser and the SVG parser
|
||||||
this.store.registerParser("text/x-tiddlywiki",new WikiTextParser({
|
this.store.registerParser("text/x-tiddlywiki",new WikiTextParser({
|
||||||
store: this.store
|
store: this.store
|
||||||
}));
|
}));
|
||||||
|
this.store.registerParser("image/svg+xml",new SVGParser());
|
||||||
// Register the standard tiddler serializers and deserializers
|
// Register the standard tiddler serializers and deserializers
|
||||||
tiddlerInput.register(this.store);
|
tiddlerInput.register(this.store);
|
||||||
tiddlerOutput.register(this.store);
|
tiddlerOutput.register(this.store);
|
||||||
|
34
js/SVGParser.js
Normal file
34
js/SVGParser.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*\
|
||||||
|
title: js/SVGParser.js
|
||||||
|
|
||||||
|
Compiles SVG images into JavaScript functions that render them in HTML
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// The parse tree is degenerate
|
||||||
|
var SVGParseTree = function() {
|
||||||
|
this.dependencies = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
SVGParseTree.prototype.compile = function(type) {
|
||||||
|
if(type === "text/html") {
|
||||||
|
return "(function (tiddler,store,utils) {return tiddler.fields.text;})";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var SVGParser = function() {
|
||||||
|
};
|
||||||
|
|
||||||
|
SVGParser.prototype.parse = function() {
|
||||||
|
return new SVGParseTree();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.SVGParser = SVGParser;
|
||||||
|
|
||||||
|
})();
|
@ -30,7 +30,7 @@ exports.macro = {
|
|||||||
return store.renderText(targetTiddler.fields.type,text,type,tiddler.fields.title);
|
return store.renderText(targetTiddler.fields.type,text,type,tiddler.fields.title);
|
||||||
} else {
|
} else {
|
||||||
// There's no parameterisation, so we can just render the target tiddler directly
|
// There's no parameterisation, so we can just render the target tiddler directly
|
||||||
return store.renderTiddler(type,params.target,tiddler.fields.title);
|
return store.renderTiddler(type,params.target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -94,3 +94,7 @@ a.linkInternalResolves {
|
|||||||
a.linkInternalMissing {
|
a.linkInternalMissing {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
@ -9,6 +9,8 @@ TiddlyWiki is based on the idea of making information more useful by modelling i
|
|||||||
|
|
||||||
Tiddlers use a special wikitext notation that concisely represents text formatting and hypertext features. A cornerstone of wikitext is the ability to combine and embed tiddlers in various ways.
|
Tiddlers use a special wikitext notation that concisely represents text formatting and hypertext features. A cornerstone of wikitext is the ability to combine and embed tiddlers in various ways.
|
||||||
|
|
||||||
|
<<tiddler [[High Level Architecture.svg]]>>
|
||||||
|
|
||||||
!! Content Types
|
!! Content Types
|
||||||
|
|
||||||
TiddlyWiki uses MIME types to indicate how the text of tiddlers should be interpreted. It uses standard MIME types such as {{{text/plain}}} and {{{text/html}}}, as well as these non-standard types for TiddlyWiki-specific formats:
|
TiddlyWiki uses MIME types to indicate how the text of tiddlers should be interpreted. It uses standard MIME types such as {{{text/plain}}} and {{{text/html}}}, as well as these non-standard types for TiddlyWiki-specific formats:
|
||||||
|
@ -4,6 +4,7 @@ style: styles.css
|
|||||||
|
|
||||||
recipe: tiddlers/split.recipe
|
recipe: tiddlers/split.recipe
|
||||||
recipe: ../parsers/split.recipe
|
recipe: ../parsers/split.recipe
|
||||||
|
tiddler: ../docs/High Level Architecture.svg
|
||||||
|
|
||||||
jslib: ../test/tiddlywiki.2.6.5/source/tiddlywiki/jquery/jquery.js
|
jslib: ../test/tiddlywiki.2.6.5/source/tiddlywiki/jquery/jquery.js
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ jsmodule: ../js/Tiddler.js
|
|||||||
jsmodule: ../js/TiddlerInput.js
|
jsmodule: ../js/TiddlerInput.js
|
||||||
jsmodule: ../js/TiddlerOutput.js
|
jsmodule: ../js/TiddlerOutput.js
|
||||||
jsmodule: ../js/WikiStore.js
|
jsmodule: ../js/WikiStore.js
|
||||||
|
jsmodule: ../js/SVGParser.js
|
||||||
jsmodule: ../js/WikiTextParser.js
|
jsmodule: ../js/WikiTextParser.js
|
||||||
jsmodule: ../js/WikiTextRules.js
|
jsmodule: ../js/WikiTextRules.js
|
||||||
jsmodule: ../js/WikiTextParseTree.js
|
jsmodule: ../js/WikiTextParseTree.js
|
||||||
|
Loading…
Reference in New Issue
Block a user