@@ -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,16 @@ 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+ generateProfile (zipSource , "WCAG-2-2-Complete-PDF20.xml" , PDFUA_FOLDER , new String []{"WCAG/2.2" , "WCAG/PDF_UA/2" , "2" }, new String []{}, excludedWCAGRules );
108+ generateProfile (zipSource , WCAG_MACHINE_PDF20_PROFILE_NAME , PDFUA_FOLDER , new String []{"WCAG/2.2" , "WCAG/PDF_UA/2" , "2" }, new String []{}, excludedWCAGRules );
100109 List <RuleId > excludedWTPDFRules = new ArrayList <>(excludedTaggedRules );
101110 excludedWTPDFRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 1 ));
102111 excludedWTPDFRules .add (Profiles .ruleIdFromValues (PDFAFlavour .Specification .ISO_14289_2 , "5" , 2 ));
@@ -183,10 +192,13 @@ private static void addRules(String generalProfileName, ValidationProfile profil
183192 if (generalProfileName .contains ("WTPDF" )) {
184193 rule = updatePDFUA2RuleToWTPDF (rule );
185194 }
186- if (generalProfileName .contains ("PDFUA-1" )) {
187- rule = updatePDFUA1RuleTags (rule );
195+ if (generalProfileName .contains ("PDFUA-1" ) || generalProfileName .contains ("PDFUA-2" ) ||
196+ generalProfileName .contains ("WTPDF" )) {
197+ rule = updatePDFUARuleTags (rule );
188198 }
189- if (generalProfileName .contains (WCAG_MACHINE_PROFILE_NAME ) && !rule .getTagsSet ().contains ("machine" )) {
199+ if ((generalProfileName .contains (WCAG_MACHINE_PROFILE_NAME ) ||
200+ generalProfileName .contains (WCAG_MACHINE_PDF20_PROFILE_NAME )) &&
201+ !rule .getTagsSet ().contains ("machine" )) {
190202 continue ;
191203 }
192204 rules .add (rule );
@@ -235,8 +247,8 @@ private static Rule updatePDFA2RuleToPDFA3(Rule rule) {
235247 rule .getTest (), rule .getError (), references );
236248 }
237249
238- private static Rule updatePDFUA1RuleTags (Rule rule ) {
239- String tags = Arrays .stream (rule .getTags ().split ("," )).filter (tag -> !excludedPDFUA1Tags .contains (tag )).collect (Collectors .joining ("," ));
250+ private static Rule updatePDFUARuleTags (Rule rule ) {
251+ String tags = Arrays .stream (rule .getTags ().split ("," )).filter (tag -> !excludedPDFUATags .contains (tag )).collect (Collectors .joining ("," ));
240252 return Profiles .ruleFromValues (rule .getRuleId (), rule .getObject (), rule .getDeferred (), tags , rule .getDescription (),
241253 rule .getTest (), rule .getError (), rule .getReferences ());
242254 }
0 commit comments