Correctly show/hide homonymn number
This commit is contained in:
parent
079288a0a8
commit
45e9e5230c
|
@ -90,7 +90,7 @@ export function parseReferences(detailsMarkdown) {
|
|||
if (homonymn < 1 && homonymnIndexes.length > 0) {
|
||||
homonymn = 1;
|
||||
}
|
||||
const homonymnSubHTML = homonymn > 0 ? '<sub>' + homonymn.toString() + '</sub>' : '';
|
||||
const homonymnSubHTML = homonymnIndexes.length > 1 && homonymn - 1 >= 0 ? '<sub>' + homonymn.toString() + '</sub>' : '';
|
||||
const wordMarkdownLink = `<span class="word-reference">[<span class="orthographic-translation">${translateOrthography(wordToFind)}</span>${homonymnSubHTML}](#${existingWordId})</span>`;
|
||||
detailsMarkdown = detailsMarkdown.replace(new RegExp(reference, 'g'), wordMarkdownLink);
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ VALUES ($new_id, ?, ?, ?, ?, ?)";
|
|||
if ($homonymn < 1) {
|
||||
$homonymn = 1;
|
||||
}
|
||||
$homonymn_sub_html = $homonymn > 0 ? '<sub>' . $homonymn . '</sub>' : '';
|
||||
$homonymn_sub_html = count($reference_ids) > 1 && $homonymn - 1 >= 0 ? '<sub>' . $homonymn . '</sub>' : '';
|
||||
$site_root = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], $dictionary_id));
|
||||
$markdown_link = '<span class="word-reference"><a href="' . $site_root . $dictionary_id . '/' . $target_id .'" target="_blank" title="Link to Reference">'
|
||||
. '<span class="orthographic-translation">' . $this->translateOrthography($word_to_find, $dictionary_id) . '</span>' . $homonymn_sub_html
|
||||
|
|
Loading…
Reference in New Issue