diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-01-09 21:25:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-09 21:25:04 -0500 |
commit | da1e1e5c5b4dc20cc6aa46b51c55a496d094ed5c (patch) | |
tree | 63d60b93b85b063ff8c42d113083d3b732bb19f5 /ext/bg | |
parent | d698911bc9bf7cb431bce939412131a90f24ee45 (diff) |
Sentence parsing options (#1214)
* Rename options.anki.sentenceExt to options.sentenceParsing.scanExtent
* Create sentence parsing icon
* Create new sentence parsing section
Diffstat (limited to 'ext/bg')
-rw-r--r-- | ext/bg/data/options-schema.json | 22 | ||||
-rw-r--r-- | ext/bg/js/options.js | 5 | ||||
-rw-r--r-- | ext/bg/settings.html | 2 | ||||
-rw-r--r-- | ext/bg/settings2.html | 66 |
4 files changed, 64 insertions, 31 deletions
diff --git a/ext/bg/data/options-schema.json b/ext/bg/data/options-schema.json index 12c4097d..9053ebb1 100644 --- a/ext/bg/data/options-schema.json +++ b/ext/bg/data/options-schema.json @@ -68,7 +68,8 @@ "translation", "dictionaries", "parsing", - "anki" + "anki", + "sentenceParsing" ], "properties": { "general": { @@ -732,7 +733,6 @@ "enable", "server", "tags", - "sentenceExt", "screenshot", "terms", "kanji", @@ -758,11 +758,6 @@ "yomichan" ] }, - "sentenceExt": { - "type": "integer", - "minimum": 0, - "default": 200 - }, "screenshot": { "type": "object", "required": [ @@ -847,6 +842,19 @@ "default": null } } + }, + "sentenceParsing": { + "type": "object", + "required": [ + "scanExtent" + ], + "properties": { + "scanExtent": { + "type": "integer", + "minimum": 0, + "default": 200 + } + } } } } diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index adf3cfd4..441d56ec 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -683,11 +683,16 @@ class OptionsUtil { _updateVersion8(options) { // Version 8 changes: // Added translation.textReplacements. + // Moved anki.sentenceExt to sentenceParsing.scanExtent. for (const profile of options.profiles) { profile.options.translation.textReplacements = { searchOriginal: true, groups: [] }; + profile.options.sentenceParsing = { + scanExtent: profile.options.anki.sentenceExt + }; + delete profile.options.anki.sentenceExt; } return options; } diff --git a/ext/bg/settings.html b/ext/bg/settings.html index ec048a3b..d206d697 100644 --- a/ext/bg/settings.html +++ b/ext/bg/settings.html @@ -960,7 +960,7 @@ <div class="form-group options-advanced"> <label for="sentence-detection-extent">Sentence detection extent <span class="label-light">(in characters)</span></label> - <input type="number" min="1" step="1" id="sentence-detection-extent" class="form-control" data-setting="anki.sentenceExt"> + <input type="number" min="0" step="1" id="sentence-detection-extent" class="form-control" data-setting="sentenceParsing.scanExtent"> </div> <div class="form-group options-advanced"> diff --git a/ext/bg/settings2.html b/ext/bg/settings2.html index b74c4ec1..e5f105f0 100644 --- a/ext/bg/settings2.html +++ b/ext/bg/settings2.html @@ -31,6 +31,7 @@ <a href="#!window" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="window"></span></span><span class="outline-item-label">Window</span></a> <a href="#!audio" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="speaker"></span></span><span class="outline-item-label">Audio</span></a> <a href="#!text-parsing" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="text-parsing"></span></span><span class="outline-item-label">Text Parsing</span></a> + <a href="#!sentence-parsing" class="outline-item advanced-only"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="sentence-parsing"></span></span><span class="outline-item-label">Sentence Parsing</span></a> <a href="#!translation" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="translation"></span></span><span class="outline-item-label">Translation</span></a> <a href="#!anki" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="note-card"></span></span><span class="outline-item-label">Anki</span></a> <a href="#!shortcuts" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="keyboard"></span></span><span class="outline-item-label">Shortcuts</span></a> @@ -1107,6 +1108,48 @@ </div></div> </div> + <!-- Text Parsing --> + <div class="advanced-only"> + <div class="heading-container"> + <div class="heading-container-icon"><span class="icon" data-icon="sentence-parsing"></span></div> + <div class="heading-container-left"><h2 id="sentence-parsing"><a href="#!sentence-parsing">Sentence Parsing</a></h2></div> + <div class="heading-container-right"><a class="more-toggle more-only heading-link-light" data-parent-distance="3">Info…</a></div> + </div> + <div class="heading-description more" hidden> + <p> + Yomichan can will scan and parse sentences which can be used as contextual information for Anki cards. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-group advanced-only"> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Sentence scanning extent + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <input type="number" data-setting="sentenceParsing.scanExtent" min="0" step="1"> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + This option controls the maximum scanning distance used to determine the bounds of a sentence, + in number of characters. + Sentence scanning is bidirectional and begins from both the start and end of the source term. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + </div> + <!-- Translation --> <div> <div class="heading-container"> @@ -1389,29 +1432,6 @@ </div> </div> </div></div> - <div class="settings-item advanced-only"> - <div class="settings-item-inner settings-item-inner-wrappable"> - <div class="settings-item-left"> - <div class="settings-item-label"> - Sentence scanning extent - <a class="more-toggle more-only" data-parent-distance="4">(?)</a> - </div> - </div> - <div class="settings-item-right"> - <input type="number" data-setting="anki.sentenceExt" min="1" step="1"> - </div> - </div> - <div class="settings-item-children more" hidden> - <p> - This option controls the maximum scanning distance used to determine the bounds of a sentence, - in number of characters. - Sentence scanning is bidirectional and begins from both the start and end of the source term. - </p> - <p> - <a class="more-toggle" data-parent-distance="3">Less…</a> - </p> - </div> - </div> <div class="settings-item settings-item-button" data-modal-action="show,anki-cards"><div class="settings-item-inner"> <div class="settings-item-left"> <div class="settings-item-label">Configure Anki card format…</div> |