Documentation
¶
Overview ¶
Package paddiff is a port of the original Etherpad src/node/utils/padDiff.ts.
It composes the changesets between two revisions of a pad into a single "diff" atext: all insertions of the range keep their author attribution and all deletions are re-inserted at the position they were deleted from, carrying a 'removed' attribute plus the author who deleted them. The resulting atext can be rendered with the regular export-HTML pipeline (lib/io/exportHtml.go understands the 'removed' attribute) to visualize the changes between the two revisions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDiffAText ¶
func CreateDiffAText(p Pad, pool *apool.APool, fromRev int, toRev int) (*apool.AText, []string, error)
CreateDiffAText builds the diff atext between fromRev and toRev (both inclusive endpoints of the revision range, fromRev <= toRev <= head) and returns it together with the list of authors that contributed changes in that range. Like the original PadDiff, it adds the needed 'author' and 'removed' attributes to the supplied pool (in memory only; the pad record itself is not saved).
func GetValidRevisionRange ¶
GetValidRevisionRange mirrors Pad.getValidRevisionRange of the original Etherpad: startRev must lie within [0, head]; endRev defaults to head when nil, is clamped to head and must not be lower than startRev. ok is false when the range is invalid.