@@ -0,0 +1,2736 @@
+/*%0A * Tanaguru - Automated webpage assessment%0A * Copyright (C) 2008-2017  Tanaguru.org%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as%0A * published by the Free Software Foundation, either version 3 of the%0A * License, or (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A *%0A * Contact us by mail: tanaguru AT tanaguru DOT org%0A */%0Apackage org.tanaguru.rules.rgaa32017;%0A%0Aimport java.util.Iterator;%0Aimport java.util.regex.Pattern;%0Aimport org.jsoup.nodes.Element;%0Aimport org.tanaguru.processor.SSPHandler;%0Aimport org.tanaguru.ruleimplementation.AbstractPageRuleWithSelectorAndCheckerImplementation;%0Aimport org.tanaguru.rules.elementchecker.headings.HeadingsHierarchyChecker;%0Aimport org.tanaguru.rules.elementselector.SimpleElementSelector;%0Aimport static org.tanaguru.rules.keystore.CssLikeQueryStore.HEADINGS_CSS_LIKE_QUERY;%0Aimport static org.tanaguru.rules.keystore.CssLikeQueryStore.ARIA_HEADINGS_CSS_LIKE_QUERY;%0A%0A/**%0A * Implementation of the rule 9.1.2 of the referential Rgaa 3-2017.%0A * %3Cbr/%3E%0A * For more details about the implementation, refer to %3Ca%0A * href=%22http://tanaguru-rules-rgaa3.readthedocs.org/en/latest/Rule-9-1-2%22%3Ethe rule 9.1.2%0A * design page.%3C/a%3E%0A *%0A * @see %3Ca%0A * href=%22http://references.modernisation.gouv.fr/referentiel-technique-0#test-9-1-2%22%3E%0A * 9.1.2 rule specification%3C/a%3E%0A *%0A */%0Apublic class Rgaa32017Rule090102 extends AbstractPageRuleWithSelectorAndCheckerImplementation %7B%0A%0A    private static final Pattern PATTERN = Pattern.compile(%22%5B1-9%5D%5B0-9%5D?%22);%0A%0A    /**%0A     * Default constructor%0A     */%0A    public Rgaa32017Rule090102() %7B%0A        super(%0A                new SimpleElementSelector(%0A                HEADINGS_CSS_LIKE_QUERY + %22, %22 + ARIA_HEADINGS_CSS_LIKE_QUERY),%0A                new HeadingsHierarchyChecker());%0A    %7D%0A%0A    @Override%0A    protected void select(SSPHandler sspHandler) %7B%0A        super.select(sspHandler);%0A        Iterator%3CElement%3E elementsIterator = getElements().get().iterator();%0A        while (elementsIterator.hasNext()) %7B%0A            Element element = elementsIterator.next();%0A            if (element.hasAttr(%22aria-level%22)) %7B%0A                if (!PATTERN.matcher(element.attr(%22aria-level%22)).matches()) %7B%0A                    elementsIterator.remove();%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A    %0A%7D%0A

Add implementation rule Rgaa32017Rule090102