Skip to content

Render formatted Scripture to screen using Pk renderer #11

Open
@mvahowe

Description

@mvahowe

The current PoC, in Diegesis, can be seen at https://github.com/Proskomma/diegesis/blob/ad625bce427af3886eb9817c61bb69334449fa65/src/pages/Browse/TextBookContent.js#L38

The main steps are

  • Run a 'kitchen sink' query to get a description of the whole document (L43)
  • Build a config object to pass data into the renderer (L45). Note that this object is also used to store and return state (so it should probably have a different name).
  • Instantiate the renderer (L57).
  • Give that renderer at least one docSet handler (L58, L60).
  • Give that docSet handler at least one document handler (L59). Multiple handlers are useful if, eg, frontmatter is to be processed differently to canonical text.
  • Render (L61)
  • Do something with the generated state in the config object (L62)

At present it does not handle some USFM features such as character styles, but this could be done, as demonstrated for HTML generation with https://github.com/Proskomma/proskomma-render-pdf

One gotcha is that JSX cannot be generated one tag at a time, instead, some type of stack is required to collect enclosed content and then wrap it with matching tags. (The Diegesis PoC does this. The PDF generator does it in most places but is simply building strings.)

Also note that, in this case, the rendering model is setting the cv reference that is used to scroll to the selected verse.

We discussed making the renderer markup agnostic, ie allowing different containers etc to be specified. This would be cool, but it might be easier to get a hardwired model working with the hook first.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions