First pass at external image support

A bunch of little changes that together enable external image support.
Try:

```
tiddlywiki editions/tw5.com --verbose --build externalimages
```

Then open `externalimages.html`, look for the images in the more/types
tab of the sidebar, open them and verify that they are set with an
external SRC attribute, not a data URI.
This commit is contained in:
Jermolene
2014-06-12 08:36:30 +01:00
parent f131c37893
commit 9547a1f01c
8 changed files with 147 additions and 20 deletions

View File

@@ -711,6 +711,7 @@ Parse a block of text of a specified MIME type
options: see below
Options include:
parseAsInline: if true, the text of the tiddler will be parsed as an inline run
_canonical_uri: optional string of the canonical URI of this content
*/
exports.old_parseText = function(type,text,options) {
options = options || {};
@@ -728,7 +729,8 @@ exports.old_parseText = function(type,text,options) {
// Return the parser instance
return new Parser(type,text,{
parseAsInline: options.parseAsInline,
wiki: this
wiki: this,
_canonical_uri: options._canonical_uri
});
};
@@ -736,11 +738,14 @@ exports.old_parseText = function(type,text,options) {
Parse a tiddler according to its MIME type
*/
exports.old_parseTiddler = function(title,options) {
options = options || {};
options = $tw.utils.extend({},options);
var cacheType = options.parseAsInline ? "newInlineParseTree" : "newBlockParseTree",
tiddler = this.getTiddler(title),
self = this;
return tiddler ? this.getCacheForTiddler(title,cacheType,function() {
if(tiddler.hasField("_canonical_uri")) {
options._canonical_uri = tiddler.fields._canonical_uri;
}
return self.old_parseText(tiddler.fields.type,tiddler.fields.text,options);
}) : null;
};