I’m currently trying to make a plugin (discourse-citestore
) that has the feature of storing data with a handle and a subhandle (locus), so that this data can be automatically accessed by users and pasted in their messages. For example, the plugin would take [us-constitution 1]
and replace it with the first paragraph of the Constitution (which would be saved in the database). Here’s the repo:
https://github.com/jsilvanus/discourse-citestore
I’ve gotten some way by simply reading other plugins and trying to adapt what is written in other places into my own needs. But right now I don’t know how to proceed…
As you can see, I have some functions in plugin.rb
that deal with the storage creation and data insertion and retrieval. Example:
https://github.com/jsilvanus/discourse-citestore/blob/master/plugin.rb#L210-221
However, I have no idea on how to access the functions I have set up in that file from the discourse-markdown file citestore.js.es6
.
If someone could give me a few pointers, I would appreciate it immensely!
P.s. it may well be that my coding skillz are way too low for the project I have undertaken. I only hope that is not the case…