@use "../../shared/messages/" as *;

/* W0003: Images should have a meaningful alt value */

$suspiciousAltFull: "image", "graphic", "photo", "photograph", "drawing", "painting", "artwork", "logo", "bullet", "button", "arrow", "more", "spacer", "blank", "chart", "table", "diagram", "graph", "*", " ";
$suspiciousAltEnd: ".png", ".gif", ".jpg", ",jpeg", ".svg", ".bmp", ".webp", ".ivaf", "image", "graphic", "logo";
$suspiciousAltStart: "graphic of", "bullet", "image of", "logo of", "logo for";

%imageMeaningfulAlt {
  @include vectorMessage(warning, "W0003", 400, "Alt text must", "describe the content of the image.");
}

@each $alt in $suspiciousAltFull {
  img[alt="#{$alt}"i] {
    @extend %imageMeaningfulAlt;
  }
}

@each $alt in $suspiciousAltEnd {
  img[alt$="#{$alt}"i] {
    @extend %imageMeaningfulAlt;
  }
}

@each $alt in $suspiciousAltStart {
  img[alt^="#{$alt}"i] {
    @extend %imageMeaningfulAlt;
  }
}

/* W0015: longdesc attribute is deprecated */

img[longdesc] {
  @include vectorMessage(warning, "W0015", 450, "longdesc attribute is", "deprecated and should be avoided.");
}
