mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-25 12:23:42 +00:00
Compare commits
2 Commits
v0.0.1
...
v0.0.2-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6315dbdeb | ||
|
|
dc098044dc |
12
plugins/tiddlywiki/tw2parser/macrodefs.tid
Normal file
12
plugins/tiddlywiki/tw2parser/macrodefs.tid
Normal file
@@ -0,0 +1,12 @@
|
||||
title: $:/plugins/tiddlywiki/tw2parser/macrodefs
|
||||
|
||||
\define tiddler(t)
|
||||
{{$t$}}
|
||||
\end
|
||||
|
||||
\define slider(chkUniqueCookieName tiddler label tooltip)
|
||||
<span title=$tooltip$><$button popup="$chkUniqueCookieName$" class="btn-invisible tw-slider">$label$</$button>
|
||||
<$reveal type="nomatch" text="" default="" state="$chkUniqueCookieName$" animate="yes">
|
||||
{{$tiddler$}}
|
||||
</$reveal></span>
|
||||
\end
|
||||
@@ -60,7 +60,7 @@ var WikiTextParser = function(type,text,options) {
|
||||
this.tree =[];
|
||||
this.output = null;
|
||||
this.subWikify(this.children);
|
||||
var parser = $tw.wiki.old_parseTiddler("$:/plugins/tiddlywiki/tw2parser/macrodefs",{parseAsInline:true});
|
||||
var parser = $tw.wiki.old_parseTiddler("$:/plugins/tiddlywiki/tw2parser/macrodefs",{parseAsInline:false});
|
||||
this.tree = [{
|
||||
type: "element",
|
||||
tag: "div",
|
||||
|
||||
@@ -120,7 +120,8 @@ var insertMacroCall = function(w,output,macroName,paramString) {
|
||||
output.push({
|
||||
type: "macrocall",
|
||||
name: macroName,
|
||||
params: params
|
||||
params: params,
|
||||
isBlock: true
|
||||
});
|
||||
}
|
||||
|
||||
@@ -430,36 +431,41 @@ var rules = [
|
||||
enclosedTextHelper.call(this,w);
|
||||
}
|
||||
},
|
||||
/*
|
||||
|
||||
{
|
||||
name: "typedBlock",
|
||||
match: "^\\$\\$\\$(?:.*)\\n",
|
||||
lookaheadRegExp: /^\$\$\$(.*)\n((?:^[^\n]*\n)+?)(^\f*\$\$\$$\n?)/mg,
|
||||
match: "^\\$\\$\\$(?:[^ >\\r\\n]*)\\r?\\n",
|
||||
lookaheadRegExp: /^\$\$\$([^ >\r\n]*)\n((?:^[^\n]*\r?\n)+?)(^\f*\$\$\$\r?\n?)/mg,
|
||||
//match: "^\\$\\$\\$(?:[^ >\\r\\n]*)(?: *> *([^ \\r\\n]+))?\\r?\\n",
|
||||
//lookaheadRegExp: /^\$\$\$([^ >\r\n]*)(?: *> *([^ \r\n]+))\n((?:^[^\n]*\n)+?)(^\f*\$\$\$$\n?)/mg,
|
||||
handler: function(w)
|
||||
{
|
||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
// The wikitext parsing infrastructure is horribly unre-entrant
|
||||
var mimeType = lookaheadMatch[1],
|
||||
content = lookaheadMatch[2],
|
||||
var parseType = lookaheadMatch[1],
|
||||
renderType ,//= this.match[2],
|
||||
text = lookaheadMatch[2],
|
||||
oldOutput = w.output,
|
||||
oldSource = w.source,
|
||||
oldNextMatch = w.nextMatch,
|
||||
oldChildren = w.children,
|
||||
oldDependencies = w.dependencies,
|
||||
parseTree = w.wiki.parseText(mimeType,content,{defaultType: "text/plain"}).tree;
|
||||
oldChildren = w.children;
|
||||
// Parse the block according to the specified type
|
||||
var parser = $tw.wiki.parseText(parseType,text.toString(),{defaultType: "text/plain"});
|
||||
|
||||
w.output = oldOutput;
|
||||
w.source = oldSource;
|
||||
w.nextMatch = oldNextMatch;
|
||||
w.children = oldChildren;
|
||||
w.dependencies = oldDependencies;
|
||||
w.output.push.apply(w.output,parseTree);
|
||||
for (var i=0; i<parser.tree.length; i++) {
|
||||
w.output.push(parser.tree[i]);
|
||||
}
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
}
|
||||
}
|
||||
},
|
||||
*/
|
||||
|
||||
{
|
||||
name: "wikifyComment",
|
||||
match: "^(?:/\\*\\*\\*|<!---)\\n",
|
||||
@@ -478,10 +484,13 @@ var rules = [
|
||||
{
|
||||
this.lookaheadRegExp.lastIndex = w.matchStart;
|
||||
var lookaheadMatch = this.lookaheadRegExp.exec(w.source),
|
||||
name;
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
|
||||
name = lookaheadMatch[1] || lookaheadMatch[2];
|
||||
if(lookaheadMatch && lookaheadMatch.index == w.matchStart && name) {
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
insertMacroCall(w,w.output,name,lookaheadMatch[3]);
|
||||
if (name) {
|
||||
w.nextMatch = this.lookaheadRegExp.lastIndex;
|
||||
insertMacroCall(w,w.output,name,lookaheadMatch[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user