mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
Add a parser for woff fonts
It's a bit of a hack to have a parser dedicated to fonts. We'll replace it with a mechanism that handles generic binary data
This commit is contained in:
parent
b672e12fef
commit
408fcd8aa3
@ -1235,6 +1235,7 @@ $tw.boot.startup = function() {
|
|||||||
$tw.utils.registerFileType("image/png","base64",".png");
|
$tw.utils.registerFileType("image/png","base64",".png");
|
||||||
$tw.utils.registerFileType("image/gif","base64",".gif");
|
$tw.utils.registerFileType("image/gif","base64",".gif");
|
||||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg");
|
$tw.utils.registerFileType("image/svg+xml","utf8",".svg");
|
||||||
|
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||||
// Create the wiki store for the app
|
// Create the wiki store for the app
|
||||||
$tw.wiki = new $tw.Wiki();
|
$tw.wiki = new $tw.Wiki();
|
||||||
// Install built in tiddler fields modules
|
// Install built in tiddler fields modules
|
||||||
|
28
core/modules/parsers/fontparser.js
Normal file
28
core/modules/parsers/fontparser.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/parsers/fontparser.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: parser
|
||||||
|
|
||||||
|
The font parser parses fonts into URI encoded base64
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var FontParser = function(type,text,options) {
|
||||||
|
this.tree = [{
|
||||||
|
type: "element",
|
||||||
|
tag: "span",
|
||||||
|
children: [
|
||||||
|
{type: "text", text: "data:" + type + ";base64," + text}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["application/font-woff"] = FontParser;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user