Rename CSS class names "pitch-accent" to "pronunciation" (#1850)

* pitch-accents => pronunciations

* Update dataset property names

* pitch-accent-dictionary => pronunciation-dictionary

* Update styles

* Update template name

* Update attributes
This commit is contained in:
toasted-nutbread 2021-07-25 18:16:07 -04:00 committed by GitHub
parent 3f73889874
commit a9710b8acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 64 deletions

View File

@ -16,10 +16,10 @@
*/
:root {
--pitch-accent-annotation-color: #000000;
--pronunciation-annotation-color: #000000;
}
:root[data-theme=dark] {
--pitch-accent-annotation-color: #ffffff;
--pronunciation-annotation-color: #ffffff;
}
.pronunciation-downstep-notation {
@ -34,7 +34,7 @@
position: relative;
}
.pronunciation-mora-line {
border-color: var(--pitch-accent-annotation-color);
border-color: var(--pronunciation-annotation-color);
}
.pronunciation-mora[data-pitch=high]>.pronunciation-mora-line {
display: block;
@ -105,27 +105,27 @@
.pronunciation-graph-line,
.pronunciation-graph-line-tail {
fill: none;
stroke: var(--pitch-accent-annotation-color);
stroke: var(--pronunciation-annotation-color);
stroke-width: 5;
}
.pronunciation-graph-line-tail {
stroke-dasharray: 5 5;
}
.pronunciation-graph-dot {
fill: var(--pitch-accent-annotation-color);
stroke: var(--pitch-accent-annotation-color);
fill: var(--pronunciation-annotation-color);
stroke: var(--pronunciation-annotation-color);
stroke-width: 5;
}
.pronunciation-graph-dot-downstep1 {
fill: none;
stroke: var(--pitch-accent-annotation-color);
stroke: var(--pronunciation-annotation-color);
stroke-width: 5;
}
.pronunciation-graph-dot-downstep2 {
fill: var(--pitch-accent-annotation-color);
fill: var(--pronunciation-annotation-color);
}
.pronunciation-graph-triangle {
fill: none;
stroke: var(--pitch-accent-annotation-color);
stroke: var(--pronunciation-annotation-color);
stroke-width: 5;
}

View File

@ -144,7 +144,7 @@
--tag-frequency-background-color: #5cb85c;
--tag-part-of-speech-background-color: #565656;
--tag-search-background-color: #8a8a91;
--tag-pitch-accent-dictionary-background-color: #6640be;
--tag-pronunciation-dictionary-background-color: #6640be;
--sidebar-background-color: #f8f9fa;
@ -212,7 +212,7 @@
--tag-frequency-background-color: #489148;
--tag-part-of-speech-background-color: #565656;
--tag-search-background-color: #69696e;
--tag-pitch-accent-dictionary-background-color: #6640be;
--tag-pronunciation-dictionary-background-color: #6640be;
--sidebar-background-color: #282828;
@ -807,8 +807,8 @@ button.action-button[data-icon=source-term]::before {
.tag[data-category=search] {
--tag-color: var(--tag-search-background-color);
}
.tag[data-category=pitch-accent-dictionary] {
--tag-color: var(--tag-pitch-accent-dictionary-background-color);
.tag[data-category=pronunciation-dictionary] {
--tag-color: var(--tag-pronunciation-dictionary-background-color);
}
@ -825,7 +825,7 @@ button.action-button[data-icon=source-term]::before {
}
.entry[data-definition-count='0'] .entry-body-section[data-section-type=definitions],
.entry[data-frequency-count='0'] .entry-body-section[data-section-type=frequencies],
.entry[data-pitch-accent-count='0'] .entry-body-section[data-section-type=pitch-accents] {
.entry[data-pronunciation-count='0'] .entry-body-section[data-section-type=pronunciations] {
display: none;
}
@ -1422,60 +1422,60 @@ button.definition-item-expansion-button:focus:focus-visible+.definition-item-con
/* Pitch accent styles */
.pitch-accent-group-list {
.pronunciation-group-list {
margin: 0;
padding: 0 0 0 var(--list-padding1);
list-style-type: decimal;
}
.pitch-accent-group-list[data-count='0'],
.pitch-accent-group-list[data-count='1'] {
.pronunciation-group-list[data-count='0'],
.pronunciation-group-list[data-count='1'] {
padding-left: 0;
list-style-type: none;
}
.pitch-accent-list {
.pronunciation-list {
margin: 0;
padding: 0 0 0 var(--list-padding2);
list-style-type: circle;
display: block;
}
.pitch-accent-list[data-count='0'],
.pitch-accent-list[data-count='1'] {
.pronunciation-list[data-count='0'],
.pronunciation-list[data-count='1'] {
padding-left: 0;
list-style-type: none;
display: inline;
}
.pitch-accent-group::marker,
.pitch-accent::marker {
.pronunciation-group::marker,
.pronunciation::marker {
color: var(--text-color-light3);
}
.pitch-accent {
.pronunciation {
display: list-item;
line-height: 1.5;
}
.pitch-accent-list[data-count='0'] .pitch-accent,
.pitch-accent-list[data-count='1'] .pitch-accent {
.pronunciation-list[data-count='0'] .pronunciation,
.pronunciation-list[data-count='1'] .pronunciation {
display: inline;
}
.pitch-accent-group-tag-list {
.pronunciation-group-tag-list {
margin-right: 0.375em;
}
.pitch-accent-disambiguation-list {
.pronunciation-disambiguation-list {
color: var(--text-color-light3);
padding-right: var(--disambiguation-space);
}
.pitch-accent-disambiguation-list::before {
.pronunciation-disambiguation-list::before {
content: var(--disambiguation-prefix);
}
.pitch-accent-disambiguation-list::after {
.pronunciation-disambiguation-list::after {
content: var(--disambiguation-suffix);
}
.pitch-accent-disambiguation+.pitch-accent-disambiguation::before {
.pronunciation-disambiguation+.pronunciation-disambiguation::before {
content: var(--disambiguation-separator);
}
.pitch-accent-disambiguation-list[data-count='0'] {
.pronunciation-disambiguation-list[data-count='0'] {
display: none;
}
.pitch-accent-tag-list:not([data-count='0']) {
.pronunciation-tag-list:not([data-count='0']) {
margin-right: 0.375em;
}
.pronunciation-downstep-notation-container {
@ -1943,29 +1943,29 @@ button.footer-notification-close-button {
display: inline;
}
:root[data-show-pitch-accent-downstep-notation=true] .pitch-accent-disambiguation-list[data-term-count='0'],
:root[data-show-pitch-accent-downstep-notation=true] .pitch-accent-disambiguation[data-type=reading] {
:root[data-show-pronunciation-text=true] .pronunciation-disambiguation-list[data-term-count='0'],
:root[data-show-pronunciation-text=true] .pronunciation-disambiguation[data-type=reading] {
display: none;
}
:root[data-show-pitch-accent-downstep-notation=false] .pronunciation-text-container {
:root[data-show-pronunciation-text=false] .pronunciation-text-container {
display: none;
}
:root[data-show-pitch-accent-position-notation=false] .pronunciation-downstep-notation-container {
:root[data-show-pronunciation-downstep-position=false] .pronunciation-downstep-notation-container {
display: none;
}
:root[data-show-pitch-accent-graph=false] .pronunciation-graph-container {
:root[data-show-pronunciation-graph=false] .pronunciation-graph-container {
display: none;
}
:root[data-glossary-layout-mode=compact][data-show-pitch-accent-graph=false] .pitch-accent-list:not([data-has-tags=true]) {
:root[data-glossary-layout-mode=compact][data-show-pronunciation-graph=false] .pronunciation-list:not([data-has-tags=true]) {
display: inline;
list-style: none;
padding-left: 0;
}
:root[data-glossary-layout-mode=compact][data-show-pitch-accent-graph=false] .pitch-accent-list:not([data-has-tags=true]) .pitch-accent {
:root[data-glossary-layout-mode=compact][data-show-pronunciation-graph=false] .pronunciation-list:not([data-has-tags=true]) .pronunciation {
display: inline;
}
:root[data-glossary-layout-mode=compact][data-show-pitch-accent-graph=false] .pitch-accent-list:not([data-has-tags=true]) .pitch-accent:not(:first-child)::before {
:root[data-glossary-layout-mode=compact][data-show-pronunciation-graph=false] .pronunciation-list:not([data-has-tags=true]) .pronunciation:not(:first-child)::before {
white-space: pre-wrap;
content: var(--compact-list-separator);
display: inline;

View File

@ -22,8 +22,8 @@
<div class="entry-body-section" data-section-type="frequencies">
<div class="entry-body-section-content frequency-group-list"></div>
</div>
<div class="entry-body-section" data-section-type="pitch-accents">
<ol class="entry-body-section-content pitch-accent-group-list"></ol>
<div class="entry-body-section" data-section-type="pronunciations">
<ol class="entry-body-section-content pronunciation-group-list"></ol>
</div>
<div class="entry-body-section" data-section-type="definitions">
<ol class="entry-body-section-content definition-list"></ol>
@ -82,9 +82,9 @@
</span></span></template>
<!-- Pitch accent templates -->
<template id="pitch-accent-group-template"><li class="pitch-accent-group"><span class="pitch-accent-group-tag-list tag-list"></span><ul class="pitch-accent-list"></ul></li></template>
<template id="pitch-accent-disambiguation-template"><span class="pitch-accent-disambiguation"></span></template>
<template id="pitch-accent-template"><li class="pitch-accent"><span class="pitch-accent-tag-list tag-list"></span><span class="pitch-accent-disambiguation-list"></span><span class="pronunciation-representation-list"><span class="pronunciation-text-container"></span><span class="pronunciation-downstep-notation-container"></span><span class="pronunciation-graph-container"></span></span></li></template>
<template id="pronunciation-group-template"><li class="pronunciation-group"><span class="pronunciation-group-tag-list tag-list"></span><ul class="pronunciation-list"></ul></li></template>
<template id="pronunciation-disambiguation-template"><span class="pronunciation-disambiguation"></span></template>
<template id="pronunciation-template"><li class="pronunciation"><span class="pronunciation-tag-list tag-list"></span><span class="pronunciation-disambiguation-list"></span><span class="pronunciation-representation-list"><span class="pronunciation-text-container"></span><span class="pronunciation-downstep-notation-container"></span><span class="pronunciation-graph-container"></span></span></li></template>
<!-- Kanji entry templates -->
<template id="kanji-entry-template" data-remove-whitespace-text="true"><div class="entry" data-type="kanji">

View File

@ -51,7 +51,7 @@ class DisplayGenerator {
const headwordsContainer = node.querySelector('.headword-list');
const inflectionsContainer = node.querySelector('.inflection-list');
const pitchesContainer = node.querySelector('.pitch-accent-group-list');
const pitchesContainer = node.querySelector('.pronunciation-group-list');
const frequencyGroupListContainer = node.querySelector('.frequency-group-list');
const definitionsContainer = node.querySelector('.definition-list');
const headwordTagsContainer = node.querySelector('.headword-list-tag-list');
@ -72,8 +72,8 @@ class DisplayGenerator {
node.dataset.format = type;
node.dataset.headwordCount = `${headwords.length}`;
node.dataset.definitionCount = `${definitions.length}`;
node.dataset.pitchAccentDictionaryCount = `${pitches.length}`;
node.dataset.pitchAccentCount = `${pitchCount}`;
node.dataset.pronunciationDictionaryCount = `${pitches.length}`;
node.dataset.pronunciationCount = `${pitchCount}`;
node.dataset.uniqueTermCount = `${uniqueTerms.size}`;
node.dataset.uniqueReadingCount = `${uniqueReadings.size}`;
node.dataset.frequencyCount = `${frequencies.length}`;
@ -242,9 +242,9 @@ class DisplayGenerator {
node.dataset.frequency = DictionaryDataUtil.getTermFrequency(tags);
const {wordClasses} = headword;
const pitchAccentCategories = this._getPitchAccentCategories(reading, pronunciations, wordClasses, headwordIndex);
if (pitchAccentCategories !== null) {
node.dataset.pitchAccentCategories = pitchAccentCategories;
const pronunciationCategories = this._getPronunciationCategories(reading, pronunciations, wordClasses, headwordIndex);
if (pronunciationCategories !== null) {
node.dataset.pronunciationCategories = pronunciationCategories;
}
if (wordClasses.length > 0) {
node.dataset.wordClasses = wordClasses.join(' ');
@ -435,13 +435,13 @@ class DisplayGenerator {
_createPitches(details) {
const {dictionary, pitches} = details;
const node = this._templates.instantiate('pitch-accent-group');
const node = this._templates.instantiate('pronunciation-group');
node.dataset.dictionary = dictionary;
node.dataset.pitchesMulti = 'true';
node.dataset.pitchesCount = `${pitches.length}`;
const tag = this._createTag(this._createTagData(dictionary, 'pitch-accent-dictionary'));
node.querySelector('.pitch-accent-group-tag-list').appendChild(tag);
const tag = this._createTag(this._createTagData(dictionary, 'pronunciation-dictionary'));
node.querySelector('.pronunciation-group-tag-list').appendChild(tag);
let hasTags = false;
for (const {tags} of pitches) {
@ -451,7 +451,7 @@ class DisplayGenerator {
}
}
const n = node.querySelector('.pitch-accent-list');
const n = node.querySelector('.pronunciation-list');
n.dataset.hasTags = `${hasTags}`;
this._appendMultiple(n, this._createPitch.bind(this), pitches);
@ -463,17 +463,17 @@ class DisplayGenerator {
const {reading, position, nasalPositions, devoicePositions, tags, exclusiveTerms, exclusiveReadings} = details;
const morae = jp.getKanaMorae(reading);
const node = this._templates.instantiate('pitch-accent');
const node = this._templates.instantiate('pronunciation');
node.dataset.pitchAccentPosition = `${position}`;
node.dataset.pitchAccentDownstepPosition = `${position}`;
if (nasalPositions.length > 0) { node.dataset.nasalMoraPosition = nasalPositions.join(' '); }
if (devoicePositions.length > 0) { node.dataset.devoiceMoraPosition = devoicePositions.join(' '); }
node.dataset.tagCount = `${tags.length}`;
let n = node.querySelector('.pitch-accent-tag-list');
let n = node.querySelector('.pronunciation-tag-list');
this._appendMultiple(n, this._createTag.bind(this), tags);
n = node.querySelector('.pitch-accent-disambiguation-list');
n = node.querySelector('.pronunciation-disambiguation-list');
this._createPitchAccentDisambiguations(n, exclusiveTerms, exclusiveReadings);
n = node.querySelector('.pronunciation-downstep-notation-container');
@ -489,7 +489,7 @@ class DisplayGenerator {
}
_createPitchAccentDisambiguations(container, exclusiveTerms, exclusiveReadings) {
const templateName = 'pitch-accent-disambiguation';
const templateName = 'pronunciation-disambiguation';
for (const term of exclusiveTerms) {
const node = this._templates.instantiate(templateName);
node.dataset.type = 'term';
@ -668,7 +668,7 @@ class DisplayGenerator {
}
}
_getPitchAccentCategories(reading, pronunciations, wordClasses, headwordIndex) {
_getPronunciationCategories(reading, pronunciations, wordClasses, headwordIndex) {
if (pronunciations.length === 0) { return null; }
const isVerbOrAdjective = DictionaryDataUtil.isNonNounVerbOrAdjective(wordClasses);
const categories = new Set();

View File

@ -838,9 +838,9 @@ class Display extends EventDispatcher {
data.frequencyDisplayMode = `${options.general.frequencyDisplayMode}`;
data.termDisplayMode = `${options.general.termDisplayMode}`;
data.enableSearchTags = `${options.scanning.enableSearchTags}`;
data.showPitchAccentDownstepNotation = `${options.general.showPitchAccentDownstepNotation}`;
data.showPitchAccentPositionNotation = `${options.general.showPitchAccentPositionNotation}`;
data.showPitchAccentGraph = `${options.general.showPitchAccentGraph}`;
data.showPronunciationText = `${options.general.showPitchAccentDownstepNotation}`;
data.showPronunciationDownstepPosition = `${options.general.showPitchAccentPositionNotation}`;
data.showPronunciationGraph = `${options.general.showPitchAccentGraph}`;
data.debug = `${options.general.debugInfo}`;
data.popupDisplayMode = `${options.general.popupDisplayMode}`;
data.popupCurrentIndicatorMode = `${options.general.popupCurrentIndicatorMode}`;