Open vishalg opened 4 years ago
There are multiple ways for defining notes in the database, which use unified intermediate representation of the note data and common code to populate the database. So, I guess, from integration perspective there is an infrastructure in place to add extra source for the database, and it should be rather straightforward.
But there is the other part where you would need to get the data from struct plugin and convert it into that intermediate format. Per my understanding, the data is stored in SQLite database, which is not used in RefNotes currently, so this part would need to be developed from scratch. There was already suggestion about adding some way to store notes database in SQLite (see #40), but it was just briefly discussed and didn't go anywhere after that.
Also I wonder how useful such integration would be. I added data plugin support on a whim and I doubt if this feature is used much. With data you can define just a single note per DW page, while other methods allow to combine multiple notes in a single page. It looks like struct plugin follows the same concept and attaches some metadata for every page in specified namespace according to some schema. You would either need a schema for variable number of notes or create bunch of essentially empty pages (since the actual data is in SQLite).
Completely understand if you don't want to implement this. There are a few things a couple of reasons why I prefer the struct plugin to data. Firstly the plugin page suggests that the users should consider using struct plugin instead, secondly the struct plugin has its own advantages - it makes it possible to enforce a common structure on all the records, it supports a global dataset which is not associated with any pages and exists on its own (so eliminate the need to have one page per entry). I don't really know php and dokuwiki API even less so I hesitate to submit a pull request myself. However it seems that the struct plugin provides an interface to access its data.
My potential use case for this is similar to what would be the case for the data plugin (i.e have a searchable/filterable database of references) but with additional advantages of struct. Currently I do this through a csv import/export from struct and a script to generate the table required by ref notes to keep the two in sync. If I can find some time to learn php I will take a stab at submitting a pull request.
The plugin already supports the data plugin, how hard or easy would it be to also support the struct plugin?