Trial implementing pretty links via a macro

An experiment for #3883
wikitext-via-macros
Jermolene 2019-03-29 22:04:13 +00:00
rodzic 1c436cbbf3
commit b799d924f0
2 zmienionych plików z 19 dodań i 7 usunięć

Wyświetl plik

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

Wyświetl plik

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