<commit_before>package com.intellij.psi.filters.getters;

import com.intellij.psi.PsiElement;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.xml.util.XmlUtil;
import org.jetbrains.annotations.NonNls;

/**
 * Created by IntelliJ IDEA.
 * User: ik
 * Date: 24.11.2003
 * Time: 14:17:59
 * To change this template use Options | File Templates.
 */
public class HtmlAttributeValueGetter extends XmlAttributeValueGetter {
  private boolean myCaseSensitive;

  public HtmlAttributeValueGetter(boolean _caseSensitive) {
    myCaseSensitive = _caseSensitive;
  }

  @NonNls protected String[] addSpecificCompletions(final PsiElement context) {
    if (!(context instanceof XmlAttribute)) return null;

    XmlAttribute attribute = (XmlAttribute)context;
    @NonNls String name = attribute.getName();
    if (!myCaseSensitive) name = name.toLowerCase();

    final String namespace = attribute.getParent().getNamespace();
    if (XmlUtil.XHTML_URI.equals(namespace) || XmlUtil.HTML_URI.equals(namespace)) {

      if ("target".equals(name)) {
        return new String[] {"_blank","_top","_self","_parent"};
      } else if ("enctype".equals(name)) {
        return new String[] {"multipart/form-data","application/x-www-form-urlencoded"};
      }
    }

    return null;
  }
}<commit_msg>Add completion for link.rel & link.media (IDEADEV-5854)<commit_after>package com.intellij.psi.filters.getters;

import com.intellij.psi.PsiElement;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.xml.util.XmlUtil;
import org.jetbrains.annotations.NonNls;

/**
 * Created by IntelliJ IDEA.
 * User: ik
 * Date: 24.11.2003
 * Time: 14:17:59
 * To change this template use Options | File Templates.
 */
public class HtmlAttributeValueGetter extends XmlAttributeValueGetter {
  private boolean myCaseSensitive;

  public HtmlAttributeValueGetter(boolean _caseSensitive) {
    myCaseSensitive = _caseSensitive;
  }

  @NonNls protected String[] addSpecificCompletions(final PsiElement context) {
    if (!(context instanceof XmlAttribute)) return null;

    XmlAttribute attribute = (XmlAttribute)context;
    @NonNls String name = attribute.getName();
    if (!myCaseSensitive) name = name.toLowerCase();

    final String namespace = attribute.getParent().getNamespace();
    if (XmlUtil.XHTML_URI.equals(namespace) || XmlUtil.HTML_URI.equals(namespace)) {

      if ("target".equals(name)) {
        return new String[] {"_blank","_top","_self","_parent"};
      } else if ("enctype".equals(name)) {
        return new String[] {"multipart/form-data","application/x-www-form-urlencoded"};
      } else if ("rel".equals(name)) {
        return new String[] { "alternate", "stylesheet", "start", "next", "prev", "contents", "index", "glossary", "copyright", "chapter",
          "section", "subsection", "appendix", "help", "bookmark", "script"};
      } else if ("media".equals(name)) {
        return new String[] { "screen", "tty", "tv", "projection", "handheld", "print", "all", "aural", "braille" };
      }
    }

    return null;
  }
}
{'fraction_non_alphanumeric': 0.13943569553805774, 'fraction_numerical': 0.010498687664041995, 'mean_word_length': 4.220890410958904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5832668', 'n_tokens_mistral': 973, 'n_tokens_neox': 924, 'n_words': 214}