UCL / frrant

2 stars 0 forks source link

Feature/track ft mentions #418

Closed acholyn closed 5 months ago

acholyn commented 5 months ago

closes #390

When a TextObjectField (TOF) instance is saved, a function will run to update_mentions, which involves calling another function that turns the content into beautiful soup and searching for all <class="mention"> elements and then filters these so only the ones for fragment, anonymousfragment and testimonium are processed. The list of mentioned objects is returned to update_mentions and this list is compared to the preexisting list of mentioned objects called fragment_testimonia_mentions. If the lists do not differ, nothing is updated. If they do differ, set_fragment_testimonia_mentions is called with the list of items to add and a list of items to remove from fragment_testimonia_mentions. The items in the removal list are removed from the mentioned object's mentioned_in set and are removed from the TOF.fragment_testimonia_mentions, the reverse is true for items in the "to add" list.

Upon completion, each TOF should have a list of fragment_testimonia_mentions and each of these items should have the parent/owner object of the TOF in their mentioned_in_list (a property which extracts the related object of the TOFs in the mentioned_in set.

This should act as a sensible foundation for #358

tcouch commented 5 months ago

The individual items in the mentions list could do with something to make it clearer they're separate items rather than one item with a long name - maybe bullet points, maybe just spacing? image

acholyn commented 5 months ago

Have implemented changes on the PR that pulls into this one since there were other issues fixed on there too