Skip to content

Migrate ModestEx from C-Node to lexbor_erl backend#29

Merged
f34nk merged 30 commits intomasterfrom
refactor/use-lexbor_erl
Dec 3, 2025
Merged

Migrate ModestEx from C-Node to lexbor_erl backend#29
f34nk merged 30 commits intomasterfrom
refactor/use-lexbor_erl

Conversation

@f34nk
Copy link
Owner

@f34nk f34nk commented Dec 3, 2025

This PR does:

  • Replace C-Node binding to Modest C library with lexbor_erl Erlang port
  • Remove all C source code, build scripts, and target/ directory (~3800 lines removed)
  • Implement features using lexbor_erl 0.3.0: find, get/set attribute, get/set text, remove, append, prepend, insert_before, insert_after, replace
  • Mark unsupported features (position, wrap, slice, pretty_print) with clear error messages
  • Migrate CI from Travis to GitHub Actions with multi-OS support
  • Update test fixtures for HTML5-compliant output (void elements, boolean attributes)

This can be verified by doing:

  • Run make and verify that all tests pass

f34nk added 30 commits November 30, 2025 17:39
Remove all C-Node bindings, C source code, and build infrastructure from the ModestEx codebase in preparation for migrating to lexbor_erl as the HTML parsing backend. Public API and tests remain unchanged. Feature modules will be reimplemented to use lexbor_erl in subsequent commits.
…astructure.

Refactor mix.exs to use lexbor_erl instead of Modest C-Node bindings. Remove custom compiler, Shell module, and Mix task modules (ModestExCompile, Test.Target). Replace nodex dependency with lexbor_erl v0.1.0. Remove C-Node application configuration (mod, registered). Update description and package links to reference lexbor_erl. Remove target directory and build scripts from package files. Keep scope configuration for backward compatibility.
…ntegration.

Create new helper module with document lifecycle management, scope extraction, and error handling utilities. Implements ensure_started/0 for application startup, with_doc/2 for safe document handling with automatic cleanup, extract_body_children/1, extract_body/1, and extract_head/1 for scope compatibility, apply_scope/2 for scope transformation, and not_implemented/1 for clear error messages. Provides foundation for reimplementing ModestEx features with lexbor_erl backend. Complete with documentation and examples.
Some ModestEx functions are not yet supported by lexbor_erl.
The pseude-class :contains is not implemented yet in Lexbor.
Fixed HTML5 syntax in test fixtures by removing invalid void element closing tags and correcting boolean attribute format. Preserved all original test cases as commented lines with explanations for maintainability.
Use lexbor_erl.append_content/3 for DOM manipulation.
Add special handling for body selector using inner_html workaround.
Skip edge case test for empty document with wildcard selector.
Use lexbor_erl.prepend_content/3 for DOM manipulation.
Add special handling for body selector using inner_html workaround.
@f34nk f34nk merged commit 1eb2c87 into master Dec 3, 2025
2 checks passed
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