Hosting TEI/XML Files on S3-Compatible Object Storage

Overview This is a memo about hosting TEI/XML files on S3-compatible object storage. Specifically, we target the mdx I object storage. https://mdx.jp/mdx1/p/about/system Background We are building a web application (Next.js) that loads TEI/XML files and visualizes their content. When the number and size of files were small, they were stored in the public folder, but as these grew larger, we considered hosting them elsewhere. There are many options for storage locations, but this time we target mdx I’s S3-compatible object storage. ...

May 24, 2025 · 16 min · Nakamura

Searching Files in Linked Storage Using the GakuNin RDM API

Overview In the following article, I introduced building applications using the GakuNin RDM API. In this article, I introduce how to search files in linked storage using the GakuNin RDM API. Implementation Example I implemented the search API as follows. Since directly accessing https://rdm.nii.ac.jp/api/v1/search/file/ from the client caused CORS errors, I implemented it as a Next.js API Route. i i i e } m m m x p p p p c c c c c c c c } c } c r o o o o o o o o o o o o ; o ) o e r r r r n n n n n n n n a s h e } n m h } b ; n t t t t t s G s s s s s s s p o i l , s e e , o s u t e t t t t t t t i r g a q } f s t t a " A d t r { { { a t _ t h s u , r i h d C u y n s s u q o s a a p v : l t e f } o z r o e o t : d N a g y e q r u f i c p a e i i r i , m e e d r n h a N e u e n s u l e f z c i r r " g c y l q } : , s : s t o J t e x t t c s e r s e e U a s c h s : t u , : e r S a x t h S i r = y e s r m i r t e e e q } o = " n i O t R O e f o y t = s l s o e : a { r r u , f P { t z N = R e p r u n n = T n a r e y e d f ] q a l f a O - a . e s t v n p e = p o = = : t " c d : r e i , u n e s w S T t s a s p i e c = a w u a k e t h : y f e " " " " " " " e a n e a T y i t w p o o r t r r p r e " { { d i _ { _ a l _ t d j s a a r l i t i " p o r a o n n S i a a U l a s n h _ t d { s u d a i e o c l l y y e , t , e n i i n s s e o w m R . r e t v d l s t l s l t s b h l l , z n " : n t s e s n a e L s s I = t e e e l r t : l l c ^ o _ _ e t f : g e } s i t ( e e n p n s : : i _ " e r 1 o j s _ : e ` i r . } i G t e r a I t s s d c 3 n f [ , ^ i " l o c w t " B f e j f o E r e r n ( e : o " 0 { g i 4 p , ^ b h i t c a e y s s f r n T g s q c t u s / r , , : e " t 1 s o l r h p a ( . o r o ( e . h ( r s / : n l , i " ^ o d u ( p r p j n o m } r t f u P u l i r a { d o , 0 l c e a l e a s ( m e S r r a r . o d " m : n . s a , p i r r o d " f q e o l r l s n m g e ^ 1 ^ r i c a n a " @ r : r m ) a . e ? . r : " 1 2 0 d U a $ m ( t n / o v ; m s a . n d 3 _ . 5 . : r t { s ) a e a m R e U s e r a i m 0 a 2 " 1 l i a ) ; ) x p e r R . a c c i " , l " , 2 t , o c , ; t p " q S L g r h c . , u l , 5 r n c / / n u e e c P e a s " " u { / e s a e e s t h a s c v e , , e j s e p x s s ( P r s . e r , s s r i t t i " a a T j r : o T v / - ) o f r m o p s 3 n o e a a n i a s k / i 0 " k r u u { ( l m . e a o , , e " t t a t s g n p n t n ; h h u e . e ; i : e } / " t r g t / x ` [ ; h [ e ( v 2 t , . O f t " 1 : . p u ( p / } 1 . t l " a s , 2 n i l p g e 4 e o t a e a , x n e g [ r c t s x e l c o a ) t [ i h m u ; ] o m / m t " f i f e h ) f t i n ] s ] l t / e " e s a t ) / . u ] " * t " " ; : h " 1 O ; 2 p " 4 t 2 " i 0 , o " " n 0 , s " " , 1 ; 0 1 ) 0 ; ) ; Usage Example You can try it at the following URL. (Login to GakuNin RDM is required.) ...

March 21, 2025 · 12 min · Nakamura

Prototyping a TEI/XML File Editing Environment Using LEAF Writer and GakuNin RDM

Overview This is a memo about prototyping a TEI/XML file editing environment using LEAF Writer and GakuNin RDM. References The following article introduced how to use LEAF Writer from Next.js. In particular, the following npm package is used. https://www.npmjs.com/package/@cwrc/leafwriter For the input/output of TEI/XML files to be edited above, GakuNin RDM is used. The following article may also be helpful regarding how to use the GakuNin RDM API from JavaScript. ...

