From a2c764d407ea4fbfbda3e440ea75d1ec0f1bb4f2 Mon Sep 17 00:00:00 2001 From: Tobias Beer Date: Tue, 12 Dec 2017 14:50:33 +0100 Subject: [PATCH] enable doc contributions for dev (#3047) * enable doc contributions for dev fixes #2921 * involves changes to boot.js to properly build OriginalTiddlerPaths on Windows * added ContributionBanner * added Sources tab to info panel * updated tiddlywiki.info for dev * normalize path separator to posix for windows * more generically transform to posix --- boot/boot.js | 8 +++++-- .../tiddlers/system/ContributionBanner.tid | 20 ++++++++++++++++ editions/dev/tiddlers/system/Sources.tid | 23 +++++++++++++++++++ editions/dev/tiddlywiki.info | 3 +++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 editions/dev/tiddlers/system/ContributionBanner.tid create mode 100644 editions/dev/tiddlers/system/Sources.tid diff --git a/boot/boot.js b/boot/boot.js index ac5d490a5..371bbf605 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1806,9 +1806,13 @@ $tw.loadWikiTiddlers = function(wikiPath,options) { // Save the original tiddler file locations if requested var config = wikiInfo.config || {}; if(config["retain-original-tiddler-path"]) { - var output = {}; + var output = {}, relativePath; for(var title in $tw.boot.files) { - output[title] = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath); + relativePath = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath); + output[title] = + path.sep === path.posix.sep ? + relativePath : + relativePath.split(path.sep).join(path.posix.sep); } $tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)}); } diff --git a/editions/dev/tiddlers/system/ContributionBanner.tid b/editions/dev/tiddlers/system/ContributionBanner.tid new file mode 100644 index 000000000..f9ec77791 --- /dev/null +++ b/editions/dev/tiddlers/system/ContributionBanner.tid @@ -0,0 +1,20 @@ +title: $:/ContributionBanner +tags: $:/tags/EditTemplate +list-after: $:/core/ui/EditTemplate/title + +\define makeGitHubLink() +https://github.com/Jermolene/TiddlyWiki5/edit/master/editions/dev/tiddlers/$(githubLink)$ +\end +\define innerMakeGitHubLink(linkText) +<$set name="githubLink" value={{$:/config/OriginalTiddlerPaths##$(draftOfTiddler)$}}> +> class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">$linkText$ + +\end +\define outerMakeGitHubLink(linkText) +<$set name="draftOfTiddler" value={{$(currentTiddler)$!!draft.of}}> +<> + +\end +
+{{$:/core/images/star-filled}} Can you help us improve this documentation? [ext[Find out how|https://tiddlywiki.com/#Improving%20TiddlyWiki%20Documentation]] to edit <> +
diff --git a/editions/dev/tiddlers/system/Sources.tid b/editions/dev/tiddlers/system/Sources.tid new file mode 100644 index 000000000..0c5082205 --- /dev/null +++ b/editions/dev/tiddlers/system/Sources.tid @@ -0,0 +1,23 @@ +title: $:/editions/tw5.com/TiddlerInfo/Sources +tags: $:/tags/TiddlerInfo +caption: Sources + +\define github-link-base() +https://github.com/Jermolene/TiddlyWiki5/blob/master/editions/dev/tiddlers/$(title)$ +\end + +\define make-github-link() +<$set name="title" value={{$:/config/OriginalTiddlerPaths##$(currentTiddler)$}}> +<$set name="title" filter="[encodeuricomponent[]]" select="0"> +<a href=<<github-link-base>> class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer"><$text text=<<github-link-base>>/></a> +</$set> +</$set> +\end + +<$list filter="[all[current]!is[system]!is[shadow]]"> + +Help us to improve the documentation by sending a ~GitHub pull request for this tiddler: + +* <<make-github-link>> + +</$list> diff --git a/editions/dev/tiddlywiki.info b/editions/dev/tiddlywiki.info index e5bdacf77..572c5782b 100644 --- a/editions/dev/tiddlywiki.info +++ b/editions/dev/tiddlywiki.info @@ -56,5 +56,8 @@ "--rendertiddler","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain", "--rendertiddlers","[!is[system]]","$:/core/templates/static.tiddler.html","static","text/plain", "--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"] + }, + "config": { + "retain-original-tiddler-path": true } }