Commit 7b195eb0 by Arthur Barrett

fixed error if highlight not defined

parent 1721793e
......@@ -28,20 +28,19 @@ class AnnotatableModule(XModule):
and an XML key to delete from the element.
"""
attr = {}
cls = ['annotatable-span', 'highlight']
valid_colors = ['yellow', 'orange', 'purple', 'blue', 'green']
highlight_key = 'highlight'
color = el.get(highlight_key)
valid_colors = ['yellow', 'orange', 'purple', 'blue', 'green']
if color is not None and color in valid_colors:
cls.append('highlight-'+color)
attr['_delete'] = highlight_key
cls_str = ' '.join(cls)
attr['value'] = ' '.join(cls)
return { 'class': {
'value': cls_str,
'_delete': highlight_key }
}
return { 'class' : attr }
def _get_annotation_data_attr(self, index, el):
""" Returns a dict in which the keys are the HTML data attributes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment