@@ -23,14 +23,15 @@ public class ProfileMerger {
2323 private static final String PDFUA_FOLDER = "PDF_UA/" ;
2424
2525 private static final String WCAG_MACHINE_PROFILE_NAME = "WCAG-2-2-Machine.xml" ;
26+ private static final String WCAG_MACHINE_PDF20_PROFILE_NAME = "WCAG-2-2-Machine-PDF20.xml" ;
2627 private static final String PATH = "veraPDF-validation-profiles-" + branchName + "/" ;
27- private static final Set <String > excludedPDFUA1Tags = new HashSet <>();
28+ private static final Set <String > excludedPDFUATags = new HashSet <>();
2829 static {
29- excludedPDFUA1Tags .add ("major" );
30- excludedPDFUA1Tags .add ("minor" );
31- excludedPDFUA1Tags .add ("critical" );
32- excludedPDFUA1Tags .add ("cosmetic" );
33- excludedPDFUA1Tags .add ("machine" );
30+ excludedPDFUATags .add ("major" );
31+ excludedPDFUATags .add ("minor" );
32+ excludedPDFUATags .add ("critical" );
33+ excludedPDFUATags .add ("cosmetic" );
34+ excludedPDFUATags .add ("machine" );
3435 }
3536
3637 public static void main (String [] args ) throws IOException {
@@ -95,8 +96,17 @@ private static void updatePDFUAProfiles(ZipFile zipSource) {
9596 excludedWCAGRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_1 , "7.18.5" , 2 ));
9697 excludedWCAGRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_1 , "7.21.4.2" , 1 ));
9798 excludedWCAGRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_1 , "7.21.4.2" , 2 ));
98- generateProfile (zipSource , "WCAG-2-2-Complete.xml" , PDFUA_FOLDER , new String []{"WCAG/2.2" , "WCAG/PDF_UA" , "1" }, new String []{}, excludedWCAGRules );
99- generateProfile (zipSource , WCAG_MACHINE_PROFILE_NAME , PDFUA_FOLDER , new String []{"WCAG/2.2" , "WCAG/PDF_UA" , "1" }, new String []{}, excludedWCAGRules );
99+ generateProfile (zipSource , "WCAG-2-2-Complete.xml" , PDFUA_FOLDER , new String []{"WCAG/2.2" , "WCAG/PDF_UA/1" , "1" }, new String []{}, excludedWCAGRules );
100+ generateProfile (zipSource , WCAG_MACHINE_PROFILE_NAME , PDFUA_FOLDER , new String []{"WCAG/2.2" , "WCAG/PDF_UA/1" , "1" }, new String []{}, excludedWCAGRules );
101+ excludedWCAGRules = new ArrayList <>(5 );
102+ excludedWCAGRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 1 ));
103+ excludedWCAGRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 2 ));
104+ excludedWCAGRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 3 ));
105+ excludedWCAGRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 4 ));
106+ excludedWCAGRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 5 ));
107+ //other
108+ generateProfile (zipSource , "WCAG-2-2-Complete-PDF20.xml" , PDFUA_FOLDER , new String []{"WCAG/2.2" , "WCAG/PDF_UA/2" , "2" }, new String []{}, excludedWCAGRules );
109+ generateProfile (zipSource , WCAG_MACHINE_PDF20_PROFILE_NAME , PDFUA_FOLDER , new String []{"WCAG/2.2" , "WCAG/PDF_UA/2" , "2" }, new String []{}, excludedWCAGRules );
100110 List <RuleId > excludedWTPDFRules = new ArrayList <>(excludedTaggedRules );
101111 excludedWTPDFRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 1 ));
102112 excludedWTPDFRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 2 ));
@@ -183,10 +193,13 @@ private static void addRules(String generalProfileName, ValidationProfile profil
183193 if (generalProfileName .contains ("WTPDF" )) {
184194 rule = updatePDFUA2RuleToWTPDF (rule );
185195 }
186- if (generalProfileName .contains ("PDFUA-1" )) {
187- rule = updatePDFUA1RuleTags (rule );
196+ if (generalProfileName .contains ("PDFUA-1" ) || generalProfileName .contains ("PDFUA-2" ) ||
197+ generalProfileName .contains ("WTPDF" )) {
198+ rule = updatePDFUARuleTags (rule );
188199 }
189- if (generalProfileName .contains (WCAG_MACHINE_PROFILE_NAME ) && !rule .getTagsSet ().contains ("machine" )) {
200+ if ((generalProfileName .contains (WCAG_MACHINE_PROFILE_NAME ) ||
201+ generalProfileName .contains (WCAG_MACHINE_PDF20_PROFILE_NAME )) &&
202+ !rule .getTagsSet ().contains ("machine" )) {
190203 continue ;
191204 }
192205 rules .add (rule );
@@ -235,8 +248,8 @@ private static Rule updatePDFA2RuleToPDFA3(Rule rule) {
235248 rule .getTest (), rule .getError (), references );
236249 }
237250
238- private static Rule updatePDFUA1RuleTags (Rule rule ) {
239- String tags = Arrays .stream (rule .getTags ().split ("," )).filter (tag -> !excludedPDFUA1Tags .contains (tag )).collect (Collectors .joining ("," ));
251+ private static Rule updatePDFUARuleTags (Rule rule ) {
252+ String tags = Arrays .stream (rule .getTags ().split ("," )).filter (tag -> !excludedPDFUATags .contains (tag )).collect (Collectors .joining ("," ));
240253 return Profiles .ruleFromValues (rule .getRuleId (), rule .getObject (), rule .getDeferred (), tags , rule .getDescription (),
241254 rule .getTest (), rule .getError (), rule .getReferences ());
242255 }
0 commit comments