Files
mono/mcs/diff.html.in
Alexander Köplinger d8531c5b86 [csproj] Fix diff rendering when XML comments appear in the diff (#8642)
The renderer would stop at the first XML comment `-->` which means
the diff was cut off.

We can fix this by switching from storing the diff in an HTML div to
a script tag instead.

Fixes https://github.com/mono/mono/issues/8469
2018-05-09 20:38:38 +02:00

56 lines
2.3 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>@title@</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/github.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/diff2html/2.3.0/diff2html.min.css">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Open+Sans' />
</head>
<body style="font-family: 'Open Sans'">
<h1>@title@</h1>
<p>@description@</p>
<p>Download <a id="patchdownload" href="#">changes.patch</a> which can be applied with <code>git apply changes.patch</code>.</p>
<script type="text/javascript" id="diffsource">/*<![CDATA[
@diffdata@
]]>*/
</script>
<div id="diff">Loading ...</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/languages/cs.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/diff2html/2.3.0/diff2html.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/diff2html/2.3.0/diff2html-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script>
<script>
$(document).ready(function() {
var diffText = $("#diffsource")[0].childNodes[0].nodeValue;
$("#diffsource").remove();
diffText = diffText.substring(12, diffText.length - 10);
if (diffText.length == 0) {
$("#diff").text("No changes found.");
return;
}
$("#patchdownload").click(function() {
var blob = new Blob([diffText], { type: "text/plain;charset=utf-8;" });
saveAs(blob, "changes.patch", true);
});
var diff2htmlUi = new Diff2HtmlUI({diff: diffText});
diff2htmlUi.draw('#diff', {showFiles: true, matching: 'none'});
setTimeout(function() {
diff2htmlUi.highlightCode('#diff');
}, 100);
});
</script>
</body>
</html>