kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Added tags and color macros
Which enables us to do nice colour coded tags. Soon they'll have a drop down on them tooprint-window-tiddler
rodzic
2d94e466ae
commit
fc49d7dffd
|
@ -0,0 +1,41 @@
|
||||||
|
/*\
|
||||||
|
title: $:/core/modules/macros/color.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: macro
|
||||||
|
|
||||||
|
Color macro.
|
||||||
|
|
||||||
|
Applies the specified colour to its content. By default, the colour value is obtained from the `color` field of the current tiddler
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.info = {
|
||||||
|
name: "color",
|
||||||
|
params: {
|
||||||
|
"default": {byName: "default", type: "text"},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.executeMacro = function() {
|
||||||
|
var tiddler = this.wiki.getTiddler(this.tiddlerTitle),
|
||||||
|
attributes = {
|
||||||
|
style: {
|
||||||
|
"background-color": (tiddler && tiddler.fields.color) || this.params["default"]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(this.classes) {
|
||||||
|
attributes["class"] = this.classes.slice(0);
|
||||||
|
}
|
||||||
|
for(var t=0; t<this.content.length; t++) {
|
||||||
|
this.content[t].execute(this.parents,this.tiddlerTitle);
|
||||||
|
}
|
||||||
|
return $tw.Tree.Element("span",attributes,this.content);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
})();
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*\
|
||||||
|
title: $:/core/modules/macros/tags.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: macro
|
||||||
|
|
||||||
|
Implements the tags macro.
|
||||||
|
|
||||||
|
{{{
|
||||||
|
<<tags template:MyTagTemplate>>
|
||||||
|
}}}
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.info = {
|
||||||
|
name: "tags",
|
||||||
|
dependentOnContextTiddler: true,
|
||||||
|
params: {
|
||||||
|
template: {byName: true, type: "tiddler"},
|
||||||
|
filter: {byName: true, type: "filter"}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.executeMacro = function() {
|
||||||
|
var tiddler = this.wiki.getTiddler(this.tiddlerTitle),
|
||||||
|
child = $tw.Tree.Element("div",{"class":"tw-tags-wrapper"},[]);
|
||||||
|
if(tiddler && tiddler.fields.tags) {
|
||||||
|
for(var t=0; t<tiddler.fields.tags.length; t++) {
|
||||||
|
var tag = tiddler.fields.tags[t];
|
||||||
|
child.children.push($tw.Tree.Macro("tiddler",{
|
||||||
|
srcParams: {target: tag,template: this.params.template},
|
||||||
|
wiki: this.wiki,
|
||||||
|
isBlock: false
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
child.execute(this.parents,this.tiddlerTitle);
|
||||||
|
return child;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
|
@ -124,7 +124,7 @@ exports.executeMacro = function() {
|
||||||
attributes["class"].push("tw-tiddler-missing");
|
attributes["class"].push("tw-tiddler-missing");
|
||||||
}
|
}
|
||||||
// Return the children
|
// Return the children
|
||||||
return $tw.Tree.Element("div",attributes,childrenClone);
|
return $tw.Tree.Element(this.isBlock ? "div" : "span",attributes,childrenClone);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.refreshInDom = function(changes) {
|
exports.refreshInDom = function(changes) {
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
title: $:/templates/TagTemplate
|
||||||
|
|
||||||
|
{{label{
|
||||||
|
<<color background:yes default:#888><<<view title>>>>
|
||||||
|
}}}
|
|
@ -5,7 +5,8 @@ modifier: JeremyRuston
|
||||||
<div><span><<view title>></span><<button EditTiddler class:"btn btn-mini"><edit>></div>
|
<div><span><<view title>></span><<button EditTiddler class:"btn btn-mini"><edit>></div>
|
||||||
}}}
|
}}}
|
||||||
{{small{
|
{{small{
|
||||||
<div><<view modifier link>> <<view modified date>> <<view tags>> </div>
|
<div><<view modifier link>> <<view modified date>></div>
|
||||||
|
<<tags template:"$:/templates/TagTemplate">>
|
||||||
}}}
|
}}}
|
||||||
{{body{
|
{{body{
|
||||||
<<view text wikified>>
|
<<view text wikified>>
|
||||||
|
|
|
@ -55,6 +55,8 @@ tags: docs
|
||||||
* SliderMacro
|
* SliderMacro
|
||||||
* ZoomerMacro
|
* ZoomerMacro
|
||||||
* ChooserMacro
|
* ChooserMacro
|
||||||
|
* TagsMacro
|
||||||
|
* ColorMacro
|
||||||
|
|
||||||
! Commands
|
! Commands
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
title: Improvements
|
||||||
|
tags: docs introduction
|
||||||
|
|
||||||
|
The following features have been improved in TiddlyWiki5:
|
||||||
|
|
||||||
|
* TiddlyWiki can now be run under [[node.js|nodejs.org]] as well as in the browser
|
||||||
|
* TiddlyWiki is structured as a 600-line boot kernel, with everything else implemented as plugins
|
||||||
|
* Improved WikiText, with much better generation of HTML, including proper `<p>` tags
|
||||||
|
* Tiddlers containing images are now supported just like WikiText tiddlers, including integrated editing of bitmap and SVG images
|
||||||
|
* Use of Twitter Bootstrap stylesheet (also enabling the use of Boostrap themes such as http://bootswatch.com)
|
||||||
|
* Syntax highlighting for JavaScript and JSON tiddlers
|
||||||
|
* TiddlyWiki5 can directly build both itself and previous (2.6.x) versions of TiddlyWiki from their constituent separate files, without needing external tools
|
|
@ -1,5 +1,5 @@
|
||||||
title: TiddlerFilters
|
title: TiddlerFilters
|
||||||
tags: feature
|
tags: docs concepts
|
||||||
|
|
||||||
TiddlyWiki has a special syntax for expressing filters. They can be used to select tiddlers for an operation, or to filter a set of tiddlers to add or remove members.
|
TiddlyWiki has a special syntax for expressing filters. They can be used to select tiddlers for an operation, or to filter a set of tiddlers to add or remove members.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
title: TiddlyWiki
|
title: TiddlyWiki
|
||||||
modifier: JeremyRuston
|
modifier: JeremyRuston
|
||||||
modified: 20120211110622
|
modified: 20120211110622
|
||||||
tag: docs concepts
|
tags: docs concepts
|
||||||
|
|
||||||
TiddlyWiki is a rich, interactive interface for manipulating complex data with structure that doesn't easily fit into conventional tools like spreadsheets or wordprocessors.
|
TiddlyWiki is a rich, interactive interface for manipulating complex data with structure that doesn't easily fit into conventional tools like spreadsheets or wordprocessors.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
title: WikiText
|
title: WikiText
|
||||||
type: text/x-tiddlywiki
|
type: text/x-tiddlywiki
|
||||||
tags: concepts
|
tags: docs concepts
|
||||||
|
|
||||||
WikiText is a concise, expressive way of typing a wide range of text formatting and hypertext features. Operations like linking become part of the punctuation of your writing.
|
WikiText is a concise, expressive way of typing a wide range of text formatting and hypertext features. Operations like linking become part of the punctuation of your writing.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
title: concepts
|
||||||
|
color: #800
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
title: docs
|
||||||
|
color: #008
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
title: introduction
|
||||||
|
color: #840
|
||||||
|
|
|
@ -5,6 +5,7 @@ type: application/json
|
||||||
"tiddlers": [
|
"tiddlers": [
|
||||||
{"title": "HelloThere", "template": "$:/templates/ViewTemplate"},
|
{"title": "HelloThere", "template": "$:/templates/ViewTemplate"},
|
||||||
{"title": "Introduction", "template": "$:/templates/ViewTemplate"},
|
{"title": "Introduction", "template": "$:/templates/ViewTemplate"},
|
||||||
|
{"title": "Improvements", "template": "$:/templates/ViewTemplate"},
|
||||||
{"title": "Docs", "template": "$:/templates/ViewTemplate"}
|
{"title": "Docs", "template": "$:/templates/ViewTemplate"}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -27,6 +27,10 @@ body {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tw-tags-wrapper .label {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.tw-edit-field {
|
.tw-edit-field {
|
||||||
border: 1px dotted #888;
|
border: 1px dotted #888;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue