Skip to content

Commit

Permalink
Trial implementing pretty links via a macro
Browse files Browse the repository at this point in the history
An experiment for #3883
  • Loading branch information
Jermolene committed Mar 29, 2019
1 parent 1c436cb commit b799d92
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
13 changes: 13 additions & 0 deletions core/modules/parsers/wikiparser/macros/prettylink.tid
@@ -0,0 +1,13 @@
title: $:/core/macros/shortcuts/prettylink
tags: $:/tags/Macro

\define x-tm-prettylink-internal(to,text)
<$link to=<<__to__>>><$text text=<<__text__>>/></$link>
\end

\define tm-prettylink-internal(to,text)
<$button>
<$action-navigate $to=<<__to__>>/>
<$text text=<<__text__>>/>
</$button>
\end
13 changes: 6 additions & 7 deletions core/modules/parsers/wikiparser/rules/prettylink.js
Expand Up @@ -49,13 +49,12 @@ exports.parse = function() {
}];
} else {
return [{
type: "link",
attributes: {
to: {type: "string", value: link}
},
children: [{
type: "text", text: text
}]
type: "macrocall",
name: "tm-prettylink-internal",
params: [
{name: "to", value: link},
{name: "text", value: text}
]
}];
}
};
Expand Down

0 comments on commit b799d92

Please sign in to comment.