1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-28 04:55:14 +00:00

Swap over to the new mime type conventions

Discussed in
https://groups.google.com/forum/#!topic/tiddlywikidev/re8xfLqZNCE
This commit is contained in:
Jeremy Ruston
2012-11-18 15:22:13 +00:00
parent 744699fa35
commit 84650b9a54
41 changed files with 49 additions and 49 deletions

View File

@@ -82,7 +82,7 @@ $tw.config.fileExtensionInfo = {
// Content type mappings // Content type mappings
$tw.config.contentTypeInfo = { $tw.config.contentTypeInfo = {
"text/x-tiddlywiki": {encoding: "utf8", extension: ".tid"}, "text/vnd.tiddlywiki": {encoding: "utf8", extension: ".tid"},
"application/x-tiddler": {encoding: "utf8", extension: ".tid"}, "application/x-tiddler": {encoding: "utf8", extension: ".tid"},
"application/x-tiddler-html-div": {encoding: "utf8", extension: ".tiddler"}, "application/x-tiddler-html-div": {encoding: "utf8", extension: ".tiddler"},
"application/x-tiddlywiki-recipe": {encoding: "utf8", extension: ".recipe"}, "application/x-tiddlywiki-recipe": {encoding: "utf8", extension: ".recipe"},

View File

@@ -1,5 +1,5 @@
title: $:/messages/Download title: $:/messages/Download
type: text/x-tiddlywiki type: text/vnd.tiddlywiki
subtitle: Download changes subtitle: Download changes
footer: <<button close class:"btn btn-primary"><Close>> footer: <<button close class:"btn btn-primary"><Close>>
help: http://five.tiddlywiki.com/#help:DownloadingChanges help: http://five.tiddlywiki.com/#help:DownloadingChanges

View File

@@ -1,5 +1,5 @@
title: $:/messages/EnterEditMode title: $:/messages/EnterEditMode
type: text/x-tiddlywiki type: text/vnd.tiddlywiki
subtitle: Editing this wiki subtitle: Editing this wiki
footer: <<button close class:"btn btn-primary"><Close>> footer: <<button close class:"btn btn-primary"><Close>>
help: http://five.tiddlywiki.com/#help:EditMode help: http://five.tiddlywiki.com/#help:EditMode

View File

@@ -1,5 +1,5 @@
title: $:/messages/SaveInstructions title: $:/messages/SaveInstructions
type: text/x-tiddlywiki type: text/vnd.tiddlywiki
subtitle: Save your work subtitle: Save your work
footer: <<button close class:"btn btn-primary"><Close>> footer: <<button close class:"btn btn-primary"><Close>>
help: http://five.tiddlywiki.com/#help:SavingChanges help: http://five.tiddlywiki.com/#help:SavingChanges

View File

@@ -53,7 +53,7 @@ exports.executeMacro = function() {
Editor = this.wiki.macros.edit.editors[tiddler.fields.type]; Editor = this.wiki.macros.edit.editors[tiddler.fields.type];
} }
if(!Editor) { if(!Editor) {
Editor = this.wiki.macros.edit.editors["text/x-tiddlywiki"]; Editor = this.wiki.macros.edit.editors["text/vnd.tiddlywiki"];
} }
this.editor = new Editor(this); this.editor = new Editor(this);
// Call the editor to generate the child nodes // Call the editor to generate the child nodes

View File

@@ -145,7 +145,7 @@ TextEditor.prototype.refreshInDom = function() {
this.fixHeight(); this.fixHeight();
}; };
exports["text/x-tiddlywiki"] = TextEditor; exports["text/vnd.tiddlywiki"] = TextEditor;
exports["text/plain"] = TextEditor; exports["text/plain"] = TextEditor;
})(); })();

View File

