1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-26 19:47:20 +00:00

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
This commit is contained in:
Tobias Beer 2017-12-12 14:50:33 +01:00 committed by Jeremy Ruston
parent feace8d26b
commit a2c764d407
4 changed files with 52 additions and 2 deletions

View File

@ -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)});
}

View File

@ -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)$}}>
<a href=<<makeGitHubLink>> class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">$linkText$</a>
</$set>
\end
\define outerMakeGitHubLink(linkText)
<$set name="draftOfTiddler" value={{$(currentTiddler)$!!draft.of}}>
<<innerMakeGitHubLink "$linkText$">>
</$set>
\end
<div class="tc-improvement-banner">
{{$:/core/images/star-filled}} Can you help us improve this documentation? [ext[Find out how|https://tiddlywiki.com/#Improving%20TiddlyWiki%20Documentation]] to edit <<outerMakeGitHubLink "this tiddler on ~GitHub">>
</div>

View File

@ -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="[<title>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>

View File

@ -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
}
}