Skip to content

Commit

Permalink
NEW: Support emphasis in word transcription
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhieb committed Jan 2, 2024
1 parent d4301a6 commit 03e33a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/words/transcription.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import addEmphasis from '../utilities/addEmphasis.js'

export default function createTranscription(data, { targetLang }) {

const lang = targetLang ? `lang='${ targetLang }'` : ``
let html = ``

for (const ortho in data) {
const txn = data[ortho]
html += `<span class=w-txn data-ortho='${ ortho }' ${ lang }>${ txn }</span>\n`
html += `<span class=w-txn data-ortho='${ ortho }' ${ lang }>${ addEmphasis(txn) }</span>\n`
}

return html
Expand Down
13 changes: 13 additions & 0 deletions test/words.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,17 @@ describe(`words`, function() {

})

it.only(`word transcription supports emphasis`, async function() {

const scription = `
\\w *waxdungu* qasi
\\wlt *day-one* man
`

const { dom, html } = await parse(scription)
const b = findElement(dom, el => getTagName(el) === `b`)

expect(getTextContent(b)).to.equal(`waxdungu`)

})
})

0 comments on commit 03e33a0

Please sign in to comment.