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

Improve contribution banner

* Make it work with titles with crazy characters
* Hide the banner for tiddlers that didn't originate on GitHub

Fixes #4116 and #4129
This commit is contained in:
Jeremy Ruston 2019-07-26 12:46:27 +01:00
parent e86d4d29d5
commit 32c5490a20
5 changed files with 45 additions and 65 deletions

View File

@ -2,19 +2,15 @@ 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>
\define base-github()
https://github.com/Jermolene/TiddlyWiki5/edit/master/editions/dev/tiddlers/
\end
<$set name="draft-of" value={{{ [<currentTiddler>get[draft.of]] }}}>
<$list filter="[[$:/config/OriginalTiddlerPaths]getindex<draft-of>]" variable="target" >
<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">>
{{$:/core/images/star-filled}} Can you help us improve this documentation? [ext[Find out how|https://tiddlywiki.com/#Improving%20TiddlyWiki%20Documentation]] to
<a href={{{ [<target>addprefix<base-github>] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">edit this tiddler on ~GitHub</a>
</div>
</$list>
</$set>

View File

@ -5,19 +5,15 @@ tags: $:/tags/EditTemplate
title: $:/ContributionBanner
type: text/vnd.tiddlywiki
\define makeGitHubLink()
https://github.com/Jermolene/TiddlyWiki5/edit/master/editions/es-ES/tiddlers/$(githubLink)$
\end
\define innerMakeGitHubLink(linkText)
<$set name="githubLink" value={{$:/config/OriginalTiddlerPaths##$(draftOfTiddler)$}}>
<a href=<<makeGitHubLink>> class="tc-tiddlylink-external" target="_blank">$linkText$</a>
</$set>
\end
\define outerMakeGitHubLink(linkText)
<$set name="draftOfTiddler" value={{$(currentTiddler)$!!draft.of}}>
<<innerMakeGitHubLink "$linkText$">>
</$set>
\define base-github()
https://github.com/Jermolene/TiddlyWiki5/edit/master/editions/es-ES/tiddlers/
\end
<$set name="draft-of" value={{{ [<currentTiddler>get[draft.of]] }}}>
<$list filter="[[$:/config/OriginalTiddlerPaths]getindex<draft-of>]" variable="target" >
<div class="tc-improvement-banner">
{{$:/core/images/star-filled}} ¿Puedes ayudarnos a mejorar la documentación? [[Aquí te explicamos|Improving TiddlyWiki Documentation]] cómo editar <<outerMakeGitHubLink "este tiddler en ~GitHub">>
{{$:/core/images/star-filled}} ¿Puedes ayudarnos a mejorar la documentación? [[Aquí te explicamos|Improving TiddlyWiki Documentation]] cómo editar
<a href={{{ [<target>addprefix<base-github>] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">este tiddler en ~GitHub</a>
</div>
</$list>
</$set>

View File

@ -5,19 +5,15 @@ tags: $:/tags/EditTemplate
title: $:/ContributionBanner
type: text/vnd.tiddlywiki
\define makeGitHubLink()
https://github.com/Jermolene/TiddlyWiki5/edit/master/editions/fr-FR/tiddlers/$(githubLink)$
\end
\define innerMakeGitHubLink(linkText)
<$set name="githubLink" value={{$:/config/OriginalTiddlerPaths##$(draftOfTiddler)$}}>
<a href=<<makeGitHubLink>> class="tc-tiddlylink-external" target="_blank">$linkText$</a>
</$set>
\end
\define outerMakeGitHubLink(linkText)
<$set name="draftOfTiddler" value={{$(currentTiddler)$!!draft.of}}>
<<innerMakeGitHubLink "$linkText$">>
</$set>
\define base-github()
https://github.com/Jermolene/TiddlyWiki5/edit/master/editions/fr-FR/tiddlers/
\end
<$set name="draft-of" value={{{ [<currentTiddler>get[draft.of]] }}}>
<$list filter="[[$:/config/OriginalTiddlerPaths]getindex<draft-of>]" variable="target" >
<div class="tc-improvement-banner">
{{$:/core/images/star-filled}} Pouvez-vous nous aider à améliorer cette documentation ? [[Voyez comment|Improving TiddlyWiki Documentation]] éditer <<outerMakeGitHubLink "ce tiddler sur ~GitHub">>
{{$:/core/images/star-filled}} Pouvez-vous nous aider à améliorer cette documentation ? [[Voyez comment|Improving TiddlyWiki Documentation]] éditer
<a href={{{ [<target>addprefix<base-github>] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">ce tiddler sur ~GitHub</a>
</div>
</$list>
</$set>

View File

@ -2,19 +2,15 @@ title: $:/ContributionBanner
tags: $:/tags/EditTemplate
list-after: $:/core/ui/EditTemplate/title
\define makeGitHubLink()
https://github.com/Jermolene/TiddlyWiki5/edit/master/editions/ko-KR/tiddlers/$(githubLink)$
\end
\define innerMakeGitHubLink(linkText)
<$set name="githubLink" value={{$:/config/OriginalTiddlerPaths##$(draftOfTiddler)$}}>
<a href=<<makeGitHubLink>> class="tc-tiddlylink-external" target="_blank">$linkText$</a>
</$set>
\end
\define outerMakeGitHubLink(linkText)
<$set name="draftOfTiddler" value={{$(currentTiddler)$!!draft.of}}>
<<innerMakeGitHubLink "$linkText$">>
</$set>
\define base-github()
https://github.com/Jermolene/TiddlyWiki5/edit/master/editions/ko-KR/tiddlers/
\end
<$set name="draft-of" value={{{ [<currentTiddler>get[draft.of]] }}}>
<$list filter="[[$:/config/OriginalTiddlerPaths]getindex<draft-of>]" variable="target" >
<div class="tc-improvement-banner">
{{$:/core/images/star-filled}} 우리에게 이 설명문서를 개선하는 데 도움을 줄 수 있나요? <<outerMakeGitHubLink "~GitHub에서 이 티들러">>를 편집하는 [[방법에 대해 알아보세요|Improving TiddlyWiki Documentation]]
{{$:/core/images/star-filled}}우리에게 이 설명문서를 개선하는 데 도움을 줄 수 있나요?
<a href={{{ [<target>addprefix<base-github>] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">~GitHub에서 이 티들러</a>를 편집하는 [[방법에 대해 알아보세요|Improving TiddlyWiki Documentation]]
</div>
</$list>
</$set>

View File

@ -2,19 +2,15 @@ title: $:/ContributionBanner
tags: $:/tags/EditTemplate
list-after: $:/core/ui/EditTemplate/title
\define makeGitHubLink()
https://github.com/Jermolene/TiddlyWiki5/edit/tiddlywiki-com/editions/tw5.com/tiddlers/$(githubLink)$
\end
\define innerMakeGitHubLink(linkText,tiddler)
<$set name="githubLink" value={{{ [[$:/config/OriginalTiddlerPaths]getindex<__tiddler__>] }}}>
<a href=<<makeGitHubLink>> class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">$linkText$</a>
</$set>
\end
\define outerMakeGitHubLink(linkText)
<$set name="draftOfTiddler" value={{{ [[$(currentTiddler)$]get[draft.of]] }}}>
<$macrocall $name="innerMakeGitHubLink" linkText="$linkText$" tiddler=<<draftOfTiddler>>/>
</$set>
\define base-github()
https://github.com/Jermolene/TiddlyWiki5/edit/tiddlywiki-com/editions/tw5.com/tiddlers/
\end
<$set name="draft-of" value={{{ [<currentTiddler>get[draft.of]] }}}>
<$list filter="[[$:/config/OriginalTiddlerPaths]getindex<draft-of>]" variable="target" >
<div class="tc-improvement-banner">
{{$:/core/images/star-filled}} Can you help us improve this documentation? [[Find out how|Improving TiddlyWiki Documentation]] to edit <$macrocall $name="outerMakeGitHubLink" linkText="this tiddler on ~GitHub"/>
{{$:/core/images/star-filled}} Can you help us improve this documentation? [[Find out how|Improving TiddlyWiki Documentation]] to
<a href={{{ [<target>addprefix<base-github>] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">edit this tiddler on ~GitHub</a>
</div>
</$list>
</$set>