Skip to content

Commit

Permalink
Merge branch 'release/0.1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
lb803 committed Feb 5, 2021
2 parents 50ec5fd + aba2b40 commit d2de365
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ _Access Aide_ is a Calibre (book editor) plugin to enhance epubs with accessibil
- Add accessibility declarations to book metadata.

# Usage
This plugin can be used as part of an InDesign-based workflow to produce accessible epubs. InDesign is capable of adding language information to OPF files and appropriate epub:type to html tags. Access Aide reads this information and add language declarations, aria roles and metadata statements to comply with the WCAG 2.0 – AA guidelines for accessible publications.

## Config
Plugin behaviour can be fine tuned via plugin config dialogue.

Expand All @@ -20,6 +22,6 @@ Open the book to enhance in the Calibre ebook editor and start Access Aide. This
# License
Source code by Luca Baffa, released under the GPL 3 licence.

This project is _heavily influenced_ and inherits part of the code from the [Access-Aide](https://github.com/kevinhendricks/Access-Aide) LGPL v2.1 plugin developed for Sigil.
This project aims to port the functionalities of the excellent [Access-Aide](https://github.com/kevinhendricks/Access-Aide) LGPL v2.1 Sigil plugin to Calibre.

The plugin icon (`./icon/icon.png`) comes from the `adwaita-icon-theme` pack ([gitlab page](https://gitlab.gnome.org/GNOME/adwaita-icon-theme) of the project), released as LGPL v3 by the GNOME Project.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class AccessAidePlugin(EditBookToolPlugin):
name = 'Access Aide'
version = (0, 1, 4)
version = (0, 1, 5)
author = 'Luca Baffa'
supported_platforms = ['windows', 'osx', 'linux']
description = 'Access Aide plugin for Calibre'
Expand Down
16 changes: 11 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def main(self):
self.aria_stat.reset()
self.meta_stat.reset()

# update the editor UI
self.boss.apply_container_update_to_gui()

def add_lang(self, root, lang):
'''Add language attributes to <html> tags.
Expand Down Expand Up @@ -116,14 +119,17 @@ def add_aria(self, root):
for node in nodes:

tag = lxml.etree.QName(node).localname
value = node.attrib['{http://www.idpf.org/2007/ops}type']
values = node.attrib['{http://www.idpf.org/2007/ops}type']

# iter over values, in case of epub:type overloading
for value in values.split(' '):

# get map for the 'value' key (if present)
map = epubtype_aria_map.get(value, False)
# get map for the 'value' key (if present)
map = epubtype_aria_map.get(value, False)

if map and (tag in map['tag'] or tag in extra_tags):
if map and (tag in map['tag'] or tag in extra_tags):

self.write_attrib(node, 'role', map['aria'], self.aria_stat)
self.write_attrib(node, 'role', map['aria'], self.aria_stat)

def write_attrib(self, node, attribute, value, stat):
'''Write attributes to nodes.
Expand Down

0 comments on commit d2de365

Please sign in to comment.