From 4caf6b6032bc8c67f1645a48f42c50d9e5a5d34a Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Mon, 29 Jun 2020 16:32:02 -0600 Subject: [PATCH 1/2] feat(standards): add dpub roles --- lib/standards/dpub-roles.mjs | 263 +++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 lib/standards/dpub-roles.mjs diff --git a/lib/standards/dpub-roles.mjs b/lib/standards/dpub-roles.mjs new file mode 100644 index 0000000000..2f786b4ca6 --- /dev/null +++ b/lib/standards/dpub-roles.mjs @@ -0,0 +1,263 @@ +// Source https://www.w3.org/TR/dpub-aria-1.0/ +const dpubRoles = { + 'doc-abstract': { + type: 'section', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-acknowledgments': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-afterword': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-appendix': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-backlink': { + type: 'link', + allowedAttrs: [ + 'aria-expanded' + ], + nameFromContent: true + }, + 'doc-biblioentry': { + type: 'listitem', + requiredContext: [ + 'doc-bibliography' + ], + allowedAttrs: [ + 'aria-expanded', + 'aria-level', + 'aria-posinset', + 'aria-setsize' + ] + }, + 'doc-bibliography': { + type: 'landmark', + requiredOwned: [ + 'doc-biblioentry' + ], + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-biblioref': { + type: 'link', + allowedAttrs: [ + 'aria-expanded' + ], + nameFromContent: true + }, + 'doc-chapter': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-colophon': { + type: 'section', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-conclusion': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-cover': { + type: 'img', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-credit': { + type: 'section', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-credits': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-dedication': { + type: 'section', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-endnote': { + type: 'listitem', + requiredContext: [ + 'doc-endnotes' + ], + allowedAttrs: [ + 'aria-expanded', + 'aria-level', + 'aria-posinset', + 'aria-setsize' + ] + }, + 'doc-endnotes': { + type: 'landmark', + requiredOwned: [ + 'doc-endnote' + ], + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-epigraph': { + type: 'section', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-epilogue': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-errata': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-example': { + type: 'section', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-footnote': { + type: 'section', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-foreword': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-glossary': { + type: 'landmark', + requiredOwned: [ + 'definition', + 'term' + ], + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-glossref': { + type: 'link', + allowedAttrs: [ + 'aria-expanded' + ], + nameFromContent: true + }, + 'doc-index': { + type: 'navigation', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-introduction': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-noteref': { + type: 'link', + allowedAttrs: [ + 'aria-expanded' + ], + nameFromContent: true + }, + 'doc-notice': { + type: 'note', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-pagebreak': { + type: 'separator', + allowedAttrs: [ + 'aria-expanded', + 'aria-orientation' + ] + }, + 'doc-pagelist': { + type: 'navigation', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-part': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-preface': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-prologue': { + type: 'landmark', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-pullquote': { + type: 'none' + }, + 'doc-qna': { + type: 'section', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-subtitle': { + type: 'sectionhead', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-tip': { + type: 'note', + allowedAttrs: [ + 'aria-expanded' + ] + }, + 'doc-toc': { + type: 'navigation', + allowedAttrs: [ + 'aria-expanded' + ] + } +}; + +export default dpubRoles; \ No newline at end of file From 0fdffb0ee363c57b02d442b0e4f28fcd8f26bcf6 Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Tue, 30 Jun 2020 08:16:55 -0600 Subject: [PATCH 2/2] not mjs --- lib/standards/dpub-roles.js | 179 ++++++++++++++++++++++++ lib/standards/dpub-roles.mjs | 263 ----------------------------------- 2 files changed, 179 insertions(+), 263 deletions(-) create mode 100644 lib/standards/dpub-roles.js delete mode 100644 lib/standards/dpub-roles.mjs diff --git a/lib/standards/dpub-roles.js b/lib/standards/dpub-roles.js new file mode 100644 index 0000000000..a4098a3a9e --- /dev/null +++ b/lib/standards/dpub-roles.js @@ -0,0 +1,179 @@ +// Source https://www.w3.org/TR/dpub-aria-1.0/ +const dpubRoles = { + 'doc-abstract': { + type: 'section', + allowedAttrs: ['aria-expanded'] + }, + 'doc-acknowledgments': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-afterword': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-appendix': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-backlink': { + type: 'link', + allowedAttrs: ['aria-expanded'], + nameFromContent: true + }, + 'doc-biblioentry': { + type: 'listitem', + requiredContext: ['doc-bibliography'], + allowedAttrs: [ + 'aria-expanded', + 'aria-level', + 'aria-posinset', + 'aria-setsize' + ] + }, + 'doc-bibliography': { + type: 'landmark', + requiredOwned: ['doc-biblioentry'], + allowedAttrs: ['aria-expanded'] + }, + 'doc-biblioref': { + type: 'link', + allowedAttrs: ['aria-expanded'], + nameFromContent: true + }, + 'doc-chapter': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-colophon': { + type: 'section', + allowedAttrs: ['aria-expanded'] + }, + 'doc-conclusion': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-cover': { + type: 'img', + allowedAttrs: ['aria-expanded'] + }, + 'doc-credit': { + type: 'section', + allowedAttrs: ['aria-expanded'] + }, + 'doc-credits': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-dedication': { + type: 'section', + allowedAttrs: ['aria-expanded'] + }, + 'doc-endnote': { + type: 'listitem', + requiredContext: ['doc-endnotes'], + allowedAttrs: [ + 'aria-expanded', + 'aria-level', + 'aria-posinset', + 'aria-setsize' + ] + }, + 'doc-endnotes': { + type: 'landmark', + requiredOwned: ['doc-endnote'], + allowedAttrs: ['aria-expanded'] + }, + 'doc-epigraph': { + type: 'section', + allowedAttrs: ['aria-expanded'] + }, + 'doc-epilogue': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-errata': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-example': { + type: 'section', + allowedAttrs: ['aria-expanded'] + }, + 'doc-footnote': { + type: 'section', + allowedAttrs: ['aria-expanded'] + }, + 'doc-foreword': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-glossary': { + type: 'landmark', + requiredOwned: ['definition', 'term'], + allowedAttrs: ['aria-expanded'] + }, + 'doc-glossref': { + type: 'link', + allowedAttrs: ['aria-expanded'], + nameFromContent: true + }, + 'doc-index': { + type: 'navigation', + allowedAttrs: ['aria-expanded'] + }, + 'doc-introduction': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-noteref': { + type: 'link', + allowedAttrs: ['aria-expanded'], + nameFromContent: true + }, + 'doc-notice': { + type: 'note', + allowedAttrs: ['aria-expanded'] + }, + 'doc-pagebreak': { + type: 'separator', + allowedAttrs: ['aria-expanded', 'aria-orientation'] + }, + 'doc-pagelist': { + type: 'navigation', + allowedAttrs: ['aria-expanded'] + }, + 'doc-part': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-preface': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-prologue': { + type: 'landmark', + allowedAttrs: ['aria-expanded'] + }, + 'doc-pullquote': { + type: 'none' + }, + 'doc-qna': { + type: 'section', + allowedAttrs: ['aria-expanded'] + }, + 'doc-subtitle': { + type: 'sectionhead', + allowedAttrs: ['aria-expanded'] + }, + 'doc-tip': { + type: 'note', + allowedAttrs: ['aria-expanded'] + }, + 'doc-toc': { + type: 'navigation', + allowedAttrs: ['aria-expanded'] + } +}; + +export default dpubRoles; diff --git a/lib/standards/dpub-roles.mjs b/lib/standards/dpub-roles.mjs deleted file mode 100644 index 2f786b4ca6..0000000000 --- a/lib/standards/dpub-roles.mjs +++ /dev/null @@ -1,263 +0,0 @@ -// Source https://www.w3.org/TR/dpub-aria-1.0/ -const dpubRoles = { - 'doc-abstract': { - type: 'section', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-acknowledgments': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-afterword': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-appendix': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-backlink': { - type: 'link', - allowedAttrs: [ - 'aria-expanded' - ], - nameFromContent: true - }, - 'doc-biblioentry': { - type: 'listitem', - requiredContext: [ - 'doc-bibliography' - ], - allowedAttrs: [ - 'aria-expanded', - 'aria-level', - 'aria-posinset', - 'aria-setsize' - ] - }, - 'doc-bibliography': { - type: 'landmark', - requiredOwned: [ - 'doc-biblioentry' - ], - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-biblioref': { - type: 'link', - allowedAttrs: [ - 'aria-expanded' - ], - nameFromContent: true - }, - 'doc-chapter': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-colophon': { - type: 'section', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-conclusion': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-cover': { - type: 'img', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-credit': { - type: 'section', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-credits': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-dedication': { - type: 'section', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-endnote': { - type: 'listitem', - requiredContext: [ - 'doc-endnotes' - ], - allowedAttrs: [ - 'aria-expanded', - 'aria-level', - 'aria-posinset', - 'aria-setsize' - ] - }, - 'doc-endnotes': { - type: 'landmark', - requiredOwned: [ - 'doc-endnote' - ], - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-epigraph': { - type: 'section', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-epilogue': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-errata': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-example': { - type: 'section', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-footnote': { - type: 'section', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-foreword': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-glossary': { - type: 'landmark', - requiredOwned: [ - 'definition', - 'term' - ], - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-glossref': { - type: 'link', - allowedAttrs: [ - 'aria-expanded' - ], - nameFromContent: true - }, - 'doc-index': { - type: 'navigation', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-introduction': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-noteref': { - type: 'link', - allowedAttrs: [ - 'aria-expanded' - ], - nameFromContent: true - }, - 'doc-notice': { - type: 'note', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-pagebreak': { - type: 'separator', - allowedAttrs: [ - 'aria-expanded', - 'aria-orientation' - ] - }, - 'doc-pagelist': { - type: 'navigation', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-part': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-preface': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-prologue': { - type: 'landmark', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-pullquote': { - type: 'none' - }, - 'doc-qna': { - type: 'section', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-subtitle': { - type: 'sectionhead', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-tip': { - type: 'note', - allowedAttrs: [ - 'aria-expanded' - ] - }, - 'doc-toc': { - type: 'navigation', - allowedAttrs: [ - 'aria-expanded' - ] - } -}; - -export default dpubRoles; \ No newline at end of file