1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Merge remote-tracking branch 'upstream/master' into fred

This commit is contained in:
Xavier Cazin 2014-12-12 09:19:24 +01:00
commit 6a8c0a25b5
11 changed files with 89 additions and 37 deletions

View File

@ -1,13 +0,0 @@
title: GettingStarted
Welcome to TiddlyWiki, the non-linear personal web notebook.
To get started, first verify that you can save changes successfully - see http://tiddlywiki.com/ for detailed instructions.
Then you can:
* Create new tiddlers using the 'plus' button in the sidebar
* Visit the [[control panel|$:/ControlPanel]] using the 'cog' button in the sidebar to customise your wiki
** Stop this message appearing by changing the default tiddlers under the ''Basics'' tab
* Save changes using the 'download' button in the sidebar
* Learn more about [[WikiText|http://tiddlywiki.com/static/WikiText.html]]

View File

@ -0,0 +1,20 @@
title: GettingStarted (Step 1)
tags: $:/tags/GettingStarted
caption: Step 1<br>Saving
! Saving Changes
Before you can start storing important information in ~TiddlyWiki it is important to make sure that you can reliably save changes.
# Create a new tiddler using the {{$:/core/images/new-button}} button in the sidebar on the right
# Click the {{$:/core/images/done-button}} button at the top right of the new tiddler
# Click the red {{$:/core/images/save-button}} in the sidebar on the right
What happens next will depend on how you've set up ~TiddlyWiki:
* If you've installed the ~TiddlyFox add-on for Firefox, your changes should immediately be saved back to the file
* If you're running ~TiddlyDesktop, again the changes will be saved instantly
* If you're using Chrome, you'll need to follow the [ext[instructions on tiddlywiki.com|http://tiddlywiki.com#GettingStarted%20-%20Chrome]]
* For other browsers, see the relevant [ext[instructions on tiddlywiki.com|http://tiddlywiki.com#GettingStarted]]
Finally, refresh the page in the browser to and verify that the new tiddler has been correctly saved.

View File

@ -0,0 +1,11 @@
title: GettingStarted (Step 2)
tags: $:/tags/GettingStarted
caption: Step 2<br>Customising
! Customising your ~TiddlyWiki
~TiddlyWiki's great strength is the ability to customise it
# Click the {{$:/core/images/options-button}} button in the sidebar on the right to bring up the control panel
# Enter text for the site title and subtitle
# Remove this "~GettingStarted" tiddler by editing the default tiddlers in the ''Basics'' tab

View File

@ -0,0 +1,7 @@
title: GettingStarted
Welcome to ~TiddlyWiki and the ~TiddlyWiki community
Visit http://tiddlywiki.com/ to find out more about ~TiddlyWiki and what it can do.
<<tabs "[all[shadows+tiddlers]tag[$:/tags/GettingStarted]!has[draft.of]]" "GettingStarted (Step 1)" "$:/state/tabs/gettingstarted" "tc-vertical">>

View File

@ -26,7 +26,7 @@ Command.prototype.execute = function() {
var fs = require("fs"), var fs = require("fs"),
path = require("path"); path = require("path");
// Check that we don't already have a valid wiki folder // Check that we don't already have a valid wiki folder
if($tw.boot.wikiTiddlersPath) { if($tw.boot.wikiTiddlersPath || ($tw.utils.isDirectory($tw.boot.wikiPath) && !$tw.utils.isDirectoryEmpty($tw.boot.wikiPath))) {
return "Wiki folder is not empty"; return "Wiki folder is not empty";
} }
// Loop through each of the specified editions // Loop through each of the specified editions

View File

@ -26,6 +26,8 @@ exports.field = function(source,operator,options) {
if(text !== null && !operator.regexp.exec(text)) { if(text !== null && !operator.regexp.exec(text)) {
results.push(title); results.push(title);
} }
} else {
results.push(title);
} }
}); });
} else { } else {
@ -35,6 +37,8 @@ exports.field = function(source,operator,options) {
if(text !== null && text !== operator.operand) { if(text !== null && text !== operator.operand) {
results.push(title); results.push(title);
} }
} else {
results.push(title);
} }
}); });
} }

View File

@ -19,7 +19,7 @@ exports.has = function(source,operator,options) {
var results = []; var results = [];
if(operator.prefix === "!") { if(operator.prefix === "!") {
source(function(tiddler,title) { source(function(tiddler,title) {
if(tiddler && (!$tw.utils.hop(tiddler.fields,operator.operand) || tiddler.fields[operator.operand] === "")) { if(!tiddler || (tiddler && (!$tw.utils.hop(tiddler.fields,operator.operand) || tiddler.fields[operator.operand] === ""))) {
results.push(title); results.push(title);
} }
}); });

View File

@ -139,4 +139,21 @@ exports.isDirectory = function(dirPath) {
return fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory(); return fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory();
}; };
/*
Check if a path identifies a directory that is empty
*/
exports.isDirectoryEmpty = function(dirPath) {
if(!$tw.utils.isDirectory(dirPath)) {
return false;
}
var files = fs.readdirSync(dirPath),
empty = true;
$tw.utils.each(files,function(file,index) {
if(file.charAt(0) !== ".") {
empty = false;
}
});
return empty;
};
})(); })();

View File

