Redlines.DOCX (redlines v0.9.2)
View SourceExtract track changes from DOCX files by parsing word/document.xml.
Summary
Functions
Accept tracked changes in a DOCX and return the cleaned DOCX bytes.
Like clean/2, but accepts raw DOCX bytes.
Like clean_binary/2, but also returns informational warnings about revision
markup that was present while cleaning.
Like clean/2, but also returns informational warnings about revision markup
that was present while cleaning.
Extract raw DOCX track changes.
Convert a raw %{insertions: [...], deletions: [...]} map into normalized changes.
Types
@type clean_warning() :: %{ type: :revision_markup, part: String.t(), element: String.t(), count: non_neg_integer() }
Functions
Accept tracked changes in a DOCX and return the cleaned DOCX bytes.
This rewrites XML parts inside the DOCX zip (by default just word/document.xml)
by removing deletions (<w:del>…</w:del>) and unwrapping insertions
(<w:ins>…</w:ins>).
Options
:parts- Zip entry names to clean (default["word/document.xml"])
Like clean/2, but accepts raw DOCX bytes.
@spec clean_binary_with_warnings( binary(), keyword() ) :: {:ok, binary(), [clean_warning()]} | {:error, term()}
Like clean_binary/2, but also returns informational warnings about revision
markup that was present while cleaning.
@spec clean_with_warnings( Path.t(), keyword() ) :: {:ok, binary(), [clean_warning()]} | {:error, term()}
Like clean/2, but also returns informational warnings about revision markup
that was present while cleaning.
Each warning includes the zip :part (e.g. "word/document.xml"), an :element
(e.g. "w:rPrChange") and a :count.
Options
:parts- Zip entry names to clean (default["word/document.xml"])
Extract raw DOCX track changes.
Returns a map with :insertions and :deletions, each containing a list of
maps with keys: :id, :author, :date, and :text.
@spec to_changes(map()) :: [Redlines.Change.t()]
Convert a raw %{insertions: [...], deletions: [...]} map into normalized changes.