PsyTeachR / glossary

Glossary of terms
https://psyteachr.github.io/glossary/
Other
15 stars 17 forks source link

precompile definitions into separate files #128

Closed dalejbarr closed 2 years ago

dalejbarr commented 2 years ago

Currently the "title" attribute for each glossary entry (which pops up as a tool tip when the mouse cursor hovers over the item) is looked up and parsed out of the HTML files using rvest.

While this is fine, it would also make sense to precompile all the definitions into separate plaintext files that can be easily accessed by http request with no parsing required. These text files can be created each time the book is rendered. This has two advantages: (1) precompiling will speed up the compilation of books that use the glossary, especially as the glossary gets large; (2) it makes it easier to access the definitions in other situations where powerful HTML parsing tools such as rvest are not readily available (e.g., using a Lua filter in Pandoc).

The solution I proposed requires only an update to _makefile.R which does the precompiling. The precompiled defs are stored in docs/_defs/.

debruine commented 2 years ago

Awesome, thanks for writing this!!