Skip to content

XML comments in FB2 are not ignored but displayed to the user as normal book content #972

@van-de-bugger

Description

@van-de-bugger

Bug description

FB2 format is XML-based. XML allows comments (<!-- ... -->), which should be ignored, but Foliate shows them as book content. Here is an example:

<?xml version="1.0" encoding="UTF-8"?>
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
<body>
  <title>
    <!-- This is a comment. Foliate should *not* display it. -->
    <p>Author</p>
    <p>Book Title</p>
  </title>
   <section>
     <title>
       <p>Chaper One</p>
     </title>
     <p>Lorem ipsum.</p>
   </section>
</body>
</FictionBook>

Note line 5: <!-- This is a comment. Foliate should *not* display it. -->. It is a comment, not a part of book text. It is expected comments are not displayed to book readers, but Foliate displays them. Moreover, Foliate strips <!-- and -->, so comments are presented to the user as normal book content.

To Reproduce

  1. Download the attachment: example.fb2.zip (It is a copy of the example above, zipped because github does not allow to upload *.fb2 files.)
  2. Start Foliate.
  3. Open the downloaded example.fb2.zip file.
  4. Look the the book text. It starts with "This is a comment. Foliate should not display it."

Expected behavior

Text "This is a comment. Foliate should *not* display it." is not displayed.

Screenshots

Screenshot from 2022-11-10 14-52-03
Text "This is a comment. Foliate should *not* display it." should not be displayed.

Version:

  • Foliate version: 2.6.4
  • OS/Distribution and version: Fedora 36
  • Desktop environment: GNOME 42
  • Installation method: RPM (foliate-2.6.4-2.fc36.noarch)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions