Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
pagedjs
pagedjs
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 153
    • Issues 153
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 11
    • Merge Requests 11
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Tools
  • pagedjspagedjs
  • Issues
  • #253

Closed
Open
Opened Sep 29, 2020 by Raido Kaldma@raidokaldma
  • Report abuse
  • New issue
Report abuse New issue

Paged.js generates duplicate content (an example with single text element)

First of all, thank you for an awesome libary.

And now strictly to the point, if source html contains repeated text, generated page contains duplicate content:

See attached HTML:

  • Source html contains single <p> element with text Coxswain Jack Tar hearties repeated 10 times.
  • Generated page contains text Coxswain Jack Tar hearties 41 times: image

After doing some debugging, it seems be an issue with chunking of the text element: https://gitlab.pagedmedia.org/tools/pagedjs/blob/master/src/chunker/layout.js#L393

I was able to work around the issue by replacing:

offset += node.textContent.indexOf(container.textContent);

with:

offset += node.textContent.length - container.textContent.length;

Unfortunately I do not know your codebase too well to submit a pull request, but I hope it will be a good lead for fixing the bug.

HTML for reproducing the issue: pagedjs-bug-duplicated-text.html

Edited Sep 29, 2020 by Raido Kaldma
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: tools/pagedjs#253