Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Storybook #645

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

Conversation

gmjgeek
Copy link
Contributor

@gmjgeek gmjgeek commented Jul 19, 2024

Support storybooks with no audio.

Fixes #596

Implementation Notes

Conversion

SAB tends to create storybooks 4-digit book codes of the form B00#. This is problematic for Proskomma, which only accepts 3-digit book codes. To resolve the issue, the PWA shortens these book codes to B0# when possible. If this new name would conflict with another book, the conversion process prints a warning to the console instead.

In storybooks, the conversion process tends to turn all formatting markers into milestones. This approach helps keep storybooks compatible with Proskomma.

Rendering

Unlike Scripture books, storybooks are not rendered by ScriptureViewSofria.svelte. Instead, they use sofria-render-json/SofriaRender.svelte. Here is the general process for rendering storybook text:

  • Request the page as a Sofria JSON object from Proskomma
  • Convert milestones and other features into a "render object" that is easier for Svelte to process
  • Use a tree of Svelte components to convert the "render object" into HTML/CSS

Proskomma does not hold image data. Instead, illustrations for each storybook are listed in config.js and stored in the illustrations folder.

TODO

Features

  • Handle special storybook markers during content conversion
  • Display storybook illustrations at the top of each page
  • Render bold and italic texts
  • Render headings
  • Render ordered and unordered lists, including nested lists
  • Include boarder around storybook content
  • Navigate through pages like chapters
  • Update convert process to be compatible with SAB 12.1
  • When converting an app without storybooks, don't crash if the data/illustrations folder is not present
  • Show only the illustration in landscape mode
  • Make the illustration full-screen on double tap
  • Keep boarder from scrolling when text overflows the screen (text should scroll within the boarder, which remains fixed)
  • Ensure the boarder occupies the full width of the text area instead of shrinking to match content. Try creating a page with only one word. Does the boarder shrink, or does it retain its size?

Bugs (12 August 2024):

  • Start with Page 1: When navigating to a new storybook, the reader should land on the first page. Currently, if the user navigates from Matthew 5 to the "Unmerciful Servant" storybook, the app goes to page 5 of the storybook. If the storybook has fewer than 5 pages, the app crashes.
  • Switching Book Collections: Suppose collection A has the "Unmerciful Servant" storybook, and collection B has only the four gospels. If the user begins in the storybook and switches to collection B, the app attempts to find the same storybook in collection B. Since B does not have the storybook, the app crashes. Instead of crashing, the app should go to the default chapter of that book collection (ex: Matthew 1:1)
  • Supporting Storybook-only Collections: Currently, the app crashes at runtime if a collection does not have at least one Scripture book. This bug may fall outside the scope of this issue.

@gmjgeek gmjgeek force-pushed the feature/basic-storybook-596 branch from 0d5de05 to 59776a4 Compare July 29, 2024 14:05
@gmjgeek gmjgeek force-pushed the feature/basic-storybook-596 branch 3 times, most recently from 2812691 to 1034015 Compare August 8, 2024 16:59
This allows storybooks to use section headings to format regular
content without confusing Proskomma about the structure of the book.
Allows multiple books to use the same USFM (as a test project does).
Fixes conversion crash when mutlple books share the same audio file.
Proskomma expects all book codes to be three characters.

Codes shorter than 3 characters a padded with zeros.
Codes in the form X0## are shortened to X##.

Other codes longer then 3 characters are not converted, but a warning
is shown that the books may not load properly.
The getDamId function assumed that every book with audio would
include audio for every chapter. This is not typically true for
storybooks.
@gmjgeek gmjgeek force-pushed the feature/basic-storybook-596 branch from 1034015 to ce31743 Compare August 12, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basic storybook - No audio
1 participant