toot
toot copied to clipboard
Allow setting some options from the editor
I understand that this may be overengineering the thing a bit, but I thought that it would be nice to have the possibility to set some things such as the spoiler text or language from the editor. This could be supported e.g. with some meta comment keywords. An example:
#media: image.jpg
#description: A fanciful image
#spoiler: Shocking(ly beautiful) image!
#language: eng
Actual text of the toot here
I also tried to find a way to include --media and --description inside of "toot post --editor vim", but it seems this is not supported. A solution like the above one would be really handy.
OK, my original patch to implement this won't work with the new template for posts, so before I make a new design, I think it would be useful to discuss how we want this metadata to be added. I had a patchset that even went as far as allowing writing a whole thread to be posted, with per-message metadata, so the question is: how do we want to syntax to be now?
Sorry for messing up your patch. What do you think about treating the region below the divider as markup?
We could change the editor template to comment out the instructions:
------------------------ >8 ------------------------
# Do not modify or remove the line above. Enter your toot above it.
# Below you may enter options for `toot post` in TOML, e.g.
# visibility = "private"
# sensitive = True
The reason I suggest TOML over e.g. YAML is that I already plan to use tomlkit for user settings file. Also it's a better markup language IMO.
Don't worry about breaking my patch, it was mostly just a proof of concept and I had to change it again whn I I tried introducing multi-post writing, an then I couldn't find a nice way to handle per-post vs per-thread metadata without going super-verbose, which I didn't like either.
TOML would work too instead of YAML, but whichever approach we use, I would like it to be extensible to thread posting with both per-thread and per-post attributes, although I'm not sure what the ideal syntax would be in this case. I'll open a separate issue for the thread posting.