1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Merge branch 'master' into zh

This commit is contained in:
Bram Chen 2015-09-08 21:10:30 +08:00
commit 8cf02fcb0f
58 changed files with 57 additions and 40 deletions

View File

@ -20,6 +20,7 @@ Encryption/RepeatPassword: Repeat password
Encryption/PasswordNoMatch: Passwords do not match
Encryption/SetPassword: Set password
InvalidFieldName: Illegal characters in field name "<$text text=<<fieldName>>/>". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`)
LazyLoadingWarning: <p>Loading external text from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear you may be using a browser that doesn't support external text in this configuration. See http://tiddlywiki.com/#ExternalText</p>
MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" - click {{$:/core/images/edit-button}} to create
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to plugins to take effect

View File

@ -22,7 +22,7 @@ function Language(options) {
}
/*
Return a single translateable string. The title is automatically prefixed with "$:/language/"
Return a wikified translateable string. The title is automatically prefixed with "$:/language/"
Options include:
variables: optional hashmap of variables to supply to the language wikification
*/
@ -32,6 +32,14 @@ Language.prototype.getString = function(title,options) {
return this.wiki.renderTiddler("text/plain",title,{variables: options.variables});
};
/*
Return a raw, unwikified translateable string. The title is automatically prefixed with "$:/language/"
*/
Language.prototype.getRawString = function(title) {
title = "$:/language/" + title;
return this.wiki.getTiddlerText(title);
};
exports.Language = Language;
})();

View File

@ -28,20 +28,9 @@ var WikiParser = function(type,text,options) {
this.wiki = options.wiki;
var self = this;
// Check for an externally linked tiddler
if($tw.browser && options._canonical_uri) {
$tw.utils.httpRequest({
url: options._canonical_uri,
type: "GET",
callback: function(err,data) {
if(!err) {
var tiddlers = self.wiki.deserializeTiddlers(".tid",data,self.wiki.getCreationFields())
if(tiddlers) {
self.wiki.addTiddlers(tiddlers);
}
}
}
});
text = "Loading external text from ''" + options._canonical_uri + "''\n\nIf this message doesn't disappear you may be using a browser that doesn't support external text in this configuration. See http://tiddlywiki.com/#ExternalText";
if($tw.browser && (text || "") === "" && options._canonical_uri) {
this.loadRemoteTiddler(options._canonical_uri);
text = $tw.language.getRawString("LazyLoadingWarning");
}
// Initialise the classes if we don't have them already
if(!this.pragmaRuleClasses) {
@ -79,6 +68,27 @@ var WikiParser = function(type,text,options) {
// Return the parse tree
};
/*
*/
WikiParser.prototype.loadRemoteTiddler = function(url) {
var self = this;
$tw.utils.httpRequest({
url: url,
type: "GET",
callback: function(err,data) {
if(!err) {
var tiddlers = self.wiki.deserializeTiddlers(".tid",data,self.wiki.getCreationFields());
$tw.utils.each(tiddlers,function(tiddler) {
tiddler["_canonical_uri"] = url;
});
if(tiddlers) {
self.wiki.addTiddlers(tiddlers);
}
}
}
});
};
/*
*/
WikiParser.prototype.setupRules = function(proto,configPrefix) {

View File

@ -3,6 +3,9 @@ title: $:/core/ui/ViewTemplate
\define frame-classes()
tc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$
\end
\define folded-state()
$:/state/folded/$(currentTiddler)$
\end
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/popup/tiddler-info">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
</div>
</$tiddler></$set></$set>

View File

@ -1,10 +1,6 @@
title: $:/core/ui/ViewTemplate/body
tags: $:/tags/ViewTemplate
\define folded-state()
$:/state/folded/$(currentTiddler)$
\end
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" state=<<folded-state>> text="hide" retain="yes" animate="yes">
<$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]]">

View File

@ -1,10 +1,6 @@
title: $:/core/ui/ViewTemplate/subtitle
tags: $:/tags/ViewTemplate
\define folded-state()
$:/state/folded/$(currentTiddler)$
\end
<$reveal type="nomatch" state=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-subtitle">
<$link to={{!!modifier}}>

View File

@ -1,10 +1,6 @@
title: $:/core/ui/ViewTemplate/tags
tags: $:/tags/ViewTemplate
\define folded-state()
$:/state/folded/$(currentTiddler)$
\end
<$reveal type="nomatch" state=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
</$reveal>

View File

@ -70,7 +70,7 @@ For more flexibility the KaTeX widget can also be used via the full widget synta
! Error Handling
An warning message is displayed if KaTeX detects a problem with the ~LaTeX syntax. For example:
Any LaTeX syntax errors are flagged with the problematic syntax highlighted. For example:
```
$$\displaystyle f(x) = \int_{-\infty}^\infinity\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$

