@@ -309,6 +321,13 @@
Orthography
+
@@ -345,6 +364,9 @@
+
diff --git a/src/js/view/render.js b/src/js/view/render.js
index 8ed7090..6421f0a 100644
--- a/src/js/view/render.js
+++ b/src/js/view/render.js
@@ -52,12 +52,14 @@ export function renderDetails() {
const consonantHTML = `Consonants
${consonants.map(letter => `${letter}`).join(' ')}
`;
const vowelHTML = `Vowels
${vowels.map(letter => `${letter}`).join(' ')}
`;
const blendHTML = blends.length > 0 ? `Polyphthongs / Blends
${blends.map(letter => `${letter}`).join(' ')}
` : '';
+ const phonologyNotesHTML = phonology.notes.trim().length > 0 ? 'Notes
' + md(removeTags(phonology.notes)) + '
' : '';
const phonologyHTML = `Phonology
${consonantHTML}
${vowelHTML}
- ${blendHTML}`;
+ ${blendHTML}
+ ${phonologyNotesHTML}`;
const { onset, nucleus, coda } = phonotactics;
const onsetHTML = `Onset
${onset.map(letter => `${letter}`).join(' ')}
`;
@@ -66,29 +68,32 @@ export function renderDetails() {
const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? 'Notes
' + md(removeTags(phonotactics.notes)) + '
' : '';
const phonotacticsHTML = onset.length + nucleus.length + coda.length + phonotacticsNotesHTML.length > 0
? `Phonotactics
-
+ ${onset.length > 0 || nucleus.length > 0 || coda.length > 0
+ ? `
${onsetHTML}
${nucleusHTML}
${codaHTML}
-
+
` : ''}
${phonotacticsNotesHTML}`
: '';
const { translations } = orthography;
- const translationsHTML = `Translations
${translations.map(translation => {
+ const translationsHTML = translations.length > 0 ? `
Translations
${translations.map(translation => {
translation = translation.split('=').map(value => value.trim());
if (translation.length > 1 && translation[0] !== '' && translation[1] !== '') {
return `${translation[0]}${translation[1]}`;
}
return false;
- }).filter(html => html !== false).join(' ')}
`;
+ }).filter(html => html !== false).join(' ')}` : '';
const orthographyNotesHTML = orthography.notes.trim().length > 0 ? 'Notes
' + md(removeTags(orthography.notes)) + '
' : '';
- const orthographyHTML = translations.length > 0 && orthographyNotesHTML.length > 0
+ const orthographyHTML = translations.length + orthographyNotesHTML.length > 0
? `
Orthography
- ${translations.length > 0 ? translationsHTML : ''}
+ ${translationsHTML}
${orthographyNotesHTML}`
: '';
- const grammarHTML = '
Grammar
' + md(removeTags(grammar.notes)) + '
';
+ const grammarHTML = grammar.notes.trim().length > 0 ? '
Grammar
'
+ + (grammar.notes.trim().length > 0 ? md(removeTags(grammar.notes)) : '')
+ + '
' : '';
detailsPanel.innerHTML = generalHTML + phonologyHTML + phonotacticsHTML + orthographyHTML + grammarHTML;
}
diff --git a/src/js/view/search.js b/src/js/view/search.js
index b0073ef..c3637b1 100644
--- a/src/js/view/search.js
+++ b/src/js/view/search.js
@@ -22,6 +22,7 @@ export function getSearchFilters() {
caseSensitive: document.getElementById('searchCaseSensitive').checked,
ignoreDiacritics: document.getElementById('searchIgnoreDiacritics').checked,
exact: document.getElementById('searchExactWords').checked,
+ orthography: document.getElementById('searchOrthography').checked,
name: document.getElementById('searchIncludeName').checked,
definition: document.getElementById('searchIncludeDefinition').checked,
details: document.getElementById('searchIncludeDetails').checked,
@@ -53,11 +54,13 @@ export function getMatchingSearchWords() {
}).filter(word => {
searchTerm = filters.ignoreDiacritics ? removeDiacritics(searchTerm) : searchTerm;
searchTerm = filters.caseSensitive ? searchTerm : searchTerm.toLowerCase();
- let name = filters.ignoreDiacritics ? removeDiacritics(word.name) : word.name;
+ let name = filters.orthography ? translateOrthography(word.name) : word.name;
+ name = filters.ignoreDiacritics ? removeDiacritics(name) : name;
name = filters.caseSensitive ? name : name.toLowerCase();
let definition = filters.ignoreDiacritics ? removeDiacritics(word.definition) : word.definition;
definition = filters.caseSensitive ? definition : definition.toLowerCase();
- let details = filters.ignoreDiacritics ? removeDiacritics(word.details) : word.details;
+ let details = filters.orthography ? parseReferences(word.details) : word.details;
+ details = filters.ignoreDiacritics ? removeDiacritics(details) : details;
details = filters.caseSensitive ? details : details.toLowerCase();
const isInName = filters.name && (filters.exact
@@ -80,6 +83,10 @@ export function highlightSearchTerm(word) {
if (searchTerm) {
const filters = getSearchFilters();
const markedUpWord = cloneObject(word);
+ if (filters.orthography) {
+ markedUpWord.name = translateOrthography(markedUpWord.name);
+ markedUpWord.details = parseReferences(markedUpWord.details);
+ }
if (filters.ignoreDiacritics) {
const searchTermLength = searchTerm.length;
searchTerm = removeDiacritics(searchTerm);
diff --git a/template-view.html b/template-view.html
index 7b9fe82..c5183dc 100644
--- a/template-view.html
+++ b/template-view.html
@@ -81,6 +81,9 @@
+