package cascade
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c11bbdc7ab0eee8c03cd162e3e7fd1cb20de62beb13342b3b150a89264ee0056
sha512=43fd97a55c3b1dc4db5c87aa1a5a047d902e902ab2064af3a7c5bf945ebc333f8cd90ecca8013c17be5b950498eace8e0094ee4319eba408285e2bec8d7cdf7b
doc/cascade.diff/Cascade_diff/Tree_diff/index.html
Module Cascade_diff.Tree_diffSource
CSS tree difference analysis for structural comparison.
Declaration diff information.
type rule_diff = | Added of {selector : string;declarations : Cascade.Css.declaration list;
}| Removed of {selector : string;declarations : Cascade.Css.declaration list;
}| Content_changed of {selector : string;old_declarations : Cascade.Css.declaration list;new_declarations : Cascade.Css.declaration list;property_changes : declaration list;added_properties : string list;removed_properties : string list;
}| Selector_changed of {old_selector : string;new_selector : string;declarations : Cascade.Css.declaration list;
}| Reordered of {selector : string;expected_pos : int;actual_pos : int;swapped_with : string option;(*When only declaration order changed inside the rule, positions may be irrelevant; in that case
*)old_declarations/new_declarationscarry the before/after declarations to allow detailed pretty-printing.old_declarations : Cascade.Css.declaration list option;new_declarations : Cascade.Css.declaration list option;
}| Regrouped of {}(*A comma group merged or split across rules with identical declarations: the same selectors survive, only the grouping differs.
*)from_selectors/to_selectorsare the rule selectors in expected and actual.
Individual rule changes.
type container_info = {container_type : [ `Media | `Layer | `Supports | `Container | `Property | `Nesting ];condition : string;rules : Cascade.Css.statement list;
}Container rule information.
type container_diff = | Added of container_info| Removed of container_info| Modified of {info : container_info;actual_rules : Cascade.Css.statement list;rule_changes : rule_diff list;container_changes : container_diff list;
}| Reordered of {info : container_info;expected_pos : int;actual_pos : int;
}| Block_structure_changed of {container_type : [ `Media | `Layer | `Supports | `Container | `Property | `Nesting ];condition : string;expected_blocks : (int * Cascade.Css.statement list) list;(*(position, rules) for each block in expected
*)actual_blocks : (int * Cascade.Css.statement list) list;(*(position, rules) for each block in actual
*)
}
Container changes.
Structured CSS differences.
val reorder_is_significant :
Cascade.Css.declaration list ->
Cascade.Css.declaration list ->
boolreorder_is_significant d1 d2 is true when reordering the declarations changes the cascade, i.e. two overlapping declarations swap relative order. A reorder of disjoint declarations is no difference.
diff ~expected ~actual computes structural differences between two CSS ASTs.
pp ?expected ?actual ?color buf t pretty-prints a tree diff with optional labels. Default labels are "Expected" and "Actual". color (default false) wraps diff markers in ANSI escapes; the printer writes into a buffer, so the caller decides whether the destination supports colour.
pp_rule_diff_simple buf rule pretty-prints a rule diff in a simple format suitable for tests.
Query functions
single_rule_diff diff returns Some rule if diff contains exactly one rule change, None otherwise.
val count_containers_by_type :
[ `Container | `Layer | `Media | `Nesting | `Property | `Supports ] ->
t ->
intcount_containers_by_type container_type diff counts containers of the given type in diff.