From 2698f088517c186705c390362dd516f2709d7141 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 10 Dec 2014 21:46:29 +0000 Subject: [PATCH 1/5] Tentative reworking of GettingStarted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See this thread for background: https://groups.google.com/d/topic/tiddlywiki/sDWP4NPe8XE/discussion Translators: please don’t translate this material until it’s settled down --- core/language/en-GB/GettingStarted.tid | 13 ------------ .../GettingStarted/GettingStarted Step 1.tid | 20 +++++++++++++++++++ .../GettingStarted/GettingStarted Step 2.tid | 11 ++++++++++ .../en-GB/GettingStarted/GettingStarted.tid | 7 +++++++ .../tiddlyweb/GettingStarted Step 1.tid | 12 +++++++++++ 5 files changed, 50 insertions(+), 13 deletions(-) delete mode 100644 core/language/en-GB/GettingStarted.tid create mode 100644 core/language/en-GB/GettingStarted/GettingStarted Step 1.tid create mode 100644 core/language/en-GB/GettingStarted/GettingStarted Step 2.tid create mode 100644 core/language/en-GB/GettingStarted/GettingStarted.tid create mode 100644 plugins/tiddlywiki/tiddlyweb/GettingStarted Step 1.tid diff --git a/core/language/en-GB/GettingStarted.tid b/core/language/en-GB/GettingStarted.tid deleted file mode 100644 index 37253b1f0..000000000 --- a/core/language/en-GB/GettingStarted.tid +++ /dev/null @@ -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]] diff --git a/core/language/en-GB/GettingStarted/GettingStarted Step 1.tid b/core/language/en-GB/GettingStarted/GettingStarted Step 1.tid new file mode 100644 index 000000000..32972abb2 --- /dev/null +++ b/core/language/en-GB/GettingStarted/GettingStarted Step 1.tid @@ -0,0 +1,20 @@ +title: GettingStarted (Step 1) +tags: $:/tags/GettingStarted +caption: Step 1
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. diff --git a/core/language/en-GB/GettingStarted/GettingStarted Step 2.tid b/core/language/en-GB/GettingStarted/GettingStarted Step 2.tid new file mode 100644 index 000000000..2fc9eb3c5 --- /dev/null +++ b/core/language/en-GB/GettingStarted/GettingStarted Step 2.tid @@ -0,0 +1,11 @@ +title: GettingStarted (Step 2) +tags: $:/tags/GettingStarted +caption: Step 2
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 diff --git a/core/language/en-GB/GettingStarted/GettingStarted.tid b/core/language/en-GB/GettingStarted/GettingStarted.tid new file mode 100644 index 000000000..4044a4330 --- /dev/null +++ b/core/language/en-GB/GettingStarted/GettingStarted.tid @@ -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. + +<> diff --git a/plugins/tiddlywiki/tiddlyweb/GettingStarted Step 1.tid b/plugins/tiddlywiki/tiddlyweb/GettingStarted Step 1.tid new file mode 100644 index 000000000..b62f749d4 --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/GettingStarted Step 1.tid @@ -0,0 +1,12 @@ +title: GettingStarted (Step 1) +tags: $:/tags/GettingStarted +caption: Step 1
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 From 51db48acc901d8fb298d9b0f7f10b47ffe90df05 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 10 Dec 2014 22:14:27 +0000 Subject: [PATCH 2/5] Fix checking for non-empty folders in initcommand --- core/modules/commands/init.js | 2 +- core/modules/utils/filesystem.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/modules/commands/init.js b/core/modules/commands/init.js index 108124112..51b80f267 100644 --- a/core/modules/commands/init.js +++ b/core/modules/commands/init.js @@ -26,7 +26,7 @@ Command.prototype.execute = function() { var fs = require("fs"), path = require("path"); // 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"; } // Loop through each of the specified editions diff --git a/core/modules/utils/filesystem.js b/core/modules/utils/filesystem.js index d0fe34645..d7d084221 100644 --- a/core/modules/utils/filesystem.js +++ b/core/modules/utils/filesystem.js @@ -139,4 +139,21 @@ exports.isDirectory = function(dirPath) { 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; +}; + })(); From 5b38c21a417d2e5e2b85aed8010c88af32420e24 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 11 Dec 2014 17:00:57 +0000 Subject: [PATCH 3/5] Disable links when transcluding caption field in toc macro @BramChen does this work for you? --- core/wiki/macros/toc.tid | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index 9f3824a62..240b0a978 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -1,15 +1,21 @@ title: $:/core/macros/toc tags: $:/tags/Macro +\define toc-caption() +<$set name="tv-wikilinks" value="no"> +<$transclude field="caption"> +<$view field="title"/> + + +\end + \define toc-body(rootTag,tag,sort:"",itemClassFilter)
    <$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">
  1. >> <$list filter="[all[current]toc-link[no]]" emptyMessage="<$link><$view field='caption'><$view field='title'/>"> -<$transclude field="caption"> -<$view field="title"/> - +<> <$list filter="""[all[current]] -[[$rootTag$]]"""> <$macrocall $name="toc-body" rootTag="""$rootTag$""" tag=<> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/> @@ -39,9 +45,7 @@ tags: $:/tags/Macro {{$:/core/images/down-arrow}} -<$transclude field="caption"> -<$view field="title"/> - +<> <$reveal type="match" state=<> text="open"> <$macrocall $name="toc-expandable" tag=<> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/> @@ -58,17 +62,13 @@ tags: $:/tags/Macro <$reveal type="nomatch" state=<> text="open"> <$button set=<> setTo="open" class="tc-btn-invisible"> {{$:/core/images/right-arrow}} -<$transclude field="caption"> -<$view field="title"/> - +<> <$reveal type="match" state=<> text="open"> <$button set=<> setTo="close" class="tc-btn-invisible"> {{$:/core/images/down-arrow}} -<$transclude field="caption"> -<$view field="title"/> - +<> <$reveal type="match" state=<> text="open"> @@ -106,9 +106,7 @@ tags: $:/tags/Macro -<$transclude field="caption"> -<$view field="title"/> - +<> <$reveal type="match" state=<> text="open"> <$macrocall $name="toc-selective-expandable" tag=<> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/> @@ -126,17 +124,13 @@ tags: $:/tags/Macro <$reveal type="nomatch" state=<> text="open"> <$button set=<> setTo="open" class="tc-btn-invisible"> {{$:/core/images/right-arrow}} -<$transclude field="caption"> -<$view field="title"/> - +<> <$reveal type="match" state=<> text="open"> <$button set=<> setTo="close" class="tc-btn-invisible"> {{$:/core/images/down-arrow}} -<$transclude field="caption"> -<$view field="title"/> - +<> From 156d3bc692b0feec1bc56f987f89c845b807ede4 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 11 Dec 2014 17:01:02 +0000 Subject: [PATCH 4/5] Typo --- editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid b/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid index 27c8ffa25..eff7d4425 100644 --- a/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid +++ b/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid @@ -46,6 +46,6 @@ Here is the tag structure shown with clickable tag pills: *{{Third||$:/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]]. <> From 42dba113ccdb18d7e76ac7a773c7dca532207007 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 11 Dec 2014 17:49:17 +0000 Subject: [PATCH 5/5] Adjust field and has filter handling of missing tiddlers Now `[!field:name[value]]` and `[!has[name]` will treat missing tiddlers as not having the specified field --- core/modules/filters/field.js | 4 ++++ core/modules/filters/has.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/modules/filters/field.js b/core/modules/filters/field.js index 949cb217e..f85df5c0d 100644 --- a/core/modules/filters/field.js +++ b/core/modules/filters/field.js @@ -26,6 +26,8 @@ exports.field = function(source,operator,options) { if(text !== null && !operator.regexp.exec(text)) { results.push(title); } + } else { + results.push(title); } }); } else { @@ -35,6 +37,8 @@ exports.field = function(source,operator,options) { if(text !== null && text !== operator.operand) { results.push(title); } + } else { + results.push(title); } }); } diff --git a/core/modules/filters/has.js b/core/modules/filters/has.js index 87e9953ec..9a82f3111 100644 --- a/core/modules/filters/has.js +++ b/core/modules/filters/has.js @@ -19,7 +19,7 @@ exports.has = function(source,operator,options) { var results = []; if(operator.prefix === "!") { 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); } });