March 21, 2025 · 6 min · Nakamura

Customizing the LEAF Writer Editor Toolbar

Overview LEAF Writer provides buttons at the top of the screen to support tag insertion. This article introduces how to customize them. As a result, I added functionality to insert <app><lem>aaa</lem><rdg>bbb</rdg></app>. https://youtu.be/XMnRP7s2atw Editing Edit the following file: packages/cwrc-leafwriter/src/components/editorToolbar/index.tsx Features for supporting tags such as person names and place names are configured as follows. For example, the description for organization has been commented out: c o n { } { { } { } { } s , , , , t g h i o } t t t g c g d h i o t t c g d h i o t t c g d h i o t t r i c n , i o y r o r i i c n i y o r i i c n i y o r i i c n i y i o d o C i c c c s } t o p o l o s d o C t p l o s d o C t p l o s d o C t p t u e n l f o o o h ) l l e u o u a e n l l e o u a e n l l e o u a e n l l e e p : : i n n n o e p u ; e t : p r p b : : i e : r p b : : i e : r p b : : i e : m : c ( s s s w v o s : i : : : l c : : : l c : : : l c : s i ' k ! t t t C e s e p ' e i e k ' e i e k ' e i e k ' : ' s i : c o a n i S ' : b ' e ' d s n : ' i e ' d s n : ' i e ' d s n : ' i a R n o r p p n n t t e T u a n a : R t T c n a : R t T c n a : R t T c ( c e s n e o o t c S i l a ' t c t c e i a o t c e i a o t c e i a o M t a e t c s s e h o o e g A t t i t ! a t g n i t ! a t g n i t ! a t g n e i d r a t X Y x o u n c ' d o i t i i d y B t i i d y B t i i d y B n o o t = i t r r : t , d n o y o s o . = P u y o s o . = P u y o s o . = O u u n n T > n = = = M E c i ' n . n S n p > e t . n S n p > l t . n S n o > r t I ' l a e e l e { o T , ' p ' u l e r t p ' u l l a t o ' u l r g t t , y g { r c r r n : : n a , e , p y r w s o l , p y a w c o r , p y g w a o e , ' . o e e u p : g r p , s i o n a p , c i e n g p , a i n n m , c n c c ( c ' o ' t s o o n n ' c o e n ' ' a o n n i ' u t t t { o r s t , y o r n d ' , e r . d , , n r i d z , | r a . . n i X r p n t . o , . t i o i t z o a r i l t t b , u e . e i w c e c w z e a w t I e n e o a b e : c d c . o d o . a d t . i t n e f p i o p , o ( o w l ( n w t ( i w o e t r t n n o ' l ' n r o ' , r i ' o r n m ) . ; + e ' s d o p , i r p i o o n i ' ) c r , Y i r e t . l t n r . t , [ r u 3 . v . r e m a e . g i e ] e r 4 c } i m s r a c r c a c r t r ; u , d a o . i e . o n o . = u e r e i n t n ' t l i n t r n r r n ' a , ) a o z , a [ n t e ' , ) g , g r a g ; . n , , g g . t g g t e e m i e e , h r r a o r t i . . i n . B d a a n ' a o e d d , ) d u : d d , d n E E E d i n n n i s t t t n R i i i g e t t t C a y y y l d D D D i o i i i e n a a a n l l l l t y o o o R g g g e } ( ( ( c , ' ' ' t p p o ( e l r ) r a g ; s c a o e n n ' i ' ) z ) , a , t i o n ' ) , As a result, the choices are limited as follows: ...

October 31, 2024 · 26 min · Nakamura

Using LEAF Writer from Next.js

Overview This article introduces how to use LEAF Writer from Next.js. Demo You can try it from the following URL. https://leaf-writer-nextjs.vercel.app/ Below is a screenshot example. The header section is the part added using Next.js. The editor section uses LEAF Writer. The source code is available at the following link. https://github.com/nakamura196/leaf-writer-nextjs Usage Instructions are described at the following link. https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer/-/tree/main/packages/cwrc-leafwriter?ref_type=heads As a note, the div container’s id must be set to leaf-writer-container. I found that not doing so causes the styling to break. I would like to submit a pull request regarding this in the future. ...

October 29, 2024 · 2 min · Nakamura

LEAF Writer: Adding Mirador

