基于段落的差异程序?
有谁知道可以进行基于段落的差异的差异查看器或比较程序?我的存储库有大量 LaTeX 文件,这些文件被格式化为 80 个字符宽的段落(以便使用 vim 轻松编辑)。目前很难解释不同版本之间的差异,因为任何导致换行符位置改变的编辑都会导致差异中出现大量虚假差异。
Does anyone know of a diff viewer or comparison program that can do paragraph-based differentials? My repos has a large number of LaTeX files that are formatted into 80-character wide paragraphs (for easy editing with vim). It's currently very difficult to interpret the diffs between various versions, because any edit that caused the position of the line breaks to change results in a lot of spurious differences that show up in the diff.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您需要
wdiff
。尽管我赞成在每句话末尾打破界限。它不仅使源代码控制变得更容易,也使共同作者变得更容易。
You want
wdiff
.Although I endorse breaking the line at the end of each sentence. Not only does it make it easier with source-code control, it makes it easier with co-authors as well.
我使用 latexdiff ,它对于较小的编辑非常有效,如果你有重大变化。
I use latexdiff which works extremely well for minor edits, not so good if you have major changes.
我总是发现在句子末尾手动换行更容易。这使得编辑工作变得更加容易,因为如果您打印了 pdf 输出的版本并在其上书写,您只需扫描页面的左侧即可找到要更改的句子的开头。
这也意味着任何差分程序都不会给出大量虚假差异。
I've always found it easier to manually line break at the end of sentences. This makes editing things easier, since if you've printed out a version of the pdf output and written on that, you can just scan the left hand side of the page for the start of the sentence you want to change.
This would also mean that any differential program would not give a ton of spurious diffs.
如果您不介意在比较之前重新格式化,则可以将每个段落重新格式化为一个很长的行,然后使用显示行内差异的比较工具(除了行差异之外,在您的情况下,行差异代表段落差异)。
或者,通过更巧妙的重新格式化,您可以重新格式化每个段落,使每行一个句子。
If you don't mind reformatting before diffing, you could reformat each paragraph into one very long line, and then use a diff tool that shows intra-line differences (in addition to line differences, which in your case would represent paragraph differences).
Alternately, with more clever reformatting, you could reformat each paragraph such that there is one sentence per line.