diff --git a/openupgradelib/openupgrade_160.py b/openupgradelib/openupgrade_160.py index f5740b6f..cf1df528 100644 --- a/openupgradelib/openupgrade_160.py +++ b/openupgradelib/openupgrade_160.py @@ -82,6 +82,21 @@ def migrate_translations_to_jsonb(env, fields_spec): "rounded", ) +_MARGIN_PADDING_ELEMENT_REPLACEMENT = ( + ("pl", "ps"), + ("ml", "ms"), + ("pr", "pr"), + ("mr", "me"), +) + +_MARGIN_PADDING_SIZE = ( + "0", "1", "2", "3", "4", "5", "auto" +) + +_MARGIN_PADDING = ( + "sm", "lg" +) + # These replacements are from standard Bootstrap 4 to 5 _BS5_REPLACEMENTS = ( # Grid stuff @@ -105,13 +120,29 @@ def migrate_translations_to_jsonb(env, fields_spec): _r("pr", "pe"), _r("ml", "ms"), _r("mr", "me"), + # For stub like pl-0 -> ps-0 + *( + _r("%s-%s" % (t4, size), "%s-%s" % (t5, size)) + for (t4, t5), size in product( + _MARGIN_PADDING_ELEMENT_REPLACEMENT, _MARGIN_PADDING_SIZE + ) + ), + # For stub like ml-sm-1 -> ms-sm-1 + *( + _r("%s-%s-%s" % (t4, context, size), "%s-%s-%s" % (t5, context, size)) + for (t4, t5), context, size in product( + _MARGIN_PADDING_ELEMENT_REPLACEMENT, _MARGIN_PADDING,_MARGIN_PADDING_SIZE + ) + ), # Forms _r("custom-control", "form-control"), - _r("custom-check", "form-check"), + _r("custom-checkbox", "form-check"), _r("custom-control-input", "form-check-input"), _r("custom-control-label", "form-check-label"), _r("custom-switch", "form-switch"), _r("custom-select", "form-select"), + _r("custom-select-sm", "form-select-sm"), + _r("custom-select-lg", "form-select-lg"), _r("custom-range", "form-range"), _r("form-control-file", "form-control"), _r("form-control-range", "form-control"), @@ -148,8 +179,8 @@ def migrate_translations_to_jsonb(env, fields_spec): _r("font-weight-normal", "fw-normal"), _r("font-italic", "fst-italic"), _r("font-normal", "fst-normal"), - _r("rounded-sm", "rounded-0"), - _r("rounded-lg", "rounded-1"), + _r("rounded-sm", "rounded-1"), + _r("rounded-lg", "rounded-3"), # Helpers _r(selector="embed-responsive-item", class_rm="embed-responsive-item"), _r("sr-only", "visually-hidden"), @@ -235,20 +266,15 @@ def migrate_translations_to_jsonb(env, fields_spec): selector_mode="xpath", attr_rp={"data-focus": "data-bs-focus"}, ), - _attr_replace( - selector="//*[@data-parent]", - selector_mode="xpath", - attr_rp={"data-parent": "data-bs-parent"}, - ), _attr_replace( selector="//*[@data-content]", selector_mode="xpath", attr_rp={"data-content": "data-bs-content"}, ), _attr_replace( - selector="//*[@data-parent]", + selector="//*[@data-placement]", selector_mode="xpath", - attr_rp={"data-parent": "data-bs-parent"}, + attr_rp={"data-placement": "data-bs-placement"}, ), )