MCPcopy
hub / github.com/pydata/xarray / update_gallery

Function update_gallery

doc/conf.py:397–428  ·  view source on GitHub ↗

Update the gallery page.

(app: Sphinx)

Source from the content-addressed store, hash-verified

395
396
397def update_gallery(app: Sphinx):
398 """Update the gallery page."""
399
400 LOGGER.info("Updating gallery page...")
401
402 gallery = yaml.safe_load(pathlib.Path(app.srcdir, "gallery.yml").read_bytes())
403
404 for key in gallery:
405 items = [
406 f"""
407 .. grid-item-card::
408 :text-align: center
409 :link: {item['path']}
410
411 .. image:: {item['thumbnail']}
412 :alt: {item['title']}
413 +++
414 {item['title']}
415 """
416 for item in gallery[key]
417 ]
418
419 items_md = indent(dedent("\n".join(items)), prefix=" ")
420 markdown = f"""
421.. grid:: 1 2 2 2
422 :gutter: 2
423
424 {items_md}
425 """
426 pathlib.Path(app.srcdir, f"{key}-gallery.txt").write_text(markdown)
427 LOGGER.info(f"{key} gallery page updated.")
428 LOGGER.info("Gallery page updated.")
429
430
431def update_videos(app: Sphinx):

Callers

nothing calls this directly

Calls 2

infoMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…