Skip to content

Show a list item once when its text is wrapped in a paragraph - #787

Merged
mircealungu merged 2 commits into
masterfrom
fix-list-item-duplication
Sep 29, 2026
Merged

mircealungu merged 2 commits into
masterfrom
fix-list-item-duplication

Conversation

@mircealungu

Copy link
Copy Markdown
Member

Reported by teachers in Cyprus: in the student reader every bullet appeared twice, once as a bullet and once as a plain paragraph ("• Container ships" then "Container ships").

The teacher editor (TipTap) saves list items as <li><p>X</p></li>. create_article_fragments iterates soup.find_all(block_elements) recursively, so it emitted the li (which already collects its children's text) and then the nested p again. Now any block with an li ancestor is skipped: its nearest li already covered it. Nested lists still get one fragment per item.

Test

  • New zeeguu/core/test/test_article_fragments.py: li > p, nested lists, plain li and blockquote. The first two fail without the fix.
  • test_article*.py and test_classroom*.py pass.

After deploy

Existing articles keep their duplicated fragments. Rebuild fragments and clear article_tokenization_cache for affected teacher texts, at least 4903885 and 4938085.

🤖 Generated with Claude Code

The teacher editor (TipTap) saves every list item as <li><p>X</p></li>.
create_article_fragments walks all block elements recursively, so it emitted
the li (which already gathers its children's text) and then the nested p
again: students saw each bullet followed by the same text as a paragraph.
Any block inside a list item is now left to its nearest li.

Existing articles keep their duplicated fragments until rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ArchLens - No architecturally relevant changes to the existing views

Skipping every block inside a list item merged an item like
<li><h3>Title</h3><p>A</p><p>B</p></li> into one bullet 'Title A B'.
Now a list item that holds its text in blocks emits those blocks one by
one, and the first carries the bullet. Loose text before the blocks, if
any, is the bullet instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mircealungu
mircealungu merged commit 0e13d41 into master Sep 29, 2026
2 checks passed
@mircealungu
mircealungu deleted the fix-list-item-duplication branch September 29, 2026 12:49
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.

1 participant