@ -1,15 +1,21 @@
title: $:/core/macros/toc title: $:/core/macros/toc
tags: $:/tags/Macro tags: $:/tags/Macro
\define toc-caption()
<$set name="tv-wikilinks" value="no">
<$transclude field="caption">
<$view field="title"/>
</$transclude>
</$set>
\end
\define toc-body(rootTag,tag,sort:"",itemClassFilter) \define toc-body(rootTag,tag,sort:"",itemClassFilter)
<ol class="tc-toc"> <ol class="tc-toc">
<$list filter="""[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$]"""> <$list filter="""[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$]""">
<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item"> <$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item">
<li class=<<toc-item-class>>> <li class=<<toc-item-class>>>
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link><$view field='caption'><$view field='title'/></$view></$link>"> <$list filter="[all[current]toc-link[no]]" emptyMessage="<$link><$view field='caption'><$view field='title'/></$view></$link>">
<$transclude field="caption"> <<toc-caption>>
<$view field="title"/>
</$transclude>
</$list> </$list>
<$list filter="""[all[current]] -[[$rootTag$]]"""> <$list filter="""[all[current]] -[[$rootTag$]]""">
<$macrocall $name="toc-body" rootTag="""$rootTag$""" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/> <$macrocall $name="toc-body" rootTag="""$rootTag$""" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
@ -39,9 +45,7 @@ tags: $:/tags/Macro
{{$:/core/images/down-arrow}} {{$:/core/images/down-arrow}}
</$button> </$button>
</$reveal> </$reveal>
<$transclude field="caption"> <<toc-caption>>
<$view field="title"/>
</$transclude>
</$link> </$link>
<$reveal type="match" state=<<toc-state>> text="open"> <$reveal type="match" state=<<toc-state>> text="open">
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/> <$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
@ -58,17 +62,13 @@ tags: $:/tags/Macro
<$reveal type="nomatch" state=<<toc-state>> text="open"> <$reveal type="nomatch" state=<<toc-state>> text="open">
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible"> <$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
{{$:/core/images/right-arrow}} {{$:/core/images/right-arrow}}
<$transclude field="caption"> <<toc-caption>>
<$view field="title"/>
</$transclude>
</$button> </$button>
</$reveal> </$reveal>
<$reveal type="match" state=<<toc-state>> text="open"> <$reveal type="match" state=<<toc-state>> text="open">
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible"> <$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
{{$:/core/images/down-arrow}} {{$:/core/images/down-arrow}}
<$transclude field="caption"> <<toc-caption>>
<$view field="title"/>
</$transclude>
</$button> </$button>
</$reveal> </$reveal>
<$reveal type="match" state=<<toc-state>> text="open"> <$reveal type="match" state=<<toc-state>> text="open">
@ -106,9 +106,7 @@ tags: $:/tags/Macro
</$button> </$button>
</$reveal> </$reveal>
</$list> </$list>
<$transclude field="caption"> <<toc-caption>>
<$view field="title"/>
</$transclude>
</$link> </$link>
<$reveal type="match" state=<<toc-state>> text="open"> <$reveal type="match" state=<<toc-state>> text="open">
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/> <$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
@ -126,17 +124,13 @@ tags: $:/tags/Macro
<$reveal type="nomatch" state=<<toc-state>> text="open"> <$reveal type="nomatch" state=<<toc-state>> text="open">
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible"> <$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
{{$:/core/images/right-arrow}} {{$:/core/images/right-arrow}}
<$transclude field="caption"> <<toc-caption>>
<$view field="title"/>
</$transclude>
</$button> </$button>
</$reveal> </$reveal>
<$reveal type="match" state=<<toc-state>> text="open"> <$reveal type="match" state=<<toc-state>> text="open">
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible"> <$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
{{$:/core/images/down-arrow}} {{$:/core/images/down-arrow}}
<$transclude field="caption"> <<toc-caption>>
<$view field="title"/>
</$transclude>
</$button> </$button>
</$reveal> </$reveal>
</$list> </$list>

View File

@ -46,6 +46,6 @@ Here is the tag structure shown with clickable tag pills:
*{{Third||$:/core/ui/TagTemplate}} *{{Third||$:/core/ui/TagTemplate}}
*{{Fourtth||$:/core/ui/TagTemplate}} *{{Fourtth||$:/core/ui/TagTemplate}}
For instructions on adding a table of contents to the sidebar, see: {{How to add a new tab to the sidebar}}. For instructions on adding a table of contents to the sidebar, see: [[How to add a new tab to the sidebar]].
<<tabs "[tag[table-of-contents-example]]" "TableOfContentsMacro Simple Example">> <<tabs "[tag[table-of-contents-example]]" "TableOfContentsMacro Simple Example">>

View File

@ -0,0 +1,12 @@
title: GettingStarted (Step 1)
tags: $:/tags/GettingStarted
caption: Step 1<br>Syncing
! Syncing Changes to the Server
Before you can start storing important information in ~TiddlyWiki it is important to make sure that your changes are being reliably saved by the server.
# Create a new tiddler using the {{$:/core/images/new-button}} button in the sidebar on the right
# Click the {{$:/core/images/done-button}} button at the top right of the new tiddler
# Check the ~TiddlyWiki command line for a message confirming the tiddler has been saved
# Refresh the page in the browser to and verify that the new tiddler has been correctly saved