@@ -102,7 +102,7 @@ exports.getTiddlerList = function() {
Create and execute the nodes representing the empty message Create and execute the nodes representing the empty message
*/ */
exports.getEmptyMessage = function() { exports.getEmptyMessage = function() {
var nodes = this.wiki.parseText("text/x-tiddlywiki",this.params.emptyMessage).tree; var nodes = this.wiki.parseText("text/vnd.tiddlywiki",this.params.emptyMessage).tree;
for(var c=0; c<nodes.length; c++) { for(var c=0; c<nodes.length; c++) {
nodes[c].execute(this.parents,this.tiddlerTitle); nodes[c].execute(this.parents,this.tiddlerTitle);
} }

View File

@@ -99,7 +99,7 @@ exports.executeMacro = function() {
} }
// Get the render tree for the template // Get the render tree for the template
if(this.hasParameter("templateText")) { if(this.hasParameter("templateText")) {
renderTemplateTree = this.wiki.parseText("text/x-tiddlywiki",this.params.templateText).tree; renderTemplateTree = this.wiki.parseText("text/vnd.tiddlywiki",this.params.templateText).tree;
} else { } else {
if(this.hasParameter("template")) { if(this.hasParameter("template")) {
renderTemplateTitle = this.params.template; renderTemplateTitle = this.params.template;

View File

@@ -32,7 +32,7 @@ WikifiedViewer.prototype.render = function() {
parents = parents.slice(0); parents = parents.slice(0);
parents.push(this.tiddler.fields.title); parents.push(this.tiddler.fields.title);
} else { } else {
children = this.viewMacro.wiki.parseText("text/x-tiddlywiki",this.value).tree; children = this.viewMacro.wiki.parseText("text/vnd.tiddlywiki",this.value).tree;
} }
// Clone and execute the parsed wikitext // Clone and execute the parsed wikitext
for(t=0; t<children.length; t++) { for(t=0; t<children.length; t++) {

View File

@@ -63,13 +63,13 @@ JavaScriptParser.prototype.parse = function(type,code) {
element = "div"; element = "div";
classes.push("javascript-block-comment"); classes.push("javascript-block-comment");
content.push($tw.Tree.Text("/*")); content.push($tw.Tree.Text("/*"));
content.push.apply(content,self.wiki.parseText("text/x-tiddlywiki",text).tree); content.push.apply(content,self.wiki.parseText("text/vnd.tiddlywiki",text).tree);
content.push($tw.Tree.Text("*/")); content.push($tw.Tree.Text("*/"));
} else { } else {
element = "span"; element = "span";
classes.push("javascript-line-comment"); classes.push("javascript-line-comment");
content.push($tw.Tree.Text("//")); content.push($tw.Tree.Text("//"));
content.push.apply(content,self.wiki.parseText("text/x-tiddlywiki-run",text).tree); content.push.apply(content,self.wiki.parseText("text/vnd.tiddlywiki-run",text).tree);
content.push($tw.Tree.Text("\n")); content.push($tw.Tree.Text("\n"));
} }
result.push($tw.Tree.Element(element,{"class": classes},content)); result.push($tw.Tree.Element(element,{"class": classes},content));

View File

@@ -58,7 +58,7 @@ TiddlyTextParser.prototype.parse = function(type,text) {
return new $tw.Renderer(output,dependencies); return new $tw.Renderer(output,dependencies);
}; };
exports["text/x-tiddlywiki-css"] = TiddlyTextParser; exports["text/vnd.tiddlywiki-css"] = TiddlyTextParser;
exports["text/x-tiddlywiki-html"] = TiddlyTextParser; exports["text/vnd.tiddlywiki-html"] = TiddlyTextParser;
})(); })();

View File

@@ -288,12 +288,12 @@ WikiTextParser.prototype.parse = function(type,text) {
return new WikiTextRenderer(text,{ return new WikiTextRenderer(text,{
wiki: this.wiki, wiki: this.wiki,
parser: this, parser: this,
isRun: type === "text/x-tiddlywiki-run" isRun: type === "text/vnd.tiddlywiki-run"
}); });
}; };
exports["text/x-tiddlywiki"] = WikiTextParser; exports["text/vnd.tiddlywiki"] = WikiTextParser;
exports["text/x-tiddlywiki-run"] = WikiTextParser; exports["text/vnd.tiddlywiki-run"] = WikiTextParser;
})(); })();

