From c25114b9fdb2bbbcf52db0479f98e3dd946f6527 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 13 Dec 2019 10:16:40 -0700 Subject: [PATCH] Parse word references in all Details notes fields --- package.json | 2 +- src/js/render/details.js | 8 ++++---- src/js/view/render.js | 16 +++++++++------- src/php/api/PublicDictionary.php | 8 ++++---- src/php/router.php | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 44d19cb..eefaf9a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/js/render/details.js b/src/js/render/details.js index 606558b..e0b18b8 100644 --- a/src/js/render/details.js +++ b/src/js/render/details.js @@ -60,7 +60,7 @@ 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 phonologyNotesHTML = phonology.notes.trim().length > 0 ? '

Notes

' + md(parseReferences(removeTags(phonology.notes))) + '
' : ''; const phonologyHTML = `

Phonology

${consonantHTML}
@@ -73,7 +73,7 @@ export function renderDetails() { const onsetHTML = `

Onset
${onset.map(letter => `${letter}`).join(' ')}

`; const nucleusHTML = `

Nucleus
${nucleus.map(letter => `${letter}`).join(' ')}

`; const codaHTML = `

Coda
${coda.map(letter => `${letter}`).join(' ')}

`; - const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '

Notes

' + md(removeTags(phonotactics.notes)) + '
' : ''; + const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '

Notes

' + md(parseReferences(removeTags(phonotactics.notes))) + '
' : ''; const phonotacticsHTML = onset.length + nucleus.length + coda.length + phonotacticsNotesHTML.length > 0 ? `

Phonotactics

${onset.length > 0 || nucleus.length > 0 || coda.length > 0 @@ -93,14 +93,14 @@ export function renderDetails() { } return false; }).filter(html => html !== false).join(' ')}

` : ''; - const orthographyNotesHTML = orthography.notes.trim().length > 0 ? '

Notes
' + md(removeTags(orthography.notes)) + '

' : ''; + const orthographyNotesHTML = orthography.notes.trim().length > 0 ? '

Notes
' + md(parseReferences(removeTags(orthography.notes))) + '' : ''; const orthographyHTML = translations.length + orthographyNotesHTML.length > 0 ? `

Orthography

${translationsHTML} ${orthographyNotesHTML}` : ''; const grammarHTML = grammar.notes.trim().length > 0 ? '

Grammar

' - + (grammar.notes.trim().length > 0 ? md(removeTags(grammar.notes)) : '') + + (grammar.notes.trim().length > 0 ? md(parseReferences(removeTags(grammar.notes))) : '') + '
' : ''; detailsPanel.innerHTML = generalHTML + phonologyHTML + phonotacticsHTML + orthographyHTML + grammarHTML; diff --git a/src/js/view/render.js b/src/js/view/render.js index af37e0f..2955fbb 100644 --- a/src/js/view/render.js +++ b/src/js/view/render.js @@ -66,7 +66,7 @@ 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 phonologyNotesHTML = phonology.notes.trim().length > 0 ? '

Notes

' + md(phonology.notes) + '
' : ''; const phonologyHTML = `

Phonology

${consonantHTML}
@@ -79,11 +79,11 @@ export function renderDetails() { const onsetHTML = `

Onset
${onset.map(letter => `${letter}`).join(' ')}

`; const nucleusHTML = `

Nucleus
${nucleus.map(letter => `${letter}`).join(' ')}

`; const codaHTML = `

Coda
${coda.map(letter => `${letter}`).join(' ')}

`; - const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '

Notes

' + md(removeTags(phonotactics.notes)) + '
' : ''; + const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '

Notes

' + md(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}
@@ -99,15 +99,17 @@ export function renderDetails() { } return false; }).filter(html => html !== false).join(' ')}

` : ''; - const orthographyNotesHTML = orthography.notes.trim().length > 0 ? '

Notes
' + md(removeTags(orthography.notes)) + '

' : ''; + const orthographyNotesHTML = orthography.notes.trim().length > 0 ? '

Notes
' + md(orthography.notes) + '

' : ''; const orthographyHTML = translations.length + orthographyNotesHTML.length > 0 ? `

Orthography

${translationsHTML} ${orthographyNotesHTML}` : ''; - const grammarHTML = grammar.notes.trim().length > 0 ? '

Grammar

' - + (grammar.notes.trim().length > 0 ? md(removeTags(grammar.notes)) : '') - + '
' : ''; + const grammarHTML = grammar.notes.trim().length > 0 + ? '

Grammar

' + + (grammar.notes.trim().length > 0 ? md(grammar.notes) : '') + + '
' + : ''; detailsPanel.innerHTML = generalHTML + phonologyHTML + phonotacticsHTML + orthographyHTML + grammarHTML; } diff --git a/src/php/api/PublicDictionary.php b/src/php/api/PublicDictionary.php index 2f6bd87..7459c19 100644 --- a/src/php/api/PublicDictionary.php +++ b/src/php/api/PublicDictionary.php @@ -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( diff --git a/src/php/router.php b/src/php/router.php index ec0eb64..b015b2d 100644 --- a/src/php/router.php +++ b/src/php/router.php @@ -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) . "\"