如何将 Gitweb 默认 diff 格式更改为 `--color-words`?
我希望 gitweb 输出与 git diff --color-words 相同的 diff 格式。有人知道我该怎么做吗?我查看了 HTML::FromANSI 但无法从命令行使用 git diff --color-words 。
I want gitweb to output the same diff format as git diff --color-words
. Does anybody know how I can do this? I looked at HTML::FromANSI but couldn't get it working with git diff --color-words
from the command line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您如何使用 HTML::FromANSI?因为它对我有用,所以使用以下命令按预期工作
尽管如果您想要可用的输出,而不是黑色背景上几乎看不见的白色文本,您可能需要配置 HTML::FromANSI。上面的脚本只是概念验证代码(不是最佳风格)。
顺便说一句,我不确定 HTML::FromANSI 模块的质量;它没有强制为我安装(使用
cpan
)(但这可能是该模块需要的 Term::VT102::Boundless 的问题)。ansi2html
子例程在某些行上存在问题(我认为带有嵌入/尾随行尾字符的行和空行/字符串),产生Use of uninitialized value in concatenation (.) 或字符串位于 .../HTML/FromANSI.pm 第 353 行,NN 行。
警告。这就是为什么我必须chomp
行(这可能是您在使 HTML::FromANSI 工作时遇到的问题)。此外,该模块生成的 HTML 非常可怕,使用过时且已弃用的
标记以及现代的
< span style='...'>
标签;我也没有看到使用 CSS 代替内联样式的选项。How did you use HTML::FromANSI? Because it works for me, using the following command worked as intended
Although if you want usable output, and not barely visible white text on black background, you would probably need to configure HTML::FromANSI. The above scriptlet is just proof of concept code (ans not in best style).
BTW I am not sure about quality of HTML::FromANSI module; it didn't install (using
cpan
) for me without force (but it might be problem with Term::VT102::Boundless this module requires).ansi2html
subroutine have problems with some lines (I think lines with embedded / trailing end-of-line character, and empty line / string), producingUse of uninitialized value in concatenation (.) or string at .../HTML/FromANSI.pm line 353, <STDIN> line NN.
warning. That's why I had tochomp
lines (and that might be the problem you had with making HTML::FromANSI work).Also the HTML produced by this module is quite horrid, using outdated and deprecated
<font face='...' style ='...'>
tag together with modern<span style='...'>
tag; also I don't see an option to use CSS instead of inline style.