1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-02 18:23:28 +00:00

Add support for slugify to the link widget's tv-wikilink-template handling

This commit is contained in:
jeremy@jermolene.com 2021-04-10 10:58:55 +01:00
parent c4cdb1ed8c
commit 02d390a673
2 changed files with 2 additions and 0 deletions

View File

@ -98,6 +98,7 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
var wikiLinkTemplateMacro = this.getVariable("tv-wikilink-template"),
wikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : "#$uri_encoded$";
wikiLinkText = $tw.utils.replaceString(wikiLinkTemplate,"$uri_encoded$",encodeURIComponent(this.to));
wikiLinkText = $tw.utils.replaceString(wikiLinkTemplate,"$title_slugify$",this.wiki.slugify(this.to));
wikiLinkText = $tw.utils.replaceString(wikiLinkText,"$uri_doubleencoded$",encodeURIComponent(encodeURIComponent(this.to)));
}
// Override with the value of tv-get-export-link if defined

View File

@ -5,3 +5,4 @@ tags: $:/tags/SiteMap
list: $:/core/routes/StaticSite/Index $:/core/routes/StaticSite/HTML $:/core/routes/StaticSite/Images $:/core/routes/StaticSite/Styles
var-tv-wikilink-template-filter: [slugify[]addsuffix[.html]]
var-tv-image-template-filter: [slugify[]addprefix[../images/]addsuffix<extension>]
var-tv-wikilink-template: $title_slugify$.html