Skip to content

Commit

Permalink
NEW: Support emphasis in phonetic transcription
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhieb committed Dec 18, 2023
1 parent 1b9011c commit f1a0ddd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/lines/phonetic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import addEmphasis from '../utilities/addEmphasis.js'

export default function createPhonetic(phonetic) {
if (!phonetic) return ``
return `<p class=phon>${ phonetic }</p>`
return `<p class=phon>${ addEmphasis(phonetic) }</p>`
}
42 changes: 32 additions & 10 deletions test/lines.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,42 @@ describe(`lines`, function() {

})

it(`phonetic transcription`, function() {
describe(`phonetic transcription`, function() {

const phonetic = `ɔ́gɔ̀tɛ́ɛ́rɛ̀rà`
it(`renders`, function() {

const scription = `
\\phon ${ phonetic }
\\m ó-ko-tɛ́ɛr-er-a
\\gl pp-5-sing-appl-ind
`
const phonetic = `ɔ́gɔ̀tɛ́ɛ́rɛ̀rà`

const scription = `
\\phon ${ phonetic }
\\m ó-ko-tɛ́ɛr-er-a
\\gl pp-5-sing-appl-ind
`

const { dom } = parse(scription)
const el = findElementByClass(dom, `phon`)

expect(getTextContent(el)).to.equal(phonetic)

})

it(`renders with emphasis`, function() {

const phonetic = `ɔ́gɔ̀*tɛ́ɛ́r*ɛ̀rà`

const scription = `
\\phon ${ phonetic }
\\m ó-ko-*tɛ́ɛr*-er-a
\\gl pp-5-*sing*-appl-ind
`

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

expect(getTextContent(el)).to.equal(phonetic)
expect(getTextContent(b)).to.equal(`tɛ́ɛ́r`)

})

})

Expand Down

0 comments on commit f1a0ddd

Please sign in to comment.