mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-02 14:29:55 +00:00
a09106f33b
* $:/core/macros/diff use v5.3.x syntax and add indentation for better readability -- all tests pass * diff - set tags: $:/tags/Global
38 lines
1.3 KiB
Plaintext
38 lines
1.3 KiB
Plaintext
title: $:/core/macros/diff
|
|
tags: $:/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>>> </$diff-text>
|
|
</$set>
|
|
</$set>
|
|
</td>
|
|
</tr>
|
|
</$list>
|
|
</$set>
|
|
</$set>
|
|
</tbody>
|
|
</table>
|
|
\end
|