This commit is contained in:
恍兮惚兮 2024-05-16 14:14:44 +08:00
parent 52f12422b0
commit 8a4b868099
3 changed files with 23 additions and 7 deletions

View File

@ -193,7 +193,7 @@ class AnkiWindow(QWidget):
example = self.example.toPlainText() example = self.example.toPlainText()
ruby = self.ruby ruby = self.ruby
fields = { fields = {
"word": word, "word": json.dumps(word),
"rubytext": ruby, "rubytext": ruby,
"explain": explain, "explain": explain,
"example_sentence": example, "example_sentence": example,

View File

@ -8,11 +8,19 @@
<script> <script>
ruby = {{ rubytext }} ruby = {{ rubytext }}
word = {{ word }}
html = '' html = ''
for (i = 0; i < ruby.length; i++) { if (ruby.length) {
html += ruby[i]['orig'] + '<rt>' + ruby[i]['hira'] + '</rt>'; for (i = 0; i < ruby.length; i++) {
html += ruby[i]['orig'] + '<rt>' + ruby[i]['hira'] + '</rt>';
}
html = '<ruby>' + html + '</ruby>'
} }
document.getElementById('rubyword').innerHTML = '<ruby>' + html + '</ruby>' else {
html = word
}
document.getElementById('rubyword').innerHTML = html
</script> </script>

View File

@ -8,11 +8,19 @@
<script> <script>
ruby = {{ rubytext }} ruby = {{ rubytext }}
word = {{ word }}
html = '' html = ''
for (i = 0; i < ruby.length; i++) { if (ruby.length) {
html += ruby[i]['orig'] + '<rt>' + ruby[i]['hira'] + '</rt>'; for (i = 0; i < ruby.length; i++) {
html += ruby[i]['orig'] + '<rt>' + ruby[i]['hira'] + '</rt>';
}
html = '<ruby>' + html + '</ruby>'
} }
document.getElementById('rubyword').innerHTML = '<ruby>' + html + '</ruby>' else {
html = word
}
document.getElementById('rubyword').innerHTML = html
</script> </script>