html - 如何显示修订历史记录,如修订

标签 html diff revision

Stack Overflow 如何以他们使用的 diff-like 格式显示修订更改?

我不关心 Stack Overflow 本身;这只是描述我的要求的一种方便方式。我有一个文本字段更改的审计历史。我想以与 Stack Overflow 显示修订历史更改相同的方式显示更改。我记得 Jeff Atwood 曾在 Stack Overflow 播客中讨论过它,但我在文字记录中找不到它,也不知道是什么播客。 IIRC,它不是基于 .NET 的,也许是 Python?

这是供最终用户使用的,所以任何看起来像 Unix-like diff 的东西都被淘汰了。显示新旧两个 block 和文本并让他们弄明白是很诱人的,但 Stack Overflow 修订历史记录要好得多。

最佳答案

Python difflib标准库提供了这种能力:

This module provides classes and functions for comparing sequences. It can be used for example, for comparing files, and can produce difference information in various formats, including HTML and context and unified diffs. For comparing directories and files, see also, the filecmp module.

关于html - 如何显示修订历史记录,如修订,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/923398/

相关文章:

javascript - 如何根据类型将 Array 分成两部分 - Angular JS

html - 使用 CSS 定位和溢出

mercurial - 在 hg diff 中选择修改

linux - 确定安装在 RedHat Linux 机器上的非操作系统包列表

regex - Meld 和 Perforce 中的空白差异异常(可能是其他)

mysql - 行级修订查询 MySQL

SVN 导出与修订历史问题

javascript - Bootstrap 导航栏折叠在单击时保持打开状态

git - 转到特定修订

html - 中间带有 Logo 的中心导航栏