Classify HTML bogus comments as comment tokens
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 66/100
Hướng nghiên cứu
Start in HTMLParser.parseHtml, at the branch that handles < ! ... > and currently only recognises [ marked sections and -- comments; everything else falls through to declaration token D. Read how the C token is emitted for <!-- --> and mirror that path for the bogus-comment form, then confirm via HTML::TokeParser that <! comment !> yields ['C', ...]. Reproduce first with the ignore_comments snippet, then add token-classification and diff regression tests and run t/text_diff.t on both the JVM and interpreter backends.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The HTML::Parser implementation classifies the HTML bogus comment <! comment !> as a declaration. System Perl classifies the same token as a comment. This causes callers that ignore comments to retain the token and report a false HTML difference.
Reproduction
With HTML-Differences 0.01:
use HTML::Differences qw(html_text_diff);
my $left = '<p>x</p>';
my $right = '<p>x</p><! comment !>';
print html_text_diff($left, $right, ignore_comments => 1);
Expected: an empty string, because the only difference is a comment and ignore_comments is enabled.
Actual on PerlOnJava: the diff includes <! comment !> as an added line.
A direct token check isolates the discrepancy: HTML::TokeParser under system Perl emits ['C', '<! comment !>']; PerlOnJava emits ['D', '<! comment !>']. HTML::Differences::diffable_html dispatches C tokens to its comment handler, which drops them when ignore_comments is true. A D token goes to the declaration handler and is kept, so the option is bypassed.
Evidence
- CPAN distribution: HTML-Differences 0.01; tester run
20261120-195805-13340. - Upstream system-Perl oracle: all 14 tests passed, including
t/text_diff.t. - PerlOnJava:
t/text_diff.tfails itsno diff found when comment differs and told to ignore commentsassertion. - The same failure reproduces on JVM and interpreter backends.
- Runtime reports Perl 5.44.1, Java 24.0.2, macOS (Darwin 25.6). The tester's system-Perl oracle used Perl 5.42.2.
- The module is pure Perl; no native dependency or external service is involved.
Root cause
In HTMLParser.parseHtml, the branch handling <!...> recognizes marked sections beginning with [ and comments beginning with --. Every other form is emitted as a declaration. It does not implement HTML::Parser's bogus-comment handling for <! ... >, which is why <! comment !> receives token type D rather than C.
Acceptance criteria
<! comment !>is emitted as a comment token by HTML::TokeParser, matching system Perl.- The minimal
ignore_commentsreproducer returns an empty string on JVM and interpreter backends. - Add focused project-owned regression coverage for token classification and ignored-comment diffing, validated against system Perl.
- Re-run HTML-Differences 0.01
t/text_diff.ton both PerlOnJava backends.
- Ngôn ngữ chính
- Perl
- Star
- 67
- Fork
- 8
- Merge trung bình
- 5 giờ 12 phút
- Pull request đã merge (30 ngày)
- 131
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fglock/PerlOnJava
-
area:cpan-port bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fglock/PerlOnJava#2153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port area:parser bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fglock/PerlOnJava#2137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:backend area:cpan-port area:runtime bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fglock/PerlOnJava#2071 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:runtime documentation enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fglock/PerlOnJava#1579 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
fglock/PerlOnJava#2157 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fglock/PerlOnJava
Issue tương tự
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling linksĐang mởteam-cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
inverse-inc/packetfence#9728 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(char-create): show the real reason a character is refusedCó thể đã có người làm @baphomello đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày