Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide mechanism for a unique per-imageset gallery ID #530

Open
fluffy-critter opened this issue Jun 4, 2023 · 0 comments
Open

Provide mechanism for a unique per-imageset gallery ID #530

fluffy-critter opened this issue Jun 4, 2023 · 0 comments

Comments

@fluffy-critter
Copy link
Collaborator

Expected Behavior

Provide some mechanism for allowing each image set to have its own unique gallery ID. For example, if you have an entry like:

Entry-ID: 12345

![{256,256}](foo.jpg | bar.jpg | baz.jpg)

![{256,256}](qwer.jpg | poiu.jpg | asdf.jpg)

the resulting HTML would be something like:

<p><a href="foo.jpg" data-lightbox="12345.1"><img src="foo-256x256.jpg"></a>
<a href="bar.jpg" data-lightbox="12345.1"><img src="bar-256x256.jpg"></a>
<a href="baz.jpg" data-lightbox="12345.1"><img src="baz-256x256.jpg"></a></p>

<p><a href="qwer.jpg" data-lightbox="12345.2"><img src="qwer-256x256.jpg"></a>
<a href="poiu.jpg" data-lightbox="12345.2"><img src="poiu-256x256.jpg"></a>
<a href="asdf.jpg" data-lightbox="12345.2"><img src="asdf-256x256.jpg"></a></p>

Current Behavior

Having separate image sets requires hand-authoring the gallery ID.

Possible Solution

In the most general sense, allow the gallery option to take a Union[Callable,str] and if it's a Callable, call the function (but only at the start of the element render). Then provide a usable function like autoincrement that just provides an auto-incrementing gallery ID (as this doesn't have to be stable across pageviews, it just needs to be unique per lightbox on any given page).

Steps to Reproduce (for bugs)

Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant