Opened 5 years ago
Closed 5 years ago
#1818 closed enhancement (fixed)
Include styleID on io.wrappedJSObject within addCitationDialog.js
| Reported by: | fbennett | Owned by: | simon |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | word integration | Version: | 2.1 |
| Keywords: | Cc: | bdarcus |
Description
I'm working on a plugin for CSL style development and maintenance that will save test fixtures based on the citeproc-js registry state, the current style, and the (possibly user-edited) rendered citation. This will make it possible for users without programming experience to assist in the rapid construction of style-level test suites. It may also help streamline the workflow for support queries, by allowing users to state their needs precisely in code, without the back-and-forth of explanation and confirmation.
There does not currently seem to be a way of acquiring the styleID within addCitationDialog.js. The attached patch would expose it as a string.
Attachments (8)
Change History (20)
Changed 5 years ago by fbennett
comment:1 Changed 5 years ago by dstillman
comment:2 Changed 5 years ago by ajlyon
I'm not sure what else there is to add-- Frank is working on a plugin that would generate CSL text fixtures as described in the bug, and depicted here (http://twitpic.com/4uyx2k). It's a pretty cool idea-- the user can modify the output in the edit citation box and produce a text fixture for the desired output, which could then somehow be submitted and integrated into style and processor testing.
Apparently the plugin would require the style ID, which is not yet exposed.
Changed 5 years ago by fbennett
User (or maintainer) saves test to subdirectory named for the target style
comment:3 Changed 5 years ago by fbennett
I've appended some screenshots and a sample test fixture that illustrate what the plugin will do. The processor test suite currently contains 677 fixtures, mostly hand-coded (by me). Validating individual styles against similar test suites will involve the creation of thousands of fixtures, which is not sustainable without an automated tool. Extending the "Show Editor" windows in Add Citation and Edit Bibliography in this way is a simple solution that makes it easy to involve users in the testing process.
However ... I now realize that styleID alone will not be enough; we'll also need access to at least two portions of the citation registry: citeproc.registry.registry (for the full list of items cited), and citeproc.registry.citationreg.citationByIndex (for the sequence of citations preceding the current sample). That does involve more exposure, I'm not sure what your take will be on that.
Shall we wait until I have a fully functional version of the plugin before considering this one further?
comment:4 Changed 5 years ago by dstillman
Yeah, let's come back to this once you have a full demo.
It does seem a little awkward to have this in the Add/Edit windows, but maybe there's not a better place for it if it needs positioning information from the document.
Changed 5 years ago by fbennett
Plugin demo (works only against addCitationDialog, bibliography is forthcoming)
Changed 5 years ago by fbennett
Patch to pass styleID, registry data and citation data on wrappedJSObject (io)
comment:5 Changed 5 years ago by fbennett
Appending a working version of the plugin as a demo (csl-feedback-zotero-take-1.xpi), and a patch to support it (as csl-feedback.patch).
This only works for citations so far, but hooking up bibliographies won't require access to any data beyond what the patch exposes.
To generate a test:
(1) Install a Zotero 2.1 client;
(2) Install a word processor integration plugin;
(3) Install the csl-feedback plugin;
(4) Insert one or more citations into the document;
(5) Edit a citation and click on "Show Editor";
(6) Click on "Save this citation as a CSL test fixture";
(7) Follow the menus to save the fixture.
Changed 5 years ago by fbennett
comment:6 Changed 5 years ago by fbennett
Okay, the feedback plugin is now fully functional and generates valid tests. It will work for bibliographies against the current stable, branch or trunk Zotero. For use with citations, it requires the patch to integration.js (csl-feedback.patch).
If the patch can be reviewed when you get a chance, that would be great.
comment:7 Changed 5 years ago by fbennett
Attaching a copy of the final release version of the plugin. This avoids the filesystem altogether, and writes tests directly to an open Zotero group created specifically to receive test fixtures.
This would companion nicely with a little IDE that runs one or more archived tests against a style -- a kind of test-driven version of csledit.xul.
Style maintenance should become considerably lighter and more certain with this infrastructure in place.
comment:8 Changed 5 years ago by simon
Frank, can I just pass the whole style to window? I'd prefer to use as few properties as possible.
comment:9 Changed 5 years ago by fbennett
Sure, that would do it. (It's a scarey thing to say, but I'm still learning the possibilities of Javascript.)
comment:10 Changed 5 years ago by simon
- Resolution set to fixed
- Status changed from new to closed
In [9362]:
comment:11 Changed 5 years ago by fbennett
- Resolution fixed deleted
- Status changed from closed to reopened
Much to my chagrin, I just realized that the current processor code does not keep a record of its own styleID when it is instantiated. It should do, so I'll stir that in soon, as the sole change in a 1.0.176 processor release. If the revised processor can be included in the upcoming Zotero 2.1.7 release, it would be great; then this ticket can be closed for good.
comment:12 Changed 5 years ago by fbennett
- Resolution set to fixed
- Status changed from reopened to closed
Brilliant.
Can you explain why this is necessary in that window?