View File

@@ -61,7 +61,7 @@ Modal.prototype.display = function(title,options) {
} else { } else {
titleText = title; titleText = title;
} }
var headerRenderer = this.wiki.parseText("text/x-tiddlywiki-run",titleText); var headerRenderer = this.wiki.parseText("text/vnd.tiddlywiki-run",titleText);
headerRenderer.execute([],title); headerRenderer.execute([],title);
headerRenderer.renderInDom(headerTitle); headerRenderer.renderInDom(headerTitle);
this.wiki.addEventListener("",function(changes) { this.wiki.addEventListener("",function(changes) {
@@ -95,7 +95,7 @@ Modal.prototype.display = function(title,options) {
} else { } else {
footerText = "<<button close class:'btn btn-primary'><Close>>"; footerText = "<<button close class:'btn btn-primary'><Close>>";
} }
var footerRenderer = this.wiki.parseText("text/x-tiddlywiki-run",footerText); var footerRenderer = this.wiki.parseText("text/vnd.tiddlywiki-run",footerText);
footerRenderer.execute([],title); footerRenderer.execute([],title);
footerRenderer.renderInDom(modalFooterButtons); footerRenderer.renderInDom(modalFooterButtons);
this.wiki.addEventListener("",function(changes) { this.wiki.addEventListener("",function(changes) {

View File

@@ -397,7 +397,7 @@ exports.initParsers = function(moduleType) {
} }
}); });
// Install the rules for the old wikitext parser rules // Install the rules for the old wikitext parser rules
var wikitextparser = this.parsers["text/x-tiddlywiki-old"]; var wikitextparser = this.parsers["text/vnd.tiddlywiki2"];
if(wikitextparser) { if(wikitextparser) {
wikitextparser.installRules(); wikitextparser.installRules();
} }
@@ -418,7 +418,7 @@ exports.parseText = function(type,text,options) {
parser = this.parsers[$tw.config.fileExtensionInfo[type].type]; parser = this.parsers[$tw.config.fileExtensionInfo[type].type];
} }
if(!parser) { if(!parser) {
parser = this.parsers[options.defaultType || "text/x-tiddlywiki"]; parser = this.parsers[options.defaultType || "text/vnd.tiddlywiki"];
} }
if(!parser) { if(!parser) {
return null; return null;

View File

@@ -1,5 +1,5 @@
title: $:/templates/StaticContent title: $:/templates/StaticContent
type: text/x-tiddlywiki type: text/vnd.tiddlywiki
<<! For Google, and people without JavaScript >> <<! For Google, and people without JavaScript >>
((( [!is[shadow]sort[title]] )) <div><<view title text>></div> ) ((( [!is[shadow]sort[title]] )) <div><<view title text>></div> )

View File

@@ -1,5 +1,5 @@
title: $:/core/templates/static.template.html title: $:/core/templates/static.template.html
type: text/x-tiddlywiki-html type: text/vnd.tiddlywiki-html
<!doctype html> <!doctype html>
<head> <head>

View File

@@ -1,5 +1,5 @@
title: $:/core/templates/tiddlywiki5.encrypted.template.html title: $:/core/templates/tiddlywiki5.encrypted.template.html
type: text/x-tiddlywiki-html type: text/vnd.tiddlywiki-html
<!doctype html> <!doctype html>
<head> <head>

View File

@@ -1,5 +1,5 @@
title: $:/core/templates/tiddlywiki5.template.html title: $:/core/templates/tiddlywiki5.template.html
type: text/x-tiddlywiki-html type: text/vnd.tiddlywiki-html
<!doctype html> <!doctype html>
<head> <head>

View File

@@ -1,4 +1,4 @@
title: $:/core/wiki/title title: $:/core/wiki/title
type: text/x-tiddlywiki type: text/vnd.tiddlywiki
<<tiddler SiteTitle>> --- <<tiddler SiteSubtitle>> <<tiddler SiteTitle>> --- <<tiddler SiteSubtitle>>

View File

@@ -1,5 +1,5 @@
title: $:/core/templates/tiddlywiki2.template.html title: $:/core/templates/tiddlywiki2.template.html
type: text/x-tiddlywiki-html type: text/vnd.tiddlywiki-html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

View File

@@ -1,7 +1,7 @@
title: HelloThere title: HelloThere
modifier: JeremyRuston modifier: JeremyRuston
tags: introduction greetings tags: introduction greetings
type: text/x-tiddlywiki type: text/vnd.tiddlywiki
modified: 201208121934 modified: 201208121934
Welcome to TiddlyWiki5, a reboot of TiddlyWiki, the reusable non-linear personal web notebook [[first released in 2004|History]]. It is a complete interactive wiki in JavaScript that can be run from a single HTML file in the browser or as a powerful [[node.js application|node.js]]. Welcome to TiddlyWiki5, a reboot of TiddlyWiki, the reusable non-linear personal web notebook [[first released in 2004|History]]. It is a complete interactive wiki in JavaScript that can be run from a single HTML file in the browser or as a powerful [[node.js application|node.js]].

View File

@@ -6,7 +6,7 @@ tags: docs internals
The heart of TiddlyWiki can be seen as an extensible representation transformation engine. Given the text of a tiddler and its associated ContentType, the engine can produce a rendering of the tiddler in a new ContentType. Furthermore, it can efficiently selectively update the rendering to track any changes in the tiddler or its dependents. The heart of TiddlyWiki can be seen as an extensible representation transformation engine. Given the text of a tiddler and its associated ContentType, the engine can produce a rendering of the tiddler in a new ContentType. Furthermore, it can efficiently selectively update the rendering to track any changes in the tiddler or its dependents.
The most important transformations are from `text/x-tiddlywiki` wikitext into `text/html` or `text/plain` but the engine is used throughout the system for other transformations, such as converting images for display in HTML, sanitising fragments of JavaScript, and processing CSS. The most important transformations are from `text/vnd.tiddlywiki` wikitext into `text/html` or `text/plain` but the engine is used throughout the system for other transformations, such as converting images for display in HTML, sanitising fragments of JavaScript, and processing CSS.
You can explore this mechanism by opening the JavaScript console in your browser. Typing this command will replace the text of the tiddler `HelloThere` with new content: You can explore this mechanism by opening the JavaScript console in your browser. Typing this command will replace the text of the tiddler `HelloThere` with new content:

View File

@@ -1,5 +1,5 @@
title: WikiText title: WikiText
type: text/x-tiddlywiki type: text/vnd.tiddlywiki
tags: docs concepts tags: docs concepts
WikiText is a concise, expressive way of typing a wide range of text formatting, hypertext and interactive features. It allows you to focus on writing without a complex user interface getting in the way. It is somewhat similar to [[MarkDown|http://daringfireball.net/projects/markdown/]], but with more of a focus on linking and the interactive features. WikiText is a concise, expressive way of typing a wide range of text formatting, hypertext and interactive features. It allows you to focus on writing without a complex user interface getting in the way. It is somewhat similar to [[MarkDown|http://daringfireball.net/projects/markdown/]], but with more of a focus on linking and the interactive features.

View File

@@ -13,13 +13,13 @@ The parse tree is built when needed, and then cached by the WikiStore until the
TiddlyWiki5 uses multiple parsers: TiddlyWiki5 uses multiple parsers:
* Wikitext ({{{text/x-tiddlywiki}}}) in `js/WikiTextParser.js` * Wikitext ({{{text/vnd.tiddlywiki}}}) in `js/WikiTextParser.js`
* JavaScript ({{{text/javascript}}}) in `js/JavaScriptParser.js` * JavaScript ({{{text/javascript}}}) in `js/JavaScriptParser.js`
* Images ({{{image/png}}} and {{{image/jpg}}}) in `js/ImageParser.js` * Images ({{{image/png}}} and {{{image/jpg}}}) in `js/ImageParser.js`
* JSON ({{{application/json}}}) in `js/JSONParser.js` * JSON ({{{application/json}}}) in `js/JSONParser.js`
Additional parsers are planned: Additional parsers are planned:
* CSS ({{{text/css}}}) * CSS ({{{text/css}}})
* Recipe ({{{text/x-tiddlywiki-recipe}}}) * Recipe ({{{text/vnd.tiddlywiki-recipe}}})
One global instance of each parser is instantiated in `js/App.js` and registered with the main WikiStore object. One global instance of each parser is instantiated in `js/App.js` and registered with the main WikiStore object.

View File

@@ -1,5 +1,5 @@
title: $:/plugins/dropbox/index.template.html title: $:/plugins/dropbox/index.template.html
type: text/x-tiddlywiki-html type: text/vnd.tiddlywiki-html
<!doctype html> <!doctype html>
<head> <head>

View File

@@ -1,5 +1,5 @@
title: $:/plugins/dropbox/styles.template.css title: $:/plugins/dropbox/styles.template.css
type: text/x-tiddlywiki-html type: text/vnd.tiddlywiki-html
/* utf8beacon: éçñøåá— */ /* utf8beacon: éçñøåá— */
<<serialize "[is[shadow]type[text/css]]" text/plain>> <<serialize "[is[shadow]type[text/css]]" text/plain>>

View File

@@ -1,5 +1,5 @@
title: $:/plugins/dropbox/tw5dropbox.template.js title: $:/plugins/dropbox/tw5dropbox.template.js
type: text/x-tiddlywiki-html type: text/vnd.tiddlywiki-html
/* utf8beacon: éçñøåá— */ /* utf8beacon: éçñøåá— */
<<serialize "[is[shadow]type[application/javascript]library[yes]] -[[$:/library/sjcl.js]]" text/plain>> <<serialize "[is[shadow]type[application/javascript]library[yes]] -[[$:/library/sjcl.js]]" text/plain>>

View File

@@ -1,7 +1,7 @@
title: HelloThere title: HelloThere
modifier: JeremyRuston modifier: JeremyRuston
tags: introduction greetings tags: introduction greetings
type: text/x-tiddlywiki type: text/vnd.tiddlywiki
Welcome to TiddlyWiki5, a reboot of TiddlyWiki, the reusable non-linear personal web notebook [[first released in 2004|History]]. It is a complete interactive wiki in JavaScript that can be run from a single HTML file in the browser or as a powerful [[node.js application|node.js]]. Welcome to TiddlyWiki5, a reboot of TiddlyWiki, the reusable non-linear personal web notebook [[first released in 2004|History]]. It is a complete interactive wiki in JavaScript that can be run from a single HTML file in the browser or as a powerful [[node.js application|node.js]].

View File

@@ -1,5 +1,5 @@
title: $:/plugins/dropbox/index.template.html title: $:/plugins/dropbox/index.template.html
type: text/x-tiddlywiki-html type: text/vnd.tiddlywiki-html
<!doctype html> <!doctype html>
<head> <head>

View File

@@ -424,7 +424,7 @@ $tw.plugins.dropbox.syncChanges = function(changes,wiki) {
var tiddler = wiki.getTiddler(title), var tiddler = wiki.getTiddler(title),
filename = $tw.plugins.dropbox.titleInfo[title], filename = $tw.plugins.dropbox.titleInfo[title],
contentType = tiddler ? tiddler.fields.type : null; contentType = tiddler ? tiddler.fields.type : null;
contentType = contentType || "text/x-tiddlywiki"; contentType = contentType || "text/vnd.tiddlywiki";
var contentTypeInfo = $tw.config.contentTypeInfo[contentType], var contentTypeInfo = $tw.config.contentTypeInfo[contentType],
isNew = false; isNew = false;
// Figure out the pathname of the tiddler // Figure out the pathname of the tiddler
@@ -436,7 +436,7 @@ $tw.plugins.dropbox.syncChanges = function(changes,wiki) {
} }
// Push the appropriate task // Push the appropriate task
if(tiddler) { if(tiddler) {
if(contentType === "text/x-tiddlywiki") { if(contentType === "text/vnd.tiddlywiki") {
// .tid file // .tid file
q.push({ q.push({
type: "save", type: "save",

View File

@@ -219,7 +219,7 @@ TiddlyWebSyncer.prototype.convertTiddler = function(tiddlerFields) {
if(result.type === "text/javascript") { if(result.type === "text/javascript") {
result.type = "application/javascript"; result.type = "application/javascript";
} else if(!result.type || result.type === "None") { } else if(!result.type || result.type === "None") {
result.type = "text/x-tiddlywiki-old"; result.type = "text/vnd.tiddlywiki2";
} }
return result; return result;
}; };

View File

@@ -183,6 +183,6 @@ WikiTextParser.prototype.subWikifyTerm = function(output,terminatorRegExp) {
this.output = oldOutput; this.output = oldOutput;
}; };
exports["text/x-tiddlywiki-old"] = WikiTextParser; exports["text/vnd.tiddlywiki2"] = WikiTextParser;
})(); })();

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
title: EighthTiddler title: EighthTiddler
type: text/x-tiddlywiki-old type: text/vnd.tiddlywiki2
<<tiddler SixthTiddler>> <<tiddler SixthTiddler>>
<<tiddler target:SixthTiddler>> <<tiddler target:SixthTiddler>>

View File

@@ -1,5 +1,5 @@
title: Fifth Tiddler title: Fifth Tiddler
type: text/x-tiddlywiki-old type: text/vnd.tiddlywiki2
|A caption above the table|c |A caption above the table|c
| Left | Middle | Right |h | Left | Middle | Right |h

View File

@@ -1,4 +1,4 @@
title: FirstTiddler title: FirstTiddler
type: text/x-tiddlywiki-old type: text/vnd.tiddlywiki2
This is the ''text'' of the first tiddler, with a @@font-size:8em;color:red;link@@ to the SecondTiddler, too. And a link to http://tiddlywiki.com/. This is the ''text'' of the first tiddler, with a @@font-size:8em;color:red;link@@ to the SecondTiddler, too. And a link to http://tiddlywiki.com/.

View File

@@ -1,4 +1,4 @@
title: Fourth Tiddler title: Fourth Tiddler
type: text/x-tiddlywiki-old type: text/vnd.tiddlywiki2
A missing image [img[Something.jpg]] and a $1 couple of &#xc7; &#199; &quot;HTML Entity&quot; A missing image [img[Something.jpg]] and a $1 couple of &#xc7; &#199; &quot;HTML Entity&quot;

View File

@@ -1,5 +1,5 @@
title: SecondTiddler title: SecondTiddler
type: text/x-tiddlywiki-old type: text/vnd.tiddlywiki2
!!Heading !!Heading
This is the second tiddler. It has a list: This is the second tiddler. It has a list:

View File

@@ -1,5 +1,5 @@
title: SeventhTiddler title: SeventhTiddler
type: text/x-tiddlywiki-old type: text/vnd.tiddlywiki2
<<echo {{2+2}}>> <<echo {{2+2}}>>

View File

@@ -1,5 +1,5 @@
title: SixthTiddler title: SixthTiddler
type: text/x-tiddlywiki-old type: text/vnd.tiddlywiki2
modified: 20110211110621 modified: 20110211110621
modifier: Jermolene modifier: Jermolene

View File

@@ -1,5 +1,5 @@
title: ThirdTiddler title: ThirdTiddler
type: text/x-tiddlywiki-old type: text/vnd.tiddlywiki2
An explicit link [[Fourth Tiddler]] and [[a pretty link|Fourth Tiddler]] and a transclusion <<tiddler [[Fourth Tiddler]] with:Stringy>> An explicit link [[Fourth Tiddler]] and [[a pretty link|Fourth Tiddler]] and a transclusion <<tiddler [[Fourth Tiddler]] with:Stringy>>