Skip to content

Commit

Permalink
Add author to corpus texts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mau Zsofia Abraham committed Jan 26, 2025
1 parent 2723d85 commit 84bb7eb
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
85 changes: 43 additions & 42 deletions components/corpus-text-window-content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,51 +115,52 @@ watch(utteranceElements.value, (value) => {
<div :id="params.textId" ref="utterancesWrapper" class="p-4">
<h2 class="m-3 text-lg">{{ props.params.label }}</h2>

<table class="m-3 border border-gray-300">
<thead>
<tr></tr>
<tr></tr>
</thead>
<tbody>
<tr>
<th>Contributed by:</th>
<td>{{ teiHeader?.resp }}</td>
</tr>
<tr>
<th>Speakers:</th>
<table class="m-3 border border-gray-300">
<thead>
<tr></tr>
<tr></tr>
</thead>
<tbody>
<tr>
<th>Contributed by:</th>
<td>{{ teiHeader?.resp }}</td>
</tr>
<tr>
<th>Speakers:</th>
<td>
<span v-for="(person, index) in teiHeader?.person" :key="index">
{{ person.name }} (age: {{ person.age }}, sex: {{ person.sex }})
<span v-if="index < (teiHeader?.person.length || 1) - 1">, </span>
</span>
</td>
</tr>
</tbody>
</table>
<table>
<tr
v-for="u in utterances"
:id="u.id"
:key="u.id"
ref="utteranceElements"
class="corpus-utterance u table-row"
>
<td>
<span v-for="(person, index) in teiHeader?.person" :key="index">
{{ person.name }} (age: {{ person.age }}, sex: {{ person.sex }})
<span v-if="index < (teiHeader?.person.length || 1) - 1">, </span>
</span>
<a v-if="u.audio" class="play mt-1"
><Play class="size-4" /><span class="hidden">Play</span></a
>
<!-- eslint-disable-next-line vuejs-accessibility/media-has-caption -->
<audio v-if="u.audio" hidden="hidden">
<source :src="u.audio" />
</audio>
</td>
<th class="min-w-fit px-3 font-bold">
{{ u.id }}
</th>
<td class="table-cell" v-html="u.content"></td>
</tr>
</tbody>
</table>
<table>
<tr
v-for="u in utterances"
:id="u.id"
:key="u.id"
ref="utteranceElements"
class="corpus-utterance u table-row"
>
<td>
<a v-if="u.audio" class="play mt-1"
><Play class="size-4" /><span class="hidden">Play</span></a
>
<!-- eslint-disable-next-line vuejs-accessibility/media-has-caption -->
<audio v-if="u.audio" hidden="hidden">
<source :src="u.audio" />
</audio>
</td>
<th class="min-w-fit px-3 font-bold">
{{ u.id }}
</th>
<td class="table-cell" v-html="u.content"></td>
</tr>
</table>
<InfiniteLoading v-if="!scrollComplete" @infinite="handleInfiniteScroll" />
</table>
<InfiniteLoading v-if="!scrollComplete" @infinite="handleInfiniteScroll" />
</div>
</div>
</template>

Expand Down
7 changes: 4 additions & 3 deletions composables/use-tei-headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ const extractMetadata = function (
return false;
}
});
console.log(respPerson);
let name;
if (respPerson?.persName) {
const persName2 = respPerson.persName as PersName;
Expand All @@ -141,11 +140,13 @@ const extractMetadata = function (
}

if (
item.teiHeader.fileDesc.titleStmt.respStmts?.find((r) => r.persName && r.resp.$ === "author") &&
item.teiHeader.fileDesc.titleStmt.respStmts?.find((r) =>
["author", "recording", "principal"].includes(r.resp.$),
) &&
corpusMetadata
) {
template.author = item.teiHeader.fileDesc.titleStmt.respStmts
.filter((r) => r.resp.$ === "author")
.filter((r) => ["author", "recording", "principal"].includes(r.resp.$))
.map((resp) => {
const respPerson = corpusMetadata.fileDesc.titleStmt.respStmts?.find((resp2: RespStmt) => {
if (resp2.persName) {
Expand Down

0 comments on commit 84bb7eb

Please sign in to comment.