diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-10-20 19:25:35 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-10-20 19:25:35 +0200 |
| commit | 1600ab3446f533a6824512d616131c7d02a037c7 (patch) | |
| tree | b0a3a5cf08d58583e82f9170f72201398e99cdb9 /animism-align/frontend/app/utils/transcript.utils.js | |
| parent | 597356b755b2453d17bc7e13e6d7f7f3d966bf6b (diff) | |
add footnote type and text plate type. keep track of footnotes when accumulating paragraphs.
Diffstat (limited to 'animism-align/frontend/app/utils/transcript.utils.js')
| -rw-r--r-- | animism-align/frontend/app/utils/transcript.utils.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/animism-align/frontend/app/utils/transcript.utils.js b/animism-align/frontend/app/utils/transcript.utils.js index f343d76..dc351c0 100644 --- a/animism-align/frontend/app/utils/transcript.utils.js +++ b/animism-align/frontend/app/utils/transcript.utils.js @@ -6,14 +6,16 @@ import { FULLSCREEN_UTILITY_ANNOTATION_TYPES, } from 'app/constants' -export const buildParagraphs = (annotationOrder, sectionCount) => { +export const buildParagraphs = (annotationOrder, sectionCount, footnoteCount) => { const state = store.getState() const { lookup: annotationLookup } = state.annotation.index const { lookup: paragraphLookup } = state.paragraph.index let currentParagraph = {} const paragraphs = [] + const footnotes = [] sectionCount = (sectionCount || 0) + footnoteCount = (footnoteCount || 0) // loop over the annotations in time order annotationOrder.forEach((annotation_id, i) => { @@ -85,12 +87,16 @@ export const buildParagraphs = (annotationOrder, sectionCount) => { paragraphs.push(currentParagraph) } + if (annotation.type === 'footnote') { + footnoteCount += 1 + annotation.footnote_id = footnoteCount + footnotes.push(annotation) + } + // if this annotation is a paragraph_end, set the end timestamp if (annotation.type === 'paragraph_end') { currentParagraph.end_ts = annotation.start_ts - } - - // otherwise, just append this annotation to the paragraph + } // otherwise, just append this annotation to the paragraph else { currentParagraph.annotations.push(annotation) } @@ -107,7 +113,7 @@ export const buildParagraphs = (annotationOrder, sectionCount) => { paragraphs[i].start_ts = paragraphs[i+1].start_ts - 0.01 } } - return paragraphs + return { paragraphs, footnotes } } const getParagraphType = (annotation, paragraph) => { |
