syntax-highlighting icon indicating copy to clipboard operation
syntax-highlighting copied to clipboard

Multiline cloze deletions not detected by Anki

Open salty5436 opened this issue 6 years ago • 1 comments

Prerequisite checklist

  • [Yes] In case of a bug: Have you tried restarting Anki?
  • [Yes] Are you running the latest version of the add-on. Have you redownloaded the add-on from AnkiWeb to make sure?
  • [Yes] Did you check the add-on documentation (e.g. AnkiWeb description, Wiki if it exists) for known issues?
  • [Yes] Did you perform a cursory search through the existing issue reports?

What is the problem/feature you would like to see fixed/implemented?

Cloze deletions do not work when selecting multiple lines of code - Anki reports that I have not made any cloze deletions.

How can we reproduce the problem?

  1. In a cloze note type paste: test test test
  2. Select all and use the lightning bolt to convert to code
  3. Select two or three lines and add a cloze deletion
  4. Try to add the note

Expected behavior: [What you expected to happen]

Note adds successfully with the desired cloze in place.

Actual behavior: [What actually happened]

Anki warns that no cloze was made.

Reproducible?: [Can you reliably reproduce the issue by following the steps above?]

Yes.

Possible Cause

The problem may be related to the line breaks between the cloze tags. The above steps lead to this html, taken from the html editor:

<div><center style="text-align: -webkit-auto;">{{c1::<table><tbody><tr><td><div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>test
test
test
</pre></div>
</td></tr></tbody></table>}}</center><br /></div>

I used the html editor to remove the line breaks after each 'test' and placed a <br /> tag between them. I also removed the line break after the second to last </div>:

<div><center style="text-align: -webkit-auto;">{{c1::<table><tbody><tr><td><div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>test<br />test<br />test</pre></div></td></tr></tbody></table>}}</center><br /></div>

The cloze then successfully added.

Version information

Anki

[Please head to HelpAbout Anki and Paste the version string here, e.g.:]

Version 2.0.51 Qt 4.8.4 PyQt 4.10

System

  • Operating system: Windows
  • Version: 7

salty5436 avatar Mar 13 '19 13:03 salty5436

This is not about the add-on syntax highlighting. This is a bug of Anki 2.0 which can't be reproduced in 2.1.13. I think this was fixed in 2018-06 (related discussion). The solution should be updating to 2.1.

ijgnd avatar Jun 02 '19 08:06 ijgnd