Skip to content

Fix: Fix minigallery duplicates#1430

Merged
larsoner merged 15 commits intosphinx-gallery:masterfrom
lucyleeow:fix_minigal
Feb 7, 2025
Merged

Fix: Fix minigallery duplicates#1430
larsoner merged 15 commits intosphinx-gallery:masterfrom
lucyleeow:fix_minigal

Conversation

@lucyleeow
Copy link
Copy Markdown
Contributor

closes #1259
closes #1414

  • .examples files are still generated as before, no changes there
  • create a dict of backreferences (storing title and intro as well for thumbnail creation) and write to json
  • Update API usage and minigallery directive to use the backreferences dict file
    • this should fix the minigallery duplicate problem

@lucyleeow lucyleeow added the bug label Feb 1, 2025
@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Feb 3, 2025

test_minigallery_sort_order_callable failure looks related

Copy link
Copy Markdown
Contributor Author

@lucyleeow lucyleeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failures fixed, sorry I just didn't have the time, last week, to get this PR to review state.

More tests to be added (and I've got to amend the minigallery docs), but I just wanted to check with you @larsoner, that you're happy with how this is looking?


def _thumbnail_div(
target_dir, src_dir, fname, snippet, title, is_backref=False, check=True
target_dir, src_dir, fname, intro, title, is_backref=False, check=True
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intro makes it consistent with the term that is used everywhere else in the code

Path(
gallery_conf["src_dir"],
gallery_conf["backreferences_dir"],
"backreferences_all",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% on naming file backreferences_all.json , happy to take suggestions

Copy link
Copy Markdown
Contributor

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @lucyleeow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicated gallery examples for a given class in the API documentation minigallery with multiple files: deduplicate and should not start new rows

2 participants