File tree 3 files changed +23
-1
lines changed
src/lib/components/sofria-render-json
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import RenderContent from ' ./RenderContent.svelte' ;
3
3
import type { Wrapper } from ' ./schema/sofria-schema' ;
4
+ import { makesBold , makesItalic } from ' ./schema/wrappers' ;
4
5
5
6
export let wrapper: Wrapper ;
7
+
8
+ const bold = makesBold (wrapper );
9
+ const italic = makesItalic (wrapper );
6
10
</script >
7
11
8
- <RenderContent content ={wrapper .content } />
12
+ {#if bold || italic }
13
+ <span class:font-bold ={bold } class:italic >
14
+ <RenderContent content ={wrapper .content } />
15
+ </span >
16
+ {:else }
17
+ <RenderContent content ={wrapper .content } />
18
+ {/if }
Original file line number Diff line number Diff line change 9
9
10
10
export let document: Document ;
11
11
12
+ // Uncomment to examine Sofria input
13
+ // console.log(JSON.stringify(document));
14
+
12
15
let mainSequence: Sequence ;
13
16
14
17
if (isFlatDocument (document )) {
Original file line number Diff line number Diff line change
1
+ import type { Wrapper } from './sofria-schema' ;
2
+
3
+ export function makesBold ( wrapper : Wrapper ) {
4
+ return [ 'usfm:bd' , 'usfm:bdit' ] . includes ( wrapper . subtype ) ;
5
+ }
6
+
7
+ export function makesItalic ( wrapper : Wrapper ) {
8
+ return [ 'usfm:it' , 'usfm:bdit' ] . includes ( wrapper . subtype ) ;
9
+ }
You can’t perform that action at this time.
0 commit comments