I have been playing with the sticky macro of stobot and ToDo macro of JanJo to create a cloze macro based on a similar concept. It is little more complicated than those two. So I need someone to help me out (I had posted regarding this before also, but that thread didn’t get much response. Must be because I was unable to convey clearly what I was trying to do. Hope someone can help me this time. I have tried to make the concept more clearer this time).
Here is what I am trying to do.
Based on the sticky
<<sticky "" >> macro and ToDo
<<ToDo "" "" "" >> macro, I am making a cloze macro (Clozes are a type of flashcards used for learning purpose). I wrap some portions of the tiddler text in the cloze macro and using some CSS, I am keeping this wrapped text hidden (although there will be a red underline which act as a marker for the clozes). Also this hidden text gets revealed while hovering over it. This is the concept of clozes I am trying. This much I can do without much fuss by just swapping the names in the code for sticky or ToDo macro.
This is how it looks in edit mode.
This is how it looks in view mode.
Now coming to the complicated part. I want to add answer buttons for these clozes. Answer buttons I am taking directly from anwiki - see this example question and answer from anwiki and this is the code for those answer buttons from anwiki. This include some complex calculations which I don’t understand fully, so I am using it without any modifications.
On clicking the clozes in viewmode, a modal appears (like in JanJo’s ToDo) which show these answer buttons (easy, good, hard, again).
In Anwiki the answer response is stored in tiddler fields of the question answer tiddler- see the fields of this example tiddler. But in cloze macro I am trying to save these as dynamic parameters of the cloze macro whose values change with the type of answer response.
quality, ef, repetiton, due are the macro parameters used and are again taken from anwiki - see this macro.
My concept is more based on JanJo’s ToDo more than stobot’s sticky macro since mine involves more macro parameters.
Now coming to the roadblocks I am encountering.
I am able to apply the cloze macro to selected text (I use context menu plug in for easily applying the macro in view mode). Then I try to answer them by clicking on the answer buttons in the modal (modal is invoked by clicking on the hidden text). The dynamic parameters will get first stored in the fields of a temporary tiddler called
$:/temp/clozeinfos when an answer button is clicked- which works. The problem I am facing is that although the values for dynamic parameters are getting saved in the fields of a temporary tiddler called
$:/temp/clozeinfos , they are not getting saved in as macro parameters in the cloze macro wrapped around each text.
This macro uses search-replace operator. The input or output for the search-replace operator is also supposed to be saved in the fields of the
$:/temp/clozeinfos I guess (I am not sure though), but this is not happening. Also the search and replace function is not happening in the cloze macro.
Can someone help me out. I have been working on this for the last one week , but couldn’t find a solution. I am almost exhausted.
@EricShulman When I saw the development thread of sticky macro by stobot, I fiound that it was you who gave him the suggestion to use the search replace operator. Can you check what is going wrong ? This is the demo I made. Most of the code related to this macro is in these two tiddlers - macro and modal.
This the temp tiddler which stores the parameter values and this is an example cloze
The relevant code in the cloze macro tiddler lies in the bottom half of that tiddler.