Overview

I created a sample app that loads TEI/XML files, displays images with Mirador, and displays text with CETEIcean. You can try it from the following URL.

Demo Site

https://nakamura196.github.io/ceteicean-mirador/

App screenshot

Background

I have previously developed applications that provide similar functionality.

  • Implementation example using Next.js
  • Implementation example using XSLT

This time, I introduce an approach using only HTML and plain JavaScript.

Target Data

The target is the following Koui Genji Monogatari Text DB.

https://kouigenjimonogatari.github.io/

Implementation

The source code is published in the following repository.

https://github.com/nakamura196/ceteicean-mirador

Implementation Highlights

1. Processing pb Tags Using CETEIcean’s behaviors

The following code defines the click behavior of pb tags using CETEIcean’s behaviors.

c}t).t};ae,digfp}d:ribBag:li}ci}cpp}re{HpuPefofobb)ehihrrftpncpn..ci};tadieouI(bGs(obDstAaofuvec:cnpne.etcn.iteddnci}ri:ecbhlstosssxdds(ofnouste.ecrtepptEtznci}rnsi=rhtzortlaCcvos(ofpsnioiaAorezAagolezntzngb(e=nndtstnrsotyeninoeos(o;{c=>goAteepntNtctnIzntsTe>(catrIs)erpuekLedoeuosdpeuttidpIiamniI)nEsrPsdoblmtrb{dbgtesdelufaaoc)eriuf=ue=vt{Eeragrcutnibtr=t=ee=lmfceyuma{tbueoeenenneeae(meg.ut(mlc(ul`tetmncEseenscte".o"m.[rhetelulntre(ncgrdbgP(in)Eeret.es""oeraeea"stlmfm.can,rtetrtgc.{eeaecrt"rAsaAelg=mncnree)eetp-tieeteteaE)lst.zt$ctdnEsatl.prror{kAot&ltee{gienip"tc&eeDmeabpeba,tu=mDoettul-ugrmseocnAttaitefiezuncuttrecdeNubnortum(ti(e"(unutnf.me"rb"(,"mct.eagentiuc'n}teqEcentebto#z"]i(ulettFiuer'o)`o"eeEAFr-tr,n;ndrmltrapeee(ayeetagb(sI)tSnmrgm""pdaeteime)n"))"{-l.nben;");;"zectunt);;ocl.tt()ntohe();eosa(),-res",i(sAsd`tta"t(tm)e"re;itiA-ebsziu"o-t)nse)eu(;[r"ifsdaa=cm"ee$"A{)sz;"o)n)eI{d}"]`);

2. Page Navigation in Mirador

When a pb tag is clicked, the Canvas URI is obtained from the TEI/XML file, and Mirador page navigation is executed.

lf}eutni}VPcfamatm)rigi(i;ireomrMaaniaibdnrdrloagaoaervodrdIiToIotngornrosaPIs.ttantasaigsactnoetntocn(acirecneoe;fac.nunesstnv)t.hcaosets{reiUetMor.Cinidar)inasvd{paoasrt(c'ihwn(isntdaonwc-e1',canvasUri)

3. Using CETEIcean’s CSS

Text styling uses the CSS provided by CETEIcean.

<linkrel="stylesheet"href="https://teic.github.io/CETEIcean/css/CETEIcean.css"

Summary

This article introduced one approach to developing TEI/XML viewers using HTML and plain JavaScript.

I hope you will consider various methods, including using frameworks like Next.js or utilizing XSLT without a viewer, while referencing this approach.