Overview This is a record of investigating how to customize LEAF Writer. https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer This time, we add Mirador as shown below. Method Please refer to the following. https://gitlab.com/nakamura196/leaf-writer/-/commit/377438739cdeb0a7b770ee9d4b9fea86081179d8 The file that needs to be modified is as follows. i i i i i } c } e m m m m n l x p p p p t a p t w a r r r r m $ c i c } p } r } p o o o @ o e t a a r s e e e e i p u g o r e o r r r t r r t r g i s a a a a r a r n n t t t t $ ` t t } t } i c c c } t s t t r t t t s t f r e ? t d d d d e a g r o s h h h h ( ) h h ) h ) o o o ; h e h h t - a i n : e I o o o o s d e e r t i i i i ` < ; i i c i t ; i i ; a n n n i w ] w } i t i i $ ' W i M c b t r i n n n n l o B n e r s s s s # d s s o f h s f t ( s s s d i , i , e s ( s s d j r g i e u I s : i l l l l i r r t S u . . . . $ i . . n i . e d t t t : n { } n s s . ) . . e f q i n r t d t f y y y y n I e I c c w i t a { v w w s ( s w ( o d , d i l m $ c f r u t o a I e : r W V t n a n r t r d a t p r r o ! . r ! p c $ m c t o l o d i i { p u a o e e r d i ? i r i w i t a - s k d o o i g t a i i i l s p i t r ) f a o h w o w e n r a r u m r r e o i : s n i e r d a t d t s e l r t = N r r d t t e u r t h o . a n n i s a : B t a g r l y r f t g t w i : g t i a : x l ( e a N e = e e . c o e i c f c i f s : d a - d e e t ' - f V s r ; e e t N r s n { r ` m a n " r r l c c r s e i s f i . e { r d o B n j u r f i t i r r e s a N a c u = = $ e m t $ . . o e e . . s n i e g i [ d O i r r t I q i o r e r n ; r t m a b e n a = { e I { e e g s s e w s d m s d M p s I e I i u ' m o w i g { : r e m l : k - f t p = d t v v ( s s v r D i t = , a e a n a n i e ; m e n ; i : e e n 1 a t w a = } h e e ' ) D e i o l U n n b s k d f r r g W n : - a o ; l r r r t ` i n n d o n t c e r { i : l t s e V y ' P ; r g s n n w s i i e a a ) s t t o r c t e u i f e a x i ' m r i ; t s e y n e b t n g t . . ( ( c e u ( r m = e f - n = e ; i o t r t x ; ; u e t t a i ' ' u t m ' . e = s a n c = w r p e i r t | t r I ? r p d l d m u e w e n $ t l e e n e a s r n i - e ; d ? i p } o o e r n r d t ( $ : s x u - r d ; g n l n , } b e " a c n n t i i ( d f e t = l 1 ; o { ; g i u _ ' u n d u t ; ( t t d o a m , - l ; r ; n l p i p t d s i m L b e o o c c a l M ; / ' e l a i b e ( t n e o o r r c ) s n i i W ; ; r i ' ` y g n a d I ) : . i i n r r @ e f ; ? l D t d y n f m f e a i t n V ? e o L e ) i r H i i e d t y t i = c o d ; t e T n l s @ o e p I e ' " u a ' i t M d e t t r r e d w f p m d , a u L ( . U y . ' s , e p a o e e l r E ` a r p v ; c r a c s n d s i n l * t i e i r t ` g s i t ' u z ; e [ t , s e i a ; e ' t ' ) c e m _ r c w p g ; i ) . c d e t ( r e t , b o . s e ' n a ' i r - r n s u s ) t g s p ( e w e : u b s . ) = a t c s r a b s , s " m - o l i k a a s c u { f e e n i t t b c r b b a a s f n e e t s r i o s c s l i t r l r o i b d c s ' i g / e i l b e y r i ) n ) n } m b u e ( ) i m ; t ; o : e u t ( ( ; b i / - n t e ( s e l n e I t e ; ) u ( e o x i c ( " - p i n t t = c ) ] u l f a h o > e ` n i V m a p s = ) s c i e t : t s > ; a i e h : f t w s 0 i { e - e t ; s b - a r o . o a n P r b r o s y r e o e l s , o s t s e i p t e a g @ s t o t n n t ) h m ( , m y e : ) e p { ) b n e i 0 ; o t s m ; d , c a y r g l : @ i e e t p f H y t U t T p - R : M e e L L s s 0 E c l ; l r i e i n r m p t i e t / g n - n h t e o t ) s - : l r = i e 0 > n d " t u > { / n < n d / o a d - n i u t v n - > s t a y f p e e - - c c a o l n l s , t i @ t t u y e p n e t s s c r i p t - e s l i n t / n o - u n s a f e - m e m b e r - a c c e s s The following section retrieves information from <facsimile sameAs="https://dl.ndl.go.jp/api/iiif/3437686/manifest.json">. ...

July 23, 2024 · 9 min · Nakamura

LEAF Writer: How to Add Sample Data

