Skip to content

feat(python, java): support translating HTML strings without wrapping span - #1474

Merged
tushuhei merged 1 commit into
mainfrom
feat/html-no-wrap
Oct 28, 2026
Merged

tushuhei merged 1 commit into
mainfrom
feat/html-no-wrap

Conversation

@tushuhei

Copy link
Copy Markdown
Member

Fixes #1472

Summary

Adds an optional wrap parameter to the HTML translation APIs in Python and Java so callers can retrieve the ZWSP-segmented HTML string directly without an outer <span style="word-break: keep-all; overflow-wrap: anywhere;">...</span> wrapper when they manage parent styling via external CSS or existing parent elements.

Changes

  • Python:
    • Add wrap: bool = True to budoux.html_processor.resolve() and Parser.translate_html_string().
    • Add unit tests in tests/test_html_processor.py and tests/test_parser.py.
  • Java:
    • Expose Parser.PARENT_CSS_STYLE ("word-break: keep-all; overflow-wrap: anywhere;").
    • Add HTMLProcessor.resolve(List<String> phrases, String html, String separator, boolean wrap) and Parser.translateHTMLString(String html, boolean wrap) overloads.
    • Add unit tests in HTMLProcessorTest.java and ParserTest.java.

@tushuhei
tushuhei requested a review from kojiishi October 28, 2026 04:02

@kojiishi kojiishi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tushuhei
tushuhei merged commit a208d5d into main Oct 28, 2026
29 checks passed
@tushuhei
tushuhei deleted the feat/html-no-wrap branch October 29, 2026 07:55
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.

feat(python, java): support translating HTML strings without adding a wrapping <span>

2 participants