I have LibreOffice Writer files under git control. I've previously used .odt
format and used odt2txt
to get readable diffs, by including
[diff "odt"]
textconv = odt2txt
in my git config
file. I'm trying to use the XML-text .fodt
format instead, since the text .fodt
format is more amenable to git than the binary .odt
format.
The problem is that the git diffs are overwhelmingly of the XML tags, obscuring the actual text changed in the Writer files. It was actually much easier to see the diffs using odt
and odt2txt
than to use fodt
.
Is there any program that will strip out all the XML tags, outputting only bare text (similar to what odt2txt
outputs from an odt
file), so that I can see in my diffs the actual text that was changed?
I am under Windows, but I use Cygwin to have access to a lot of Linux tools, including odt2txt
. However, please note that the Linux-based suggestions such as specifying
textconv = sh -c 'odt2txt --raw-input "$0"'
do not work under Windows, even with Cygwin installed. Git under Windows appears to requires a single command, without operands, as the filter.
(This is somewhat aggravated by the fact that I usually use SourceTree for my routine git usage, including looking at diffs, and SourceTree does not line-wrap its diffs, despite having an enhancement request open for a number of years; but even in native git it's an issue.)
I ended up hacking together my own fodt2txt
driver. It's not perfect, but gets most of what I needed done.