-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
100 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import addEmphasis from '../utilities/addEmphasis.js' | ||
|
||
export default function createPhonetic(phonetic) { | ||
export default function createPhonetic(phonetic, { targetLang }) { | ||
if (!phonetic) return `` | ||
return `<p class=phon>${ addEmphasis(phonetic) }</p>` | ||
const lang = targetLang ? `lang='${ targetLang }-fonipa'` : `` | ||
// NB: Don't add phonetic brackets. These can be added with CSS. | ||
return `<p class=phon ${ lang }>${ addEmphasis(phonetic) }</p>` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
export default function validateOptions(opts) { | ||
|
||
if (`analysisLang` in opts) { | ||
if (typeof opts.analysisLang !== `string`) throw new TypeError(`The 'analysisLang' option must be a String.`) | ||
if (`analysisLang` in opts && typeof opts.analysisLang !== `string`) { | ||
throw new TypeError(`The 'analysisLang' option must be a string.`) | ||
} | ||
|
||
if (`classes` in opts) { | ||
if (!Array.isArray(opts.classes)) throw new TypeError(`The 'classes' option must be an array.`) | ||
if (!opts.classes.every(cls => typeof cls === `string`)) throw new TypeError(`Each of the values of the 'classes' array must be a string.`) | ||
} | ||
|
||
if (`scription` in opts && typeof opts.scription !== `object`) throw new TypeError(`The 'scription' option must be an object.`) | ||
if (`scription` in opts && typeof opts.scription !== `object`) { | ||
throw new TypeError(`The 'scription' option must be an object.`) | ||
} | ||
|
||
if (`tag` in opts && typeof opts.tag !== `string`) { | ||
throw new TypeError(`The 'tag' option must be a string.`) | ||
} | ||
|
||
if (`tag` in opts && typeof opts.tag !== `string`) throw new TypeError(`The 'tag' option must be a string.`) | ||
if (`targetLang` in opts && typeof opts.targetLang !== `string`) { | ||
throw new TypeError(`The 'targetLang' option must be a string.`) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters