PerseusDL/bodin — pull request #2 by balmas (2014-05-06 17:42:21+00:00)
Title: Citework

Adam,

I added support for multiple annotation bodies and targets as well as external Annotation bodies.

For the external Annotation bodies, it works as follows:

1. there is a single div added to the main index.html display which gets initialized with the BodinExternal.js plugin. This listens for a BodinUI.EXTERNAL event and triggers the BodinExternal.LOADTEXT event to populate the div with the contents of the annotation.

2. BodinAlign.js now requires that the urn of each text in the main alignment display have the cts urn of the contained text as the id its div.work element (this is carried over in the transform of the XML for the display). It uses this to determine whether an annotation is targeting one of the aligned text or an external annotation, and types the data contained in the json object accordingly. The annotation type is carried over as the CSS class of the objects marked by BodinAlign. I also added data-motivation and data-uri attributes on the alignSpan elements because this information is needed for the external annotations.

3. BodinUI.js triggers the BodinUI.EXTERNAL event when one of the words identified with external annotation targets gets clicked.

4. BodinExternal handles the retrieval of the uris and reuses the methods from BodinAlign to mark the subreferences in the retrieved annotation, if there are any. (These annotations are valid with or without subreferences).

I didn't bother to do anything interesting with the formatting of the external annotation div because I figured whatever I did you would probably redo anyway.

Note that I also replaced tabs with 4 spaces in the source which unfortunately makes the diff look worse than it is. But I think this is what you said you prefer, right?