On 3/5/25 02:27, Bruce Horrocks wrote:
>> On 5 Mar 2025, at 01:21, Bruce Horrocks <n...@scorecrow.com> wrote:
>> [...]
>> I'm not aware of anything built-in.
>>
>> One way would be to use buffers: you enter your text into two
>> buffers ("left" & "right"); compare them using a script which then
>> modifies the buffers to  highlight the changes in red or green;
>> and then \getbuffer the buffers from inside the columnset commands
>> to print them.

Many thanks for your reply, Bruce.

I think this might be a a feasible approach for me.

>> There's a good discussion of comparison algorithms at the link
>> below, including source code in Javascript (but not Lua, unfortunately).

There might be a Lua version (I think) here:
https://github.com/google/diff-match-patch.

>> However, Context supports Javascript with \startJScode ... \stopJScode
>> so you could try adapting what's there.
>>
>> <https://neil.fraser.name/writing/diff/>>
> Sorry - ignore the JS bit (that's for embedding into the PDF).
> You'll need to translate Fraser's example code into Lua.

We have https://www.pragma-ade.com/general/manuals/ecmascript-mkiv.pdf,
so translating JS to Lua might not be required.

Many thanks for your help,

Pablo


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to