Overview This is a record of investigating how to customize LEAF Writer. https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer This time, it is a memo on how to add sample data. We add custom sample data as shown below. Method Please refer to the following. https://gitlab.com/nakamura196/leaf-writer/-/commit/c4e98090c94874037980819c9672eea10814eedb In addition to updating samples.json, it was also necessary to update apps/commons/src/icons/index.tsx to add an icon, although this is not mandatory. Result As shown below, the editor environment could be opened from the sample data. ...

June 29, 2024 · 1 min · Nakamura

LEAF Writer: How to Use the Image Viewer

Overview LEAF Writer provides a feature for displaying text and images side by side, as shown below. It also offers a feature where the text moves in sync when you navigate through image pages. This article introduces TEI/XML markup examples for displaying images in the Image Viewer section. Method Specify the pb tag as follows. https://github.com/kouigenjimonogatari/kouigenjimonogatari.github.io/blob/master/xml/lw/01.xml Specifically, it looks like this: < p b c o r r e s p = " # z o n e _ 0 0 0 5 " f a c s = " h t t p s : / / d l . n d l . g o . j p / a p i / i i i f / 3 4 3 7 6 8 6 / R 0 0 0 0 0 2 2 / 0 , 0 , 3 4 4 5 , 4 7 0 6 / f u l l / 0 / d e f a u l t . j p g " n = " 5 " / > The image specified in the facs attribute of the pb element appears to be displayed in the Image Viewer section. ...

June 29, 2024 · 2 min · Nakamura

LEAF Writer: Customizing Schemas

Overview This is an investigation record on how to customize LEAF Writer. https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer This time, it is a memo on how to customize schemas. The goal is to display Japanese translations and other customizations as shown below. Below is the display before customization. Based on the following schema, many elements are displayed with English descriptions. https://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng Method Specify the schema file as follows. https://github.com/kouigenjimonogatari/kouigenjimonogatari.github.io/blob/master/xml/lw/01.xml Specifically: < ? x m l - m o d e l h r e f = " h t t p s : / / k o u i g e n j i m o n o g a t a r i . g i t h u b . i o / l w / t e i _ g e n j i . r n g " t y p e = " a p p l i c a t i o n / x m l " s c h e m a t y p e n s = " h t t p : / / r e l a x n g . o r g / n s / s t r u c t u r e / 1 . 0 " ? > LEAF Writer reads this schema file and uses it for validation and presenting available elements. ...

June 29, 2024 · 3 min · Nakamura

Partial Update to TEI/XML Published in the Koui Genji Monogatari Text Data Repository

Overview I publish TEI/XML files for the Koui Genji Monogatari (Variorum Tale of Genji) in the following repository. https://github.com/kouigenjimonogatari I made some changes to the TEI/XML published here, so this is a note about those changes. Folder Structure Files before the modifications are stored here. There are no changes from before. https://github.com/kouigenjimonogatari/kouigenjimonogatari.github.io/tree/master/tei The updated files are stored here. https://github.com/kouigenjimonogatari/kouigenjimonogatari.github.io/tree/master/xml/lw This directory contains XML files with the modifications described below. Modifications Adding a Schema The following rng file was added. ...

June 28, 2024 · 8 min · Nakamura

LEAF Writer: Entity Lookup for Japan Search

Overview This is an investigation record on how to customize LEAF Writer. https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer This time, it is a memo on how to add Entity Lookup. Specifically, we add functionality to query the Japan Search utilization schema, as shown below. Method The following changes were made to the forked repository. https://gitlab.com/nakamura196/leaf-writer/-/commit/69e10e2ddd17f6cd01501fbf29f0dd86d1e86a3a Usage You can try a version with partially Japanese-localized UI using the following repository. https://gitlab.com/nakamura196/leaf-writer Please refer to the following for startup instructions. ...

June 27, 2024 · 1 min · Nakamura

LEAF Writer: Adding Japanese UI

Overview This is a research note on how to customize LEAF Writer. https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer This article covers how to add Japanese UI as a note. Method The following changes were made to a forked repository. https://gitlab.com/nakamura196/leaf-writer/-/commit/c9b7053814fc1e5a27a1847f20076096832dd68b Usage You can try a version with partially Japanese-localized UI using the following repository. https://gitlab.com/nakamura196/leaf-writer For startup instructions, please refer to the following. Summary I hope this is helpful for applications of LEAF Writer. ...

June 27, 2024 · 1 min · Nakamura

Running LEAF-Writer in a Local Environment

Overview I had the opportunity to run LEAF-Writer in a local environment, so here are my notes. Repository The following repository is used. https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer Method g c n n i d p p t m m l c e i r l a u o f n n - e w d r e h i v t t t e p r s : / / g i t l a b . c o m / c a l i n c s / c w r c / l e a f - w r i t e r / l e a f - w r i t e r LEAF-Writer starts on port 3000. ...

June 26, 2024 · 1 min · Nakamura