Skip to content

Fix scripture template override applying wrong styles to verses 2+#2653

Merged
vassbo merged 2 commits intoChurchApps:devfrom
yurividal:fix/scripture-template-override-styling
Jan 9, 2026
Merged

Fix scripture template override applying wrong styles to verses 2+#2653
vassbo merged 2 commits intoChurchApps:devfrom
yurividal:fix/scripture-template-override-styling

Conversation

@yurividal
Copy link
Contributor

@yurividal yurividal commented Jan 9, 2026

This fixes #2617

When using 'Overwrite Scripture with Template' in output styles, verses beyond the first were getting matched to the wrong template text object (falling back to text[0] which is the verse number template instead of verse text template).

Now intelligently matches verse text objects to {scripture_text} placeholder and verse numbers to {scripture_number} placeholder based on customType flag.

Problem

When using "Overwrite Scripture with Template" in output styles, scripture slides with multiple verses displayed incorrect formatting:

  • Verse 1: Correct styling (black text)
  • Verses 2+: Wrong styling (grey text from verse number template)

Root Cause

In output.ts, when applying style templates to scripture slides, the template text matching logic fell back to text[0] for verses beyond the first. Since text[0] is the verse number template (grey, 40px), all subsequent verse text got styled incorrectly.

Solution

Added intelligent template matching that:

  1. First tries exact index match
  2. If that fails on scripture templates, matches by placeholder type:
    • Verse numbers (with disableTemplate flag) → {scripture_number} template
    • Verse text (without flag) → {scripture_text} template
  3. Falls back to text[0] only as last resort

When using 'Overwrite Scripture with Template' in output styles, verses beyond the first were getting matched to the wrong template text object (falling back to text[0] which is the verse number template instead of verse text template).

Now intelligently matches verse text objects to {scripture_text} placeholder and verse numbers to {scripture_number} placeholder based on customType flag.
@yurividal
Copy link
Contributor Author

There is still a different but related bug, which happens when the user has a title slide in the scripture template, and a style overwrite in another output.

The title slide of the secondary output displays the placeholders instead of the metadata, since it cant resolve those values.

Title slide:
image

Title slide in secondary output:
image

- Fixed type
@vassbo
Copy link
Collaborator

vassbo commented Jan 9, 2026

Nice, thank you! :)

@vassbo vassbo merged commit 33f7cd3 into ChurchApps:dev Jan 9, 2026
@yurividal
Copy link
Contributor Author

@vassbo maybe there is still room for improvement. What if instead of the last resort being text[0] what if we always use the style of {scripture_text} as the last resort?

@vassbo
Copy link
Collaborator

vassbo commented Jan 9, 2026

That can work.

@yurividal yurividal deleted the fix/scripture-template-override-styling branch January 9, 2026 11:58
vassbo added a commit that referenced this pull request Jan 9, 2026
* Fixed pro5 import issue

* Fixed clear audio not stopping playlist

* Fixed dropdown closing too quick
- Restoring old settings won't mess up the data path

* Group name replaced when changing background if same name as previous

* Fixed incorrect scripture selection order sometimes

* Groups number tip

* Added support for B1 plans containing lesson items.

* Fixed custom icons white default color #2605

* Fixed template text sometimes removed if different item order #2607

* Fixed non text items duplicated on text edit changes

* Trying to prevent crash #2612

* Template image is prioritized #2613
- Template popup ordered by scripture

* Updated languages

* Media reading improvements
- Recursive audio folder search
- Fixes #2615

* Toggle text edit shortcut #2644

* Quick create audio folder from media folder #2178
- Media updates

* Added Traditional Chinese

* Fixed playlist highlight create
- Fixed project folder buttons scroll
- Fixed spaces in text edit not working well

* Fixed stage display next scripture text not working #2636

* Stage sizes auto update when window size changes #2604
- Smaller stage labels on small screens

* Auto detect new media/project files

* Skip too large string type files when importing

* Timer easly warning color #2581

* Fixed API scripture next/previous verse not working #2627

* Add verse select (#2630)

* Add verse select

* Move play button on mobile

* macOS go back workaround #2614

* Style template only used as preview if all outputs styles has a custom template #2608

* Replace certain scripture HTML tags #2553

* B1.Church songs import fix

* Tweaks

* fix: search all lines for customType markers in scripture auto-sizing (#2648)

* fix: search all lines for customType markers in scripture auto-sizing

The customTypeRatio calculation was only searching the first line (lines[0])
for verse numbers marked with customType: 'disableTemplate'. In templates
where verse numbers appear in other lines (e.g., line 1), this caused the
ratio to default to 1.0 instead of the correct value (e.g., 0.6 for 60px
verse numbers).

This resulted in inconsistent auto-sizing where some verses would be
calculated with extremely small font sizes because the algorithm treated
the verse number as if it should be the same size as the verse text.

Fixed by iterating through all lines to find customType markers in both:
- deriveCustomTypeRatio() function
- calculateAutosize() function

Now correctly calculates the verse number to text ratio regardless of
which line contains the verse numbers.

* Fixed formatting

---------

Co-authored-by: Kristoffer <kristoffervassbo@gmail.com>

* Fix scripture template override applying wrong styles to verses 2+ (#2653)

* Fix scripture template override applying wrong styles to verses 2+

When using 'Overwrite Scripture with Template' in output styles, verses beyond the first were getting matched to the wrong template text object (falling back to text[0] which is the verse number template instead of verse text template).

Now intelligently matches verse text objects to {scripture_text} placeholder and verse numbers to {scripture_number} placeholder based on customType flag.

* Fixed formatting
- Fixed type

---------

Co-authored-by: Kristoffer <kristoffervassbo@gmail.com>

* Trying to remove extra fullscreen menu #2651

* Fixing errors

* Updates

* ChurchApps Cloud Sync (#2655)

* ChurchApps Cloud Sync

* Progress
- Fixed async rename/delete not awaited

* Updates

* Changed hostname
- Fixed too many open files backup issue

* Attach file as blob.  Fetch from S3 instead of API

* Fixed latest zip deleted

* Backup downloads supress errors

* Fixed id issue

* Updated my teams api url

* Tweaks

* Updates

* Fix

* Finalizing

---------

Co-authored-by: Jeremy Zongker <jeremy@zongker.net>

* Cloud updates
- Version update
- Audit fixes

* Fixes

---------

Co-authored-by: Jeremy Zongker <jeremy@zongker.net>
Co-authored-by: Gladson Sam <115465353+gladsonsam@users.noreply.github.com>
Co-authored-by: Yuri Vidal <yurividal@users.noreply.github.com>
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.

2 participants