Parse word references in all Details notes fields

This commit is contained in:
Robbie Antenesse 2019-12-13 10:16:40 -07:00
parent 1b9a6fcda6
commit c25114b9fd
5 changed files with 19 additions and 17 deletions

View File

@ -1,6 +1,6 @@
{
"name": "lexiconga",
"version": "2.1.4",
"version": "2.1.5",
"description": "The quick and easy dictionary builder for constructed languages.",
"main": "template-index.html",
"repository": "https://github.com/Alamantus/Lexiconga.git",

View File

@ -60,7 +60,7 @@ export function renderDetails() {
const consonantHTML = `<p><strong>Consonants</strong><br>${consonants.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const vowelHTML = `<p><strong>Vowels</strong><br>${vowels.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const blendHTML = blends.length > 0 ? `<p><strong>Polyphthongs&nbsp;/&nbsp;Blends</strong><br>${blends.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>` : '';
const phonologyNotesHTML = phonology.notes.trim().length > 0 ? '<p><strong>Notes</strong></p><div>' + md(removeTags(phonology.notes)) + '</div>' : '';
const phonologyNotesHTML = phonology.notes.trim().length > 0 ? '<p><strong>Notes</strong></p><div>' + md(parseReferences(removeTags(phonology.notes))) + '</div>' : '';
const phonologyHTML = `<h2>Phonology</h2>
<div class="split two">
<div>${consonantHTML}</div>
@ -73,7 +73,7 @@ export function renderDetails() {
const onsetHTML = `<p><strong>Onset</strong><br>${onset.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const nucleusHTML = `<p><strong>Nucleus</strong><br>${nucleus.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const codaHTML = `<p><strong>Coda</strong><br>${coda.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '<p><strong>Notes</strong></p><div>' + md(removeTags(phonotactics.notes)) + '</div>' : '';
const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '<p><strong>Notes</strong></p><div>' + md(parseReferences(removeTags(phonotactics.notes))) + '</div>' : '';
const phonotacticsHTML = onset.length + nucleus.length + coda.length + phonotacticsNotesHTML.length > 0
? `<h2>Phonotactics</h2>
${onset.length > 0 || nucleus.length > 0 || coda.length > 0
@ -93,14 +93,14 @@ export function renderDetails() {
}
return false;
}).filter(html => html !== false).join(' ')}</p>` : '';
const orthographyNotesHTML = orthography.notes.trim().length > 0 ? '<p><strong>Notes</strong><br>' + md(removeTags(orthography.notes)) + '</div>' : '';
const orthographyNotesHTML = orthography.notes.trim().length > 0 ? '<p><strong>Notes</strong><br>' + md(parseReferences(removeTags(orthography.notes))) + '</div>' : '';
const orthographyHTML = translations.length + orthographyNotesHTML.length > 0
? `<h2>Orthography</h2>
${translationsHTML}
${orthographyNotesHTML}`
: '';
const grammarHTML = grammar.notes.trim().length > 0 ? '<h2>Grammar</h2><div>'
+ (grammar.notes.trim().length > 0 ? md(removeTags(grammar.notes)) : '')
+ (grammar.notes.trim().length > 0 ? md(parseReferences(removeTags(grammar.notes))) : '')
+ '</div>' : '';
detailsPanel.innerHTML = generalHTML + phonologyHTML + phonotacticsHTML + orthographyHTML + grammarHTML;

View File

@ -66,7 +66,7 @@ export function renderDetails() {
const consonantHTML = `<p><strong>Consonants</strong><br>${consonants.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const vowelHTML = `<p><strong>Vowels</strong><br>${vowels.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const blendHTML = blends.length > 0 ? `<p><strong>Polyphthongs&nbsp;/&nbsp;Blends</strong><br>${blends.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>` : '';
const phonologyNotesHTML = phonology.notes.trim().length > 0 ? '<p><strong>Notes</strong></p><div>' + md(removeTags(phonology.notes)) + '</div>' : '';
const phonologyNotesHTML = phonology.notes.trim().length > 0 ? '<p><strong>Notes</strong></p><div>' + md(phonology.notes) + '</div>' : '';
const phonologyHTML = `<h3>Phonology</h3>
<div class="split two">
<div>${consonantHTML}</div>
@ -79,11 +79,11 @@ export function renderDetails() {
const onsetHTML = `<p><strong>Onset</strong><br>${onset.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const nucleusHTML = `<p><strong>Nucleus</strong><br>${nucleus.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const codaHTML = `<p><strong>Coda</strong><br>${coda.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '<p><strong>Notes</strong></p><div>' + md(removeTags(phonotactics.notes)) + '</div>' : '';
const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '<p><strong>Notes</strong></p><div>' + md(phonotactics.notes) + '</div>' : '';
const phonotacticsHTML = onset.length + nucleus.length + coda.length + phonotacticsNotesHTML.length > 0
? `<h3>Phonotactics</h3>
${onset.length > 0 || nucleus.length > 0 || coda.length > 0
? `<div class="split three">
? `<div class="split three">
<div>${onsetHTML}</div>
<div>${nucleusHTML}</div>
<div>${codaHTML}</div>
@ -99,15 +99,17 @@ export function renderDetails() {
}
return false;
}).filter(html => html !== false).join(' ')}</p>` : '';
const orthographyNotesHTML = orthography.notes.trim().length > 0 ? '<p><strong>Notes</strong><br>' + md(removeTags(orthography.notes)) + '</div>' : '';
const orthographyNotesHTML = orthography.notes.trim().length > 0 ? '<p><strong>Notes</strong><br>' + md(orthography.notes) + '</div>' : '';
const orthographyHTML = translations.length + orthographyNotesHTML.length > 0
? `<h3>Orthography</h3>
${translationsHTML}
${orthographyNotesHTML}`
: '';
const grammarHTML = grammar.notes.trim().length > 0 ? '<h3>Grammar</h3><div>'
+ (grammar.notes.trim().length > 0 ? md(removeTags(grammar.notes)) : '')
+ '</div>' : '';
const grammarHTML = grammar.notes.trim().length > 0
? '<h3>Grammar</h3><div>'
+ (grammar.notes.trim().length > 0 ? md(grammar.notes) : '')
+ '</div>'
: '';
detailsPanel.innerHTML = generalHTML + phonologyHTML + phonotacticsHTML + orthographyHTML + grammarHTML;
}

View File

@ -44,20 +44,20 @@ class PublicDictionary {
'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(),
'vowels' => $result['vowels'] !== '' ? explode(' ', $result['vowels']) : array(),
'blends' => $result['blends'] !== '' ? explode(' ', $result['blends']) : array(),
'notes' => $result['phonology_notes'],
'notes' => $this->parseReferences(strip_tags($result['phonology_notes']), $result['id']),
),
'phonotactics' => array(
'onset' => $result['onset'] !== '' ? explode(',', $result['onset']) : array(),
'nucleus' => $result['nucleus'] !== '' ? explode(',', $result['nucleus']) : array(),
'coda' => $result['coda'] !== '' ? explode(',', $result['coda']) : array(),
'notes' => $result['phonotactics_notes'],
'notes' => $this->parseReferences(strip_tags($result['phonotactics_notes']), $result['id']),
),
'orthography' => array(
'translations' => $result['translations'] !== '' ? explode(PHP_EOL, $result['translations']) : array(),
'notes' => $result['orthography_notes'],
'notes' => $this->parseReferences(strip_tags($result['orthography_notes']), $result['id']),
),
'grammar' => array(
'notes' => $result['grammar_notes'],
'notes' => $this->parseReferences(strip_tags($result['grammar_notes']), $result['id']),
),
),
'settings' => array(

View File

@ -134,7 +134,7 @@ switch ($view) {
oldLoad && oldLoad();
if (UpUp) {
UpUp.start({
'cache-version': '2.1.4',
'cache-version': '2.1.5',
'content-url': 'offline.html',
'assets': [
\"" . implode('","', $files) . "\"