#3110 (Convert memo parser to a plugin)
by Luc Saffre · in Developers · assigned to Luc Saffre
Summary
Currently the poor SR server is running MemoParser.parse() on each comment again and again for each request. We should parse only once and store the result in a preview field. We have the BleachedPreviewBody which does almost this. Convert lino.utils.memo to a plugin lino.modlib.memo. Rename lino.mixins.bleached.BleachedPreviewBody to lino.modlib.memo.mixins.Previewable (note that bleaching is no longer done there). One challenge here is that the result of the parsing depends on the front end. On Jane it is different than on Hobbit. Extend the BleachedPreviewBody mixin so that you can configure which front-end is used for previewing. The memo parse function currently expects an "ar" in the context, but actually it needs only the renderer (i.e. the front end). A site with more than one front end is probably an exception. If somebody uses Jane, their previews must simply lead to hobbit. The links in the preview should include the server URI so that they can be used e.g. in the body of an email. Write a data checker which verifies that body_preview is still the same as it was durint on_ui_save(). Do not only parse the first paragraph but add a nother preview field "full_preview" which contains the full parsed body. Of course this would require the Jane environment to also import lino_react, just for using its renderer in the memo parser.
Children
- #3213 (DataChecker to check/update body_preview) (by Luc Saffre in Developers)