Skip to content

Commit 95022d9

Browse files
committed
Merge feature/class-examples-all-images: all example images per class for the Images carousel (v1.15.2)
2 parents 46388fd + e35785a commit 95022d9

2 files changed

Lines changed: 37 additions & 12 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
here = path.abspath(path.dirname(__file__))
55

6-
__version__ = "1.15.1"
6+
__version__ = "1.15.2"
77

88
# Get the long description from the README file
99
with open(path.join(here, 'README.md')) as f:

src/vfbquery/vfb_queries.py

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4160,17 +4160,42 @@ def _owlery_query_to_results(owl_query_string: str, short_form: str, return_data
41604160
technique_label_raw = technique_info.get('label', '')
41614161
technique = unquote(technique_label_raw) if technique_label_raw else ''
41624162

4163-
# Thumbnail — canonical `[![alt](url 'alt')](ref)` form.
4164-
thumbnail_url = image_info.get('image_thumbnail', '')
4165-
if thumbnail_url:
4166-
# Convert to HTTPS and use non-transparent version
4167-
thumbnail_url = thumbnail_url.replace('http://', 'https://').replace('thumbnailT.png', 'thumbnail.png')
4168-
4169-
# Format thumbnail with proper markdown link (matching Neo4j behavior)
4170-
if template_label:
4171-
anatomy_label = unquote(anatomy_label_for_alt)
4172-
alt_text = f"{anatomy_label} aligned to {template_label}"
4173-
thumbnail = f"[![{alt_text}]({thumbnail_url} '{alt_text}')]({class_short_form})"
4163+
# Thumbnail(s) -- emit EVERY example image for this term so the
4164+
# V2 Images column carousels them. The Java
4165+
# VFBqueryJsonProcessor.imageMarkdownToVariableJson builds a
4166+
# multi-image carousel Variable from a '; '-joined list of
4167+
# `[![alt](url 'alt')](ref)` items. Template_Space and
4168+
# Imaging_Technique above stay single (the representative
4169+
# first image).
4170+
if anatomy_images and len(anatomy_images) > 0:
4171+
image_wrappers = anatomy_images
4172+
else:
4173+
image_wrappers = []
4174+
for entry in field_data.get('channel_image', []) or []:
4175+
if isinstance(entry, dict) and 'image' in entry:
4176+
image_wrappers.append({'channel_image': entry, 'anatomy': None})
4177+
elif isinstance(entry, dict):
4178+
image_wrappers.append({'channel_image': entry.get('channel_image', {}) or {}, 'anatomy': None})
4179+
thumbnail_items = []
4180+
for wrapper in image_wrappers:
4181+
wci = wrapper.get('channel_image', {}) or {}
4182+
wimg = wci.get('image', {}) or {}
4183+
wurl = wimg.get('image_thumbnail', '')
4184+
if not wurl:
4185+
continue
4186+
wurl = wurl.replace('http://', 'https://').replace('thumbnailT.png', 'thumbnail.png')
4187+
wtmpl = wimg.get('template_anatomy', {}) or {}
4188+
wtmpl_raw = (wtmpl.get('symbol') or wtmpl.get('label', '')) if wtmpl else ''
4189+
wtmpl_label = unquote(wtmpl_raw) if wtmpl_raw else ''
4190+
if not wtmpl_label:
4191+
continue
4192+
wanat = wrapper.get('anatomy') or {}
4193+
wlabel_raw = wanat.get('label') if isinstance(wanat, dict) and wanat.get('label') else anatomy_label_for_alt
4194+
wlabel = unquote(wlabel_raw) if wlabel_raw else ''
4195+
wref = wanat.get('short_form') if isinstance(wanat, dict) and wanat.get('short_form') else class_short_form
4196+
walt = f"{wlabel} aligned to {wtmpl_label}"
4197+
thumbnail_items.append(f"[![{walt}]({wurl} '{walt}')]({wref})")
4198+
thumbnail = "; ".join(thumbnail_items)
41744199

41754200
# Build row
41764201
row = {

0 commit comments

Comments
 (0)