diff --git a/docs/High Level Architecture.graffle b/docs/High Level Architecture.graffle new file mode 100644 index 000000000..045a7cfe2 Binary files /dev/null and b/docs/High Level Architecture.graffle differ diff --git a/docs/High Level Architecture.svg b/docs/High Level Architecture.svg new file mode 100644 index 000000000..79b5af370 --- /dev/null +++ b/docs/High Level Architecture.svg @@ -0,0 +1,3 @@ + + +2012-01-12 18:59ZCanvas 1Layer 1Manages a collection of tiddlers. Plumbs in representation conversion and cachingWikiStoreInitialisation and bootstrappingAppParses TiddlyWiki-style macro parameters into a JavaScript structureArgParserAbstracts differences between file system and HTTPFileRetrieverParses JavaScript code into a parse treeJavaScriptParserRepresents JavaScript code in a tree structure. Has methods to compile a tree back into textual JavaScriptJavaScriptParseTreeOpen source JavaScript parsing enginePEG.JSParser for the JavaScript language provided as an example by PEG.JSjavascript.pegjsCollection of objects that know how to navigate to a new tiddlerNavigatorsA navigator that implements TiddlyWiki's classic navigation behaviourStoryNavigatorRepresents a TiddlyWiki recipe. Has methods to load a recipe and its tiddlers, and to cook the output of the recipeRecipeRepresents a tiddler as an immutable collection of fieldsTiddlerFunctions know how to write tiddlers to various data formatsTiddlerOutputFunctions that know how to read tiddlers from various data formatsTiddlerInputRagtag of small utility functions for manipulating strings and datesUtilsParses wiki text into a parse treeWikiTextParserRepresents a wiki text parse tree. Has methods to compile the parse tree into a JavaScript functionWikiTextParseTreeIndividual wiki text parsing rulesWikiTextRulesmacrosechoinfolisttiddlerversionviewnode.jsbrowserImplements node.js module loading in the browserBootLoader diff --git a/docs/High Level Architecture.svg.meta b/docs/High Level Architecture.svg.meta new file mode 100644 index 000000000..826b3d964 --- /dev/null +++ b/docs/High Level Architecture.svg.meta @@ -0,0 +1,3 @@ +title: High Level Architecture.svg +modifier: JeremyRuston +type: image/svg+xml diff --git a/js/App.js b/js/App.js index a77763beb..b864c5877 100644 --- a/js/App.js +++ b/js/App.js @@ -15,6 +15,7 @@ var WikiStore = require("./WikiStore.js").WikiStore, tiddlerOutput = require("./TiddlerOutput.js"), WikiTextParser = require("./WikiTextParser.js").WikiTextParser, JavaScriptParser = require("./JavaScriptParser.js").JavaScriptParser, + SVGParser = require("./SVGParser.js").SVGParser, Navigators = require("./Navigators.js").Navigators, StoryNavigator = require("./StoryNavigator.js").StoryNavigator; @@ -24,10 +25,11 @@ var App = function() { this.isBrowser = typeof window !== "undefined"; // Create the main store this.store = new WikiStore(); - // Register the wikitext parser + // Register the wikitext parser and the SVG parser this.store.registerParser("text/x-tiddlywiki",new WikiTextParser({ store: this.store })); + this.store.registerParser("image/svg+xml",new SVGParser()); // Register the standard tiddler serializers and deserializers tiddlerInput.register(this.store); tiddlerOutput.register(this.store); diff --git a/js/SVGParser.js b/js/SVGParser.js new file mode 100644 index 000000000..d2d95c09a --- /dev/null +++ b/js/SVGParser.js @@ -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; + +})(); diff --git a/js/macros/tiddler.js b/js/macros/tiddler.js index fa9088d8f..715ba419c 100644 --- a/js/macros/tiddler.js +++ b/js/macros/tiddler.js @@ -30,7 +30,7 @@ exports.macro = { return store.renderText(targetTiddler.fields.type,text,type,tiddler.fields.title); } else { // 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); } } }; diff --git a/tiddlywiki5/styles.css b/tiddlywiki5/styles.css index 389e1ea60..3a9c7e012 100644 --- a/tiddlywiki5/styles.css +++ b/tiddlywiki5/styles.css @@ -94,3 +94,7 @@ a.linkInternalResolves { a.linkInternalMissing { font-style: italic; } + +svg { + width: 100%; +} diff --git a/tiddlywiki5/tiddlers/TiddlyWikiArchitecture.tid b/tiddlywiki5/tiddlers/TiddlyWikiArchitecture.tid index ea8c0522b..aa02abcad 100644 --- a/tiddlywiki5/tiddlers/TiddlyWikiArchitecture.tid +++ b/tiddlywiki5/tiddlers/TiddlyWikiArchitecture.tid @@ -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. +<> + !! 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: diff --git a/tiddlywiki5/tiddlywiki5.recipe b/tiddlywiki5/tiddlywiki5.recipe index cd5b98b95..859930cc6 100644 --- a/tiddlywiki5/tiddlywiki5.recipe +++ b/tiddlywiki5/tiddlywiki5.recipe @@ -4,6 +4,7 @@ style: styles.css recipe: tiddlers/split.recipe recipe: ../parsers/split.recipe +tiddler: ../docs/High Level Architecture.svg 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/TiddlerOutput.js jsmodule: ../js/WikiStore.js +jsmodule: ../js/SVGParser.js jsmodule: ../js/WikiTextParser.js jsmodule: ../js/WikiTextRules.js jsmodule: ../js/WikiTextParseTree.js