Skip to content

Commit

Permalink
Fix reader.js spacing and word record display should show "new word"
Browse files Browse the repository at this point in the history
  • Loading branch information
1over137 committed Mar 23, 2024
1 parent d31033e commit ec3f45d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions vocabsieve/reader/static/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,9 @@ App.prototype.doWordObjects = function () {
let pre_punctuation = v.match(/^[^\p{L}\-']+/u) || [""];
let post_punctuation = v.match(/[^\p{L}\-']+$/u) || [""];
v = v.replace(/[^\p{L}\-']+/gu, ''); // remove punctuations
return " " + pre_punctuation[0] + '<span class="word">' + v.trim() + '</span>' + post_punctuation[0] + " ";
return pre_punctuation[0] + '<span class="word">' + v.trim() + '</span>' + post_punctuation[0];
});
paragraph.innerHTML = words.join('');
paragraph.innerHTML = words.join(' ');
});
};

Expand Down
22 changes: 13 additions & 9 deletions vocabsieve/ui/word_record_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ def __init__(self):
)

def setWordRecord(self, wr: WordRecord, waw: WordActionWeights, threshold: int, modifier: float):
self.setText(
f"{compute_word_score(wr, waw)}/{modifier_threshold_display(modifier, threshold)} "
f"({pretty_symbol_display('S', wr.n_seen)}"
f"{pretty_symbol_display('L', wr.n_lookups)}"
f"{pretty_symbol_display('T', wr.anki_mature_tgt)}"
f"{pretty_symbol_display('C', wr.anki_mature_ctx)}"
f"{pretty_symbol_display('t', wr.anki_young_tgt)}"
f"{pretty_symbol_display('c', wr.anki_young_ctx)}".strip() + ")"
)
score = compute_word_score(wr, waw)
if (score > 0):
self.setText(
f"{score}/{modifier_threshold_display(modifier, threshold)} "
f"({pretty_symbol_display('S', wr.n_seen)}"
f"{pretty_symbol_display('L', wr.n_lookups)}"
f"{pretty_symbol_display('T', wr.anki_mature_tgt)}"
f"{pretty_symbol_display('C', wr.anki_mature_ctx)}"
f"{pretty_symbol_display('t', wr.anki_young_tgt)}"
f"{pretty_symbol_display('c', wr.anki_young_ctx)}".strip() + ")"
)
else:
self.setText("new word")

0 comments on commit ec3f45d

Please sign in to comment.