title: $:/core/macros/diff
tags: $:/tags/Macro $:/tags/Global

\whitespace trim

\procedure compareTiddlerText(sourceTiddlerTitle,sourceSubTiddlerTitle,destTiddlerTitle,destSubTiddlerTitle)
<$set name="source" tiddler=<<sourceTiddlerTitle>> subtiddler=<<sourceSubTiddlerTitle>>>
	<$set name="dest" tiddler=<<destTiddlerTitle>> subtiddler=<<destSubTiddlerTitle>>>
		<$diff-text source=<<source>> dest=<<dest>>/>
	</$set>
</$set>
\end

\procedure compareTiddlers(sourceTiddlerTitle,sourceSubTiddlerTitle,destTiddlerTitle,destSubTiddlerTitle,exclude)
<table class="tc-diff-tiddlers">
	<tbody>
		<$set name="sourceFields" filter="[<sourceTiddlerTitle>fields[]sort[]]">
			<$set name="destFields" filter="[<destSubTiddlerTitle>subtiddlerfields<destTiddlerTitle>sort[]]">
			<$list filter="[enlist<sourceFields>] [enlist<destFields>] -[enlist<exclude>] +[sort[]]" variable="fieldName">
				<tr>
					<th>
						<$text text=<<fieldName>>/>
					</th>
					<td>
						<$set name="source" tiddler=<<sourceTiddlerTitle>> subtiddler=<<sourceSubTiddlerTitle>> field=<<fieldName>>>
							<$set name="dest" tiddler=<<destTiddlerTitle>> subtiddler=<<destSubTiddlerTitle>> field=<<fieldName>>>
								<$diff-text source=<<source>> dest=<<dest>>>&#32;</$diff-text>
							</$set>
						</$set>
					</td>
				</tr>
			</$list>
			</$set>
		</$set>
	</tbody>
</table>
\end
