mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-11-29 02:23:12 +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:
1 parent
6f247640c6
commit
ecabcd676b
9 files changed
+52
-2
No files matched your search
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="-2 -2 814 684" width="814pt" height="57pc"><metadata xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:date>2012-01-12 18:59Z</dc:date><!-- Produced by OmniGraffle Professional 5.3.6 --></metadata><defs><font-face font-family="Helvetica" font-size="7" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="10" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="7" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="6" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="8" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="9" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="6" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="21" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face></defs><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Canvas 1</title><g><title>Layer 1</title><path d="M 553.10236 94.89766 C 679.6328 221.42743 679.6328 426.57257 553.10236 553.10236 C 426.57257 679.6328 221.42743 679.6328 94.89766 553.10236 C -31.632782 426.57257 -31.632782 221.42743 94.89766 94.89766 C 221.42743 -31.632782 426.57257 -31.632782 553.10236 94.89766" fill="#f600ff" fill-opacity=".2"/><path d="M 553.10236 94.89766 C 679.6328 221.42743 679.6328 426.57257 553.10236 553.10236 C 426.57257 679.6328 221.42743 679.6328 94.89766 553.10236 C -31.632782 426.57257 -31.632782 221.42743 94.89766 94.89766 C 221.42743 -31.632782 426.57257 -31.632782 553.10236 94.89766" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><path d="M 715.10236 94.89766 C 841.6328 221.42743 841.6328 426.57257 715.10236 553.10236 C 588.57257 679.6328 383.42743 679.6328 256.89764 553.10236 C 130.36722 426.57257 130.36722 221.42743 256.89764 94.89766 C 383.42743 -31.632782 588.57257 -31.632782 715.10236 94.89766" fill="#ff0006" fill-opacity=".2"/><path d="M 715.10236 94.89766 C 841.6328 221.42743 841.6328 426.57257 715.10236 553.10236 C 588.57257 679.6328 383.42743 679.6328 256.89764 553.10236 C 130.36722 426.57257 130.36722 221.42743 256.89764 94.89766 C 383.42743 -31.632782 588.57257 -31.632782 715.10236 94.89766" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><rect x="369" y="162" width="72" height="72" fill="white"/><rect x="369" y="162" width="72" height="72" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(374 167)" fill="black"><tspan font-family="Helvetica" font-size="7" font-weight="500" x="0" y="6" textLength="36.579102">Manages a </tspan><tspan font-family="Helvetica" font-size="7" font-weight="500" x="0" y="14" textLength="38.910156">collection of </tspan><tspan font-family="Helvetica" font-size="7" font-weight="500" x="0" y="22" textLength="59.134277">tiddlers. Plumbs in </tspan><tspan font-familLine truncated
|
||||
|
After Width: | Height: | Size: 31 KiB |
@@ -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"),
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -94,3 +94,7 @@ a.linkInternalResolves {
|
||||
a.linkInternalMissing {
|
||||
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.
|
||||
|
||||
<<tiddler [[High Level Architecture.svg]]>>
|
||||
|
||||
!! 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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user