Skip to content

Commit

Permalink
breakelse article: generate alt text, xe style
Browse files Browse the repository at this point in the history
  • Loading branch information
FeepingCreature committed Oct 9, 2023
1 parent afc7d76 commit b501817
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions doc/sphinx/_ext/xe_quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def run(self):
mood = self.arguments[1] if len(self.arguments) > 1 else None
blockquote = nodes.block_quote()
blockquote.set_class('xe-quote')
image_node = nodes.image(uri=self.image_uri(persona, mood))
image_node = nodes.image(**self.image_uri(persona, mood))
nested_node = nodes.container()

content = ViewList(self.content)
Expand All @@ -30,7 +30,6 @@ def image_uri(self, persona, mood):
'aghast': '/_static/breakelse/shoebill_aghast.png',
'considering': '/_static/breakelse/shoebill_considering.png',
}
return mapping[mood or 'neutral']
elif persona == 'gurkenglas':
mapping = {
'neutral': '/_static/breakelse/gurkenglas_neutral.png',
Expand All @@ -39,9 +38,13 @@ def image_uri(self, persona, mood):
'idea': '/_static/breakelse/gurkenglas_idea.png',
'unimpressed': '/_static/breakelse/gurkenglas_unimpressed.png',
}
return mapping[mood or 'neutral']
else:
assert False
mood = mood or 'neutral'
return {
'uri': mapping[mood],
'alt': f'{persona} is {mood}',
}


def setup(app):
Expand Down

0 comments on commit b501817

Please sign in to comment.