[annotator-dev] Annotations without
Randall Leeds
tilgovi at hypothes.is
Wed Nov 13 19:47:13 UTC 2013
On Tue, Nov 12, 2013 at 2:16 PM, Riccardo Tasso <riccardo.tasso at gmail.com>wrote:
>
> The data-begin and data-end attributes for each div represent the "real"
> offsets of each chapter of my text.
>
> My first question is about inserting a new annotation: how can I use
> annotator to send to my backend the annotation with the "real" offsets? For
> example, for the word "Lorem" the real offset is { begin: 1000, end: 1005>.
> Please note that my backend doesn't care the HTML structure, and the "real"
> offset is calculated by the offset of "Lorem" in his div summed with the
> data-begin attribute of its div.
>
You would subscribe to a hook which takes an annotation and adds a field to
store this information.
>
> The second question is about reading existing annotations: how can I use
> annotator to highlight the right spans of text without using only the
> data-begin and data-end attributes and the <begin, end> of each annotation?
>
Current Annotator will likely not work well out of the box for your case,
unless the URI changes when you load new paragraphs. Without changing the
URI, it will likely attach annotations to the wrong paragraphs, but you
could write some plugins.
Kristof (csillag) has done some really nice work on providing this sort of
anchoring, though. If all goes well with this the hope is that we might
find a way to make Annotator aware of your data attributes.
It may be better to delineate the chapters as entities with their own URIs
if possible. Then the offsets are just relative to the chapter and we can
make Annotator recognize the chapter entities as distinct from the URI of
the owner document (the viewer) when determining the context for an
annotation. That's probably a bit more in line with the open web.
A bit more about the UX you're trying to achieve might help clarify how
Annotator could be useful for you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20131113/5c9ae63a/attachment-0004.html>
More information about the annotator-dev
mailing list