Anyway, language hell is ahead of me and I'm sure at some point I'll convert it to use a proper API in a proper language. Right now, I need a simple way to do tags. Since I don't use the
descriptionmetadata field (or indeed really acknowledge its existence until I started this) I think I'll use that. Adding something like
#npc #storyto the field is the level of work I'm willing to do - what I want is something that will pull these tags and list my files using them.
First things first - how on earth do I start writing Google Scripts? Obviously as a lovingly maintained part of the Google suite it'll be tightly integrated so all I have to do is ... add what it claims is a plugin to Drive and I can start creating script files which open in an in-browser editor (I hate in-browser editors, but here we are). Then I need an index file and something to call it. It seems that when loading, the
doGetmethod in the
Code.gsfile is called and that needs to hit the HTML file. This all needs accessing via a URL to the dev or published version. Ok:
All I'm looking to do here is create some lists, so I just need to get the filenames and links and put them on the screen. Specifically, I'm getting a list of tags then creating a list of files per tag.
Under the hood ... eugh. It's pretty ugly - and not just because I've used two different forms of a forEach loop in a single short script. To generate this page, I'm looking at each file to get a list of unique tags then reversing the process - looking at each file to figure out if it has the tag I'm interested in. This is not Efficient CodeTM. On the other hand, it is Working CodeTM so it'll do as a proof of concept. I'll make it less awful when it gets too slow or I translate it all over to the API.
In the meantime, I have a document tagging system, and I can still use my favourite online text editor, even if I had to write the code in my less than favourite online code editor. And here is the code all in one place. One day I'll get tagging and Markdown support from Google itself...