feat: add support for .wps and .et - #48
Open
Halfknow wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
.wps(WPS Writer / Microsoft Works text) and.et(WPS Spreadsheet)to the recognized extensions, routing them to the existing
DocandExcelparsers respectively.
Modern WPS Office exports these as OLE2 compound files carrying the same
content streams their Microsoft counterparts mandate —
WordDocumentfor.wps,Workbook/Bookfor.et. anydoc's content-based detection(
from_bytes) already recognizes them by stream name; this change onlyextends extension-based detection (
from_extension/from_path) so filesnamed
.wpsor.etconvert correctly without a rename.Changes
src/lib.rs— register"wps" => Format::Docand"et" => Format::Excelin
Format::from_extension; update theFormat::DocandFormat::Exceldoc comments to note the shared-stream WPS wrappers.
README.md— list.wpsunder Word and.etunder Excel in thesupported-formats table.
No new parser, no new
Formatvariant: both extensions reuse the existingbinary Word (
formats/doc) and spreadsheet (formats/sheetvia calamine)frontends.
Why no binding changes
The Node / wasm / Python
Formatenums are public API surface. Since.wpsand
.etreuse the existingDoc/Excelparsers,format_from_extension("wps")correctly returns the existing
Doc/Xlsxvariant already exposed. Addingnew enum values would break JS/Python callers that branch on these strings,
so they are intentionally left unchanged.
Scope
Covers modern WPS Office / Microsoft Works
.wpsand modern WPS.et— theOLE2-based variants with standard content streams. Legacy WPS 2000-era private
binary containers (no standard streams) are out of scope and degrade safely:
detection returns
None/Unsupportedrather than panicking.Verification
cargo fmt --check✅cargo clippy -p anydoc --all-targets -- -D warnings✅cargo test -p anydoc— 208 unit + 8 snapshot + 1 robustness, all green ✅Format::from_extensionreturnsDocforwps/WPSandExcelforet/ET(case-insensitive); existing mappings unchanged.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.