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

Preview citation cluster #68

Merged
merged 5 commits into from
Sep 18, 2020
Merged

Preview citation cluster #68

merged 5 commits into from
Sep 18, 2020

Conversation

cormacrelf
Copy link
Collaborator

Adds a previewCitationCluster API, named after the similar method in citeproc-js.

From the draft README:


Preview citation clusters

Sometimes, a user wants to see how a cluster will look while they are editing it, before confirming the change.

let cites = [ { id: "citekey", locator: "45" }, { ... } ];
let positions = [ ... before, { id: 0, note: 34 }, ... after ];
let preview = driver.previewCitationCluster(cites, positions, "html");

The positions array is exactly like a call to setClusterOrder, except exactly one of the positions has an id of 0. This could either:

  • Replace an existing cluster's position, and preview a cluster replacement; or
  • Represent the position a cluster is hypothetically inserted.

If you passed only one position, it would be like previewing an operation like "delete the entire document and replace it with this one cluster". That would mean you would never see "ibid" in a preview. So for maximum utility, assemble the positions array as you would a call to setClusterOrder with exactly the operation you're previewing applied.

@cormacrelf cormacrelf merged commit 6024e27 into master Sep 18, 2020
@cormacrelf cormacrelf deleted the previewCitationCluster branch September 18, 2020 22:41
@cormacrelf cormacrelf added A-wasm Area: wasm package on npm A-crates/citeproc Area: citeproc crate enhancement New feature or request labels Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-crates/citeproc Area: citeproc crate A-wasm Area: wasm package on npm enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

None yet

1 participant