created: 20200510004110231
modified: 20200925141800000
tags: $:/tags/Macro
title: $:/plugins/sobjornstad/TiddlyRemember/macros/remember
type: text/vnd.tiddlywiki

\define remembertwo(id, reference, sched)
	<div class="tr-selfidentification">
		<$set name="selfid" filter="""[enlist[$reference$]]""" value="""[<$link to="$reference$">$reference$</$link>: $id$]""" emptyValue="[$id$]">
			<<selfid>>
		</$set>
	</div>
	<div class="rid">
		[$id$]
	</div>
	<div class="tr-reference">
		<$text text=<<__reference__>>/>
	</div>
	<div class="tr-sched">
		<$text text=<<__sched__>>/>
	</div>
\end

\define rememberq(id, question, answer, reference: "", sched: "", class:"")
    <div class={{{ [[rememberq remembertwo ]addsuffix<__class__>addsuffix[ ]addsuffix{$:/config/TiddlyRemember/DefaultClasses}] }}}>
        <div class="rquestion tr-ritem">
            <div>Q:</div>
            <p>$question$</p>
        </div>
        <div class="ranswer tr-ritem">
            <div>A:</div>
            <p>$answer$</p>
        </div>
		<$macrocall $name=remembertwo id=<<__id__>> reference=<<__reference__>> sched=<<__sched__>>/>
    </div>
\end

\define rememberp(id, first, second, reference: "", sched: "", class: "")
    <div class={{{ [[rememberp remembertwo ]addsuffix<__class__>addsuffix[ ]addsuffix{$:/config/TiddlyRemember/DefaultClasses}] }}}>
        <div class="rfirst tr-ritem">
            <div>1:</div>
            <p>$first$</p>
        </div>
        <div class="rsecond tr-ritem">
            <div>2:</div>
            <p>$second$</p>
        </div>
		<$macrocall $name=remembertwo id=<<__id__>> reference=<<__reference__>> sched=<<__sched__>>/>
    </div>
\end

\define remembercz(id, text, mode: "block", reference: "", sched: "", class: "")
	<$list filter="[[$mode$]match[inline]]" variable=_>
		<$macrocall $name=twRememberClozeInline id=<<__id__>> text=<<__text__>> reference=<<__reference__>> sched=<<__sched__>> class=<<__class__>>/>
	</$list>
	<$list filter="[[$mode$]!match[inline]]" variable=_>
		<$macrocall $name=twRememberClozeBlock id=<<__id__>> text=<<__text__>> reference=<<__reference__>> sched=<<__sched__>> class=<<__class__>>/>
	</$list>
\end

\define twRememberMetadata(id, reference, sched)
	<div class="tr-selfidentification">
		<$set name="selfid" filter="""[enlist[$reference$]]""" value="""[<$link to="$reference$">$reference$</$link>: $id$]""" emptyValue="[$id$]">
			<<selfid>>
		</$set>
	</div>
	<div class="rid">
		[$id$]
	</div>
	<div class="tr-reference">
		<$text text=<<__reference__>>/>
	</div>
	<div class="tr-sched">
		<$text text=<<__sched__>>/>
	</div>
\end

\define twRememberClozeBlock(id, text, reference, sched, class)
    <div class={{{ [[remembercz ]addsuffix<__class__>addsuffix[ ]addsuffix{$:/config/TiddlyRemember/DefaultClasses}] }}}>
		<span class="cloze-identifier"><span class="tr-name-cloze">cloze: </span></span>
		<span class="cloze-display"><$set name="unescape" value={{{ [<__text__>search-replace:g[\{],[{]search-replace:g[\}],[}]] }}}><<unescape>></$set></span>
		<span class="cloze-text">$text$</span>
		<$macrocall $name="twRememberMetadata" id=<<__id__>> reference=<<__reference__>> sched=<<__sched__>>/>
	</div>
\end

\define twRememberClozeInline(id, text, reference, sched, class)
    <span class={{{ [[remembercz ]addsuffix<__class__>addsuffix[ ]addsuffix{$:/config/TiddlyRemember/DefaultClasses}] }}}>
		<span class="cloze-identifier">{<span class="tr-name-cloze">cloze: </span></span>
		<span class="cloze-display"><$set name="unescape" value={{{ [<__text__>search-replace:g[\{],[{]search-replace:g[\}],[}]] }}}><<unescape>></$set></span>
		<span class="cloze-identifier">}</span>
		<span class="cloze-text">$text$</span>
		<$macrocall $name="twRememberMetadata" id=<<__id__>> reference=<<__reference__>> sched=<<__sched__>>/>
	</span>
\end