我曾经编写过这个愚蠢的脚本来将文件diff报告转换为颜色不同的HTML。问题是,我不记得它应该读取哪个diff文件语法。脚本似乎期待一些以Only in、diff、+++等开头的行。
我已经没有BeyondCompare了,所以不能进行测试,我也找不到样本差异报告。
问题:是否需要一份BeyondCompare文本差异报告?
用法:echo some_diff_file | this_script > HTML_file
# The -r option keeps the backslash from being an escape char.
read -r s
while [[ $? -eq 0 ]]
do
# Get beginning of line to determine what type
# of diff line it is.
t1=${s:0:1}
t2=${s:0:2}
t3=${s:0:3}
t4=${s:0:4}
t7=${s:0:7}
# Determine HTML class to use.
if [[ "$t7" == 'Only in' ]]; then
...
elif [[ "$t4" == 'diff' ]]; then
...
elif [[ "$t3" == '+++' ]]; then
...
elif [[ "$t3" == '---' ]]; then
...
elif [[ "$t2" == '@@' ]]; then
...
elif [[ "$t1" == '+' ]]; then
...
elif [[ "$t1" == '-' ]]; then
...
else
...
fi
done发布于 2022-02-15 15:05:25
这看起来不像是Compare的报表语法。
除了比较,4.4.1 (当前版本)在纯文本报告中不使用“只在”。
如果您想要生成测试报告,那么在需要许可证之前,作为一个完整的功能测试运行30天。在“超越比较”的文本比较中,选择“会话”>“文本比较报告”以生成报表。
除了比较之外,报告可以输出到HTML和纯文本。没有必要将其输出到纯文本,然后在“无法比较”之外转换为HTML。
示例文本比较报告来自Beyond Compare 4.4.1,输出为纯文本,并排选择为报表布局:
Text Compare
Produced: 2/15/2022 9:05:03 AM
Mode: All
Left file: C:\work\1.txt Right file: C:\work\2.txt
left orphan +-
---------------------------------------
same = same
---------------------------------------
line with an edit <> line with a change
right orphan
---------------------------------------支持纯文本报表布局:并排、汇总、交织、修补、统计、XML转储。
https://stackoverflow.com/questions/71110264
复制相似问题