More complicated overlapping clozes

First off, sorry if this has been suggested before, it’s a little hard to differentiate between this idea and the Cloze Overlapper Add-on.

Clozes are fantastic. However, they can be clunky. By default, your options are limited to nesting or simply in order and you can’t really overlap cards. The Cloze Overlapper Add-on is also very nice for hiding everything else but what you want to focus on (and a little surrounding context). But what I would really like is a clean way to select overlapping clozes.

Let’s focus on this example: “Einstein was born in 1879 in Germany.” and we want to cloze “born in 1879” and “in 1879 in Germany”. This should create the front cards

c1:: Einstein was […] in Germany.

c2:: Einstein was born […].

I think the most intuitive way to group these in the note would be something like

Einstein was [[c1::born {{c2::in 1879]] in Germany}}.

But I would need access to multiple different wrapper characters which is both limited and generally annoying. The best way I can think to do this currently is some way of breaking up each string:

Einstein was {{c1::born}} {{c2::{{c1::in 1879}}}} {{c2::in Germany}}.

c1:: Einstein was […] […] in Germany.

c2:: Einstein was born […] […].

However, this is clunky as it creates two “[…]” enclosures when it could easily be one each and identifying where to add the cloze layers gets very confusing as you add more and more clozes. It would be great if there were some system to group with the intuitive approach without too much pain.

I suggest a simple way to achieve this (at least in notation) to be (optionally) noting the cloze on the closing “}}” and adding the hint just before (or possibly after, some experimentation with which works better would be good) the noted cloze:

Einstein was {{c1::born {{c2::in 1879::birth date::c1}} in Germany::birth date and location::c2}}.

When you use the cloze keyboard shortcut, it could create the cloze as “{{c1::text::…::c1}}”. I understand that this may break some currently existing clozes that include :: in the hint but I think most of them could be avoided by restricting the parser to note the final :: as a cloze notation only if the following string is a valid cloze notation (i.e. of the form “c1” and cloze “c1” actually exists on the note). This can be further remedied by an option to place zero width spaces between any already existing, otherwise conflicting :: and beyond that, frankly, user would need to change their patterns (or maybe there is some other fancy way I’m not thinking of). Under this system, all of the following would be valid clozes:

  • {{c1::text}} ⟹ […] → text
  • {{c2::text::hint}} ⟹ [hint] → text
  • {{c3::text::c3}} ⟹ […] → text
  • {{c4::text::hint::cool}} ⟹ [hint::cool] → text
  • {{c5::text::hint::cool::c5}} ⟹ [hint::cool] → text
  • {{c6::text::hint:::}} ⟹ [hint:::] → text (first :: and text “:” is invalid; second (overlapping) :: text “” is invalid)
  • {{c7::text::hint:::c7}} ⟹ [hint:] → text (second :: text “c7” is valid)

If we were really ambitious (and a little more notation), this notation could even be used for a more simple way to note text hidden under multiple clozes by seperating the appropriate:

Functions:
{{c1::print()::c1,c2,c3}} (equivalent to {{c3::{{c2::{{c1::print()}}}}}})
{{c2::println()::c2,c3}}
{{c3::printfun()::c3}}

Functions:

[...]

println() printfun()

Functions:
[…]

[...]

printfun()

Functions:
[…]
[…]

[...]

I think this system would be extremely beneficial for all kinds of more complicated clozes while keeping in the spirit of the original cloze.

1 Like