@@ -18,6 +18,7 @@ import org.readium.r2.shared.InternalReadiumApi
18
18
import org.readium.r2.shared.JSONable
19
19
import org.readium.r2.shared.extensions.*
20
20
import org.readium.r2.shared.publication.Accessibility.AccessMode.Companion.toJSONArray
21
+ import org.readium.r2.shared.publication.Accessibility.Exemption.Companion.toJSONArray
21
22
import org.readium.r2.shared.publication.Accessibility.Feature.Companion.toJSONArray
22
23
import org.readium.r2.shared.publication.Accessibility.Hazard.Companion.toJSONArray
23
24
import org.readium.r2.shared.publication.Accessibility.PrimaryAccessMode.Companion.toJSONArray
@@ -46,16 +47,19 @@ import org.readium.r2.shared.util.logging.log
46
47
* supported enhancements for accessibility.
47
48
* @property [hazards] A characteristic of the described resource that is physiologically
48
49
* dangerous to some users.
50
+ * @property [exemptions] Justifications for non-conformance based on exemptions in a given
51
+ * jurisdiction.
49
52
*/
50
53
@Parcelize
51
54
public data class Accessibility (
52
- val conformsTo : Set <Profile >,
55
+ val conformsTo : Set <Profile > = emptySet() ,
53
56
val certification : Certification ? = null ,
54
57
val summary : String? = null ,
55
- val accessModes : Set <AccessMode >,
56
- val accessModesSufficient : Set <Set <PrimaryAccessMode >>,
57
- val features : Set <Feature >,
58
- val hazards : Set <Hazard >,
58
+ val accessModes : Set <AccessMode > = emptySet(),
59
+ val accessModesSufficient : Set <Set <PrimaryAccessMode >> = emptySet(),
60
+ val features : Set <Feature > = emptySet(),
61
+ val hazards : Set <Hazard > = emptySet(),
62
+ val exemptions : Set <Exemption > = emptySet(),
59
63
) : JSONable, Parcelable {
60
64
61
65
/* *
@@ -66,18 +70,48 @@ public data class Accessibility(
66
70
67
71
public companion object {
68
72
73
+ /* * EPUB Accessibility 1.0 - WCAG 2.0 Level A */
69
74
public val EPUB_A11Y_10_WCAG_20_A : Profile = Profile (
70
75
" http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"
71
76
)
72
77
78
+ /* * EPUB Accessibility 1.0 - WCAG 2.0 Level AA */
73
79
public val EPUB_A11Y_10_WCAG_20_AA : Profile = Profile (
74
80
" http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"
75
81
)
76
82
83
+ /* * EPUB Accessibility 1.0 - WCAG 2.0 Level AAA */
77
84
public val EPUB_A11Y_10_WCAG_20_AAA : Profile = Profile (
78
85
" http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"
79
86
)
80
87
88
+ /* * EPUB Accessibility 1.1 - WCAG 2.0 Level A */
89
+ public val EPUB_A11Y_11_WCAG_20_A : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a" )
90
+
91
+ /* * EPUB Accessibility 1.1 - WCAG 2.0 Level AA */
92
+ public val EPUB_A11Y_11_WCAG_20_AA : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa" )
93
+
94
+ /* * EPUB Accessibility 1.1 - WCAG 2.0 Level AAA */
95
+ public val EPUB_A11Y_11_WCAG_20_AAA : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa" )
96
+
97
+ /* * EPUB Accessibility 1.1 - WCAG 2.1 Level A */
98
+ public val EPUB_A11Y_11_WCAG_21_A : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a" )
99
+
100
+ /* * EPUB Accessibility 1.1 - WCAG 2.1 Level AA */
101
+ public val EPUB_A11Y_11_WCAG_21_AA : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa" )
102
+
103
+ /* * EPUB Accessibility 1.1 - WCAG 2.1 Level AAA */
104
+ public val EPUB_A11Y_11_WCAG_21_AAA : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa" )
105
+
106
+ /* * EPUB Accessibility 1.1 - WCAG 2.2 Level A */
107
+ public val EPUB_A11Y_11_WCAG_22_A : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a" )
108
+
109
+ /* * EPUB Accessibility 1.1 - WCAG 2.2 Level AA */
110
+ public val EPUB_A11Y_11_WCAG_22_AA : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa" )
111
+
112
+ /* * EPUB Accessibility 1.1 - WCAG 2.2 Level AAA */
113
+ public val EPUB_A11Y_11_WCAG_22_AAA : Profile = Profile (" https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa" )
114
+
81
115
public fun Set<Profile>.toJSONArray (): JSONArray =
82
116
JSONArray (this .map(Profile ::uri))
83
117
}
@@ -305,10 +339,32 @@ public data class Accessibility(
305
339
*/
306
340
public val INDEX : Feature = Feature (" index" )
307
341
342
+ /* *
343
+ * The resource includes static page markers, such as those identified by the
344
+ * doc-pagebreak role (DPUB-ARIA-1.0).
345
+ *
346
+ * This value is most commonly used with ebooks for which there is a statically
347
+ * paginated equivalent, such as a print edition, but it is not required that the page
348
+ * markers correspond to another work. The markers may exist solely to facilitate
349
+ * navigation in purely digital works.
350
+ */
351
+ public val PAGE_BREAK_MARKERS : Feature = Feature (" pageBreakMarkers" )
352
+
353
+ /* *
354
+ * The resource includes a means of navigating to static page break locations.
355
+ *
356
+ * The most common way of providing page navigation in digital publications is through
357
+ * a page list.
358
+ */
359
+ public val PAGE_NAVIGATION : Feature = Feature (" pageNavigation" )
360
+
308
361
/* *
309
362
* The work includes equivalent print page numbers. This setting is most commonly used
310
363
* with ebooks for which there is a print equivalent.
364
+ *
365
+ * Deprecated: https://github.com/readium/go-toolkit/issues/92
311
366
*/
367
+ @Deprecated(" Deprecated in favor of PAGE_NAVIGATION" , ReplaceWith (" PAGE_NAVIGATION" ))
312
368
public val PRINT_PAGE_NUMBERS : Feature = Feature (" printPageNumbers" )
313
369
314
370
/* *
@@ -553,6 +609,65 @@ public data class Accessibility(
553
609
}
554
610
}
555
611
612
+ /* *
613
+ * [Exemption] allows content creators to identify publications that do not meet conformance
614
+ * requirements but fall under exemptions in a given juridiction.
615
+ *
616
+ * While this list is currently limited to exemptions covered by the European Accessibility Act,
617
+ * it will be extended to cover additional exemptions in the future.
618
+ */
619
+ @Parcelize
620
+ public data class Exemption (public val value : String ) : Parcelable {
621
+
622
+ public companion object {
623
+
624
+ /* *
625
+ * Article 14, paragraph 1 of the European Accessibility Act states that its
626
+ * accessibility requirements shall apply only to the extent that compliance: … (b) does
627
+ * not result in the imposition of a disproportionate burden on the economic operators
628
+ * concerned
629
+ *
630
+ * https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?
631
+ */
632
+ public val EAA_DISPROPORTIONATE_BURDEN : Exemption = Exemption (" eaa-disproportionate-burden" )
633
+
634
+ /* *
635
+ * Article 14, paragraph 1 of the European Accessibility Act states that its
636
+ * accessibility requirements shall apply only to the extent that compliance: (a) does
637
+ * not require a significant change in a product or service that results in the
638
+ * fundamental alteration of its basic nature
639
+ *
640
+ * https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32019L0882#d1e2148-70-1
641
+ */
642
+ public val EAA_FUNDAMENTAL_ALTERATION : Exemption = Exemption (" eaa-fundamental-alteration" )
643
+
644
+ /* *
645
+ * The European Accessibility Act defines a microenterprise as: an enterprise which
646
+ * employs fewer than 10 persons and which has an annual turnover not exceeding EUR 2
647
+ * million or an annual balance sheet total not exceeding EUR 2 million.
648
+ *
649
+ * It further states in Article 4, paragraph 5: Microenterprises providing services
650
+ * shall be exempt from complying with the accessibility requirements referred to in
651
+ * paragraph 3 of this Article and any obligations relating to the compliance with those
652
+ * requirements.
653
+ *
654
+ * https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32019L0882#d1e1798-70-1
655
+ */
656
+ public val EAA_MICROENTERPRISE : Exemption = Exemption (" eaa-microenterprise" )
657
+
658
+ /* *
659
+ * Creates a list of [Exemption] from its RWPM JSON representation.
660
+ */
661
+ public fun fromJSONArray (json : JSONArray ? ): List <Exemption > =
662
+ json?.filterIsInstance(String ::class .java)
663
+ ?.map { Exemption (it) }
664
+ .orEmpty()
665
+
666
+ public fun Set<Exemption>.toJSONArray (): JSONArray =
667
+ JSONArray (this .map(Exemption ::value))
668
+ }
669
+ }
670
+
556
671
override fun toJSON (): JSONObject = JSONObject ().apply {
557
672
putIfNotEmpty(" conformsTo" , conformsTo.toJSONArray())
558
673
put(" certification" , certification?.toJSON())
@@ -561,6 +676,7 @@ public data class Accessibility(
561
676
putIfNotEmpty(" accessModeSufficient" , accessModesSufficient.map { it.toJSONArray() })
562
677
putIfNotEmpty(" hazard" , hazards.toJSONArray())
563
678
putIfNotEmpty(" feature" , features.toJSONArray())
679
+ putIfNotEmpty(" exemption" , exemptions.toJSONArray())
564
680
}
565
681
566
682
public companion object {
@@ -592,6 +708,7 @@ public data class Accessibility(
592
708
593
709
val features = Feature .fromJSONArray(json.remove(" feature" ) as ? JSONArray )
594
710
val hazards = Hazard .fromJSONArray(json.remove(" hazard" ) as ? JSONArray )
711
+ val exemptions = Exemption .fromJSONArray(json.remove(" exemption" ) as ? JSONArray )
595
712
596
713
return Accessibility (
597
714
conformsTo = conformsTo.toSet(),
@@ -600,7 +717,8 @@ public data class Accessibility(
600
717
accessModes = accessModes.toSet(),
601
718
accessModesSufficient = accessModesSufficient.toSet(),
602
719
features = features.toSet(),
603
- hazards = hazards.toSet()
720
+ hazards = hazards.toSet(),
721
+ exemptions = exemptions.toSet()
604
722
)
605
723
}
606
724
}
0 commit comments