Closed zioth closed 4 years ago
Looks like in order to do this, I'd have to replicate most of the functionality of Doku_Handler::internallink, to distinguish between the various types of link. Unfortunately, that means a renderer plugin is the way to do this. :(
I will try to get around this by combining two renderer plugins into one. I wish that DokuWiki would be able to offer a way to stack renderer plugins, as there are several I would like to use. Thanks though!
Here's the issue in Doku, if you want to comment on it with your use-case: https://github.com/splitbrain/dokuwiki/issues/2642
In the mean time, you should be able to merge the plugins by doing something like this in purplenumbers's renderer:
private $m_tooltip;
function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') {
if (!$this->m_tooltip) {
$this->m_tooltip = plugin_load('renderer', 'autotooltip')
}
return $this->m_tooltip->internallink($id, $name, $search, $returnonly, $linktype);
}
If that works, let me know and I'll add it to the documentation.
hmm 🤔 i'm sure i left it somewhere 🎈 anyhow. bootstrap3 template does this also, but one has to use semantic plugin, which doesn't help with description. and also, you have to use bootstrap3 tpl. i'm on my own bootstrap4. you could borrow theirs if you want to set up without renderer mode. i believe it was only a few lines when looking into da hud. but i no programer. me sometime mistake.*
*true.
In the mean time, you should be able to merge the plugins by doing something like this in purplenumbers's renderer:
[...]
If that works, let me know and I'll add it to the documentation.
Didn't get it working. I'm a little slow like that, but I tried all the variations that looked right to me. I no php expert. I only know write Actionscript goto-and-play.
A new plugin has been created to allow renderer plugins to be implemented as action plugins: https://www.dokuwiki.org/plugin:actionrenderer
I'll take a look at some point, and see if I can make an action plugin option.
Wow, that looks promising! I am using PurpleNumbers renderer for a specific feature, but I've been wishing to be able to run both PN and Auto Tooltip for quite some time. I hope this makes such a transition both possible and relatively effortless! :)
Hmm, but even if you manage to make it into an action renderer, still the other renderer plugin also has to do the same. So I might have to look into that. I hope it is not too difficult! :)
I've had some trouble making it work with autotooltip, but if I can get everything working, I think I'll write up a formula for how to easily integrate with actionrenderer. Or maybe I'll make my own version, which can automatically attach itself to renderer plugins instead of requiring developers to write a bunch of code.
Any luck with this yet?
There's an issue with the actionrenderer
plugin that makes it not work with autotooltip
. Either the person who wrote that plugin will have to fix it, or I will. I'd like to get back to this, but I don't have time at the moment.
In the mean time, you should be able to merge the plugins by doing something like this in purplenumbers's renderer:
private $m_tooltip; function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') { if (!$this->m_tooltip) { $this->m_tooltip = plugin_load('renderer', 'autotooltip') } return $this->m_tooltip->internallink($id, $name, $search, $returnonly, $linktype); }
If that works, let me know and I'll add it to the documentation.
@zioth: What would it take for you to look into this? Maybe you have the know-how to actually get it working, and that'll save me some time digging. (keep in mind I'm on a non-profit covid19 lockdown budget, but it will for sure be worth something to get it going sooner rather than later!)
If you just want the two plugins merged together, I'd be happy to do that for free, since it will only take me a few minutes. Just create a fork of autotooltip, give me permission to commit to the repository, and I'll put it together for you. The down-side is that whenever there's a change to either plugin, you'll have to merge in the changes yourself. Unless I make significant structural changes however, this should be pretty simple using github's interface.
If you'd rather not mess with the plugins, and would instead like me to create a mechanism for DokuWiki that allows multiple renderer plugins, that would take a fair amount of work, and we can negotiate a price.
I just figured out how to get ActionRenderer to work!
If you grab the latest AutoTooltip and set ActionRenderer as your renderer, you should get the effects of both PurpleNumbers and AutoTooltip. Enjoy!
Wow, meanwhile I set you up as a contributor, but I will try this model first. :)
I was thinking that was a little too easy. :) Not with your plugin, which works great, but with the purplenumbers plugin. That one is not updated to use actionrenderer, so how will it work?
Ugh. I forgot that both plugins had to support actionrenderer... and adding actionrenderer support to purplenumbers would be a pain, since it overrides so much functionality.
You did a good job already. I'm not sure if I will be able to use your updated plugin as an example to make purplenumbers work with actionrenderer, but surely I'll give it a try. If you feel inspired to tinker with my fork of AutoTooltip to support both, that would be immensely helpful. Even if I have to merge changes to them manually later on, that is a small non-issue. Just let me know if it really is trivial, or too much job, and I will adjust accordingly!
The fork is done (just took 15 minutes), but I don't seem to have permission to push to master.
Never mind. I hadn't accepted the invitation. Your fork is now ready. You'll have to copy your settings over from purplenumbers to the forked autotooltip.
Wow, that was amazing. My two most important features, finally working together! You are a life saver! Really, thanks! https://prabhupada.io/books/sb/1/1/1?s=Absolute+Truth#id1: search phrase highlighted, jump to paragraph AND tooltip translations and definitions on every link. :)
And it only took a year and a half to figure it out! That's open source for you. :)
Happy to help.
I implemented this feature using a renderer plugin. Since you can only have one renderer at a time, that's not ideal. I should be able to do it with a sytax plugin instead of a renderer plugin, by overriding the default handling of
[[...]]
. If so, I should keep both methods around with a config toggle, since the syntax plugin will also conflict with other plugins.@ahaituki