hatkirby / thoughts

mixed-content personal blog
0 stars 0 forks source link

Add section transclusion #13

Open hatkirby opened 7 years ago

hatkirby commented 7 years ago

Entries should be able to transclude sections from other entries (most notably wikis, but maybe other entries too). The reasoning for this is that I write a lot of blogs that involve similar concepts; for instance, in my series on catching legendary Pokémon, EV training my helper Pokémon is often a part of the strategy. I do not want to re-explain how stats work and what EV training is in every blog I write, because that gets boring and also deters/bores people who read my older posts. I do not want to just leave it out and link to an older post, because that raises the bar to entry and will deter new readers. A happy medium, I think, would be to remove the content from both posts, and move it into a wiki. Then, instead of linking to the wiki when it comes time to bring up EV training, the entry can transclude the section from the wiki into a \<details> block (thanks HTML5!), which will be obviously styled as being separate from the main body of the entry, and will say shortly in the \<summary> tag that the transclusion will explain so-and-so concept. This way, older readers can just skip the block and keep reading, and newer readers can expand the block to read about the concept without having to leave the page. Optionally, a link to the full wiki can be included in the \<details> block as well.

This may be complex to implement. The main UI to this will be a dialog in CKEditor, so a plugin will have to be written. An API on the server that the plugin can use to list existing entries will also need to be created. Then, a way to denote the transcluded section will have to be devised. One way would be for the API to produce a list of subheadings in the chosen entry, and the transclusion will contain the body governed by that subheading.