View File

@ -59,7 +59,7 @@ See [[Alice in Wonderland]] for an example. Try opening it without a network con
!! Hackability Improvements
* Updated to KaTeX v0.5.0, with [[several new features|https://github.com/Khan/KaTeX/releases/tag/v0.5.0]]
* Updated to KaTeX v0.5.1, with [[several new features|https://github.com/Khan/KaTeX/releases]]
* [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/c4397792f5d396288048bcc3bb4ee8e95dbc2c5e]] added [[recent Operator]]
* [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/e0aacc84d5f084ff7a53153c590fbff3d24f2e2c]] `publishFilter` to default save template
* [[Allow|https://github.com/Jermolene/TiddlyWiki5/commit/7dddc925ae93725552b98bc348a07572895da96c]] ''delete'' button to be used in the tiddler view-mode toolbar

View File

@ -44,6 +44,8 @@ Make sure to include the CSS and font files, but there is no need to include the
You can provide an object of options as the last argument to `katex.render` and `katex.renderToString`. Available options are:
- `displayMode`: `boolean`. If `true` the math will be rendered in display mode, which will put the math in display style (so `\int` and `\sum` are large, for example), and will center the math on the page on its own line. If `false` the math will be rendered in inline mode. (default: `false`)
- `throwOnError`: `boolean`. If `true`, KaTeX will throw a `ParseError` when it encounters an unsupported command. If `false`, KaTeX will render the unsupported command as text in the color given by `errorColor`. (default: `true`)
- `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color which unsupported commands are rendered in. (default: `#cc0000`)
For example:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -35,12 +35,13 @@ KaTeXWidget.prototype.render = function(parent,nextSibling) {
// Get the source text
var text = this.getAttribute("text",this.parseTreeNode.text || "");
// Render it into a span
var span = this.document.createElement("span");
var span = this.document.createElement("span"),
options = {throwOnError: false};
try {
if(!this.document.isTiddlyWikiFakeDom) {
katex.render(text,span);
katex.render(text,span,options);
} else {
span.innerHTML = katex.renderToString(text);
span.innerHTML = katex.renderToString(text,options);
}
} catch(ex) {
span.className = "tc-error";

View File

@ -175,7 +175,7 @@ Slicer.prototype.processNode = function(domNode) {
this.parentStack.push({type: tagName, title: this.addTiddler({
"toc-type": "list",
"toc-list-type": tagName,
"toc-list-filter": "[tag<currentTiddler>!has[draft.of]]",
"toc-list-filter": "[list<currentTiddler>!has[draft.of]]",
text: "",
title: title,
list: [],

View File

@ -1,6 +1,8 @@
title: $:/plugins/tiddlywiki/text-slicer/ui/view-template-segment
tags: $:/tags/ViewTemplate
<$reveal type="nomatch" state=<<folded-state>> text="hide" retain="yes" animate="yes">
<$reveal type="nomatch" state="!!toc-type" text="">
<div class="tc-view-template-document-tiddler-heading">
@ -21,3 +23,4 @@ tags: $:/tags/ViewTemplate
</$reveal>
</$reveal>