forked from metacpan/metacpan-web
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiff.html
81 lines (77 loc) · 2.93 KB
/
diff.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<div class="breadcrumbs">
Diff <a href="/<% type %>/<% diff.source %>"><% diff.source.split("/").first(2).join(" / ") %></a>
/
<a href="/<% type %>/<% diff.target %>"><% diff.target.split("/").first(2).join(" / ") %></a>
</div>
<%-
insertions = 0;
deletions = 0;
files = 0;
FOREACH file IN diff.statistics;
files += 1;
insertions += file.insertions;
deletions += file.deletions;
parts = file.target.split("/");
IF file.target == '/dev/null';
parts = file.source.split("/");
END;
FOREACH i IN [1,2,3]; foo = parts.shift; END;
file.path = parts.join("/"); END -%>
<ul class="nav-list slidepanel">
<li class="visible-xs">
<% INCLUDE mobile/toolbar-search-form.html %>
</li>
<li class="nav-header">Tools</li>
<%- IF diff.source.split("/").size != 2 %>
<li>
<a href="?source=<% diff.source.split("/").first(2).join("/") %>&target=<% diff.target.split("/").first(2).join("/") %>">
Diff full distribution
</a>
</li>
<% END %>
<li>
<a href="?target=<% diff.source %>&source=<% diff.target %>">
Reverse diff
</a>
</li>
<li>
<%- IF type == 'source' %>
<a href="<% api_external_secure %>/diff/file/<% diff.source.digest %>/<% diff.target.digest %>?content-type=text/plain">
<%- ELSE %>
<a href="<% api_external_secure %>/diff/release/<% diff.source %>/<% diff.target %>?content-type=text/plain">
<%- END %>
Raw diff
</a>
</li>
<%- IF diff.statistics.size > 1 -%>
<li>
<select onchange="document.location.href='#' + this.value; this.selectedIndex = 0">
<option>Jump to file</option>
<% FOREACH file IN diff.statistics -%>
<option value="<% file.path %>"><% file.path %></option>
<% END -%>
</select>
</li>
<%- END -%>
<li class="nav-header">Info</li>
<li><% insertions %> insertion<% IF insertions > 1 %>s<% END %></li>
<li><% deletions %> deletion<% IF deletions > 1 %>s<% END %></li>
<li><div><a href="#">Top</a><div></li>
</ul>
<div class="content">
<ul class="diff-ul">
<% FOREACH file IN diff.statistics %>
<li><a href="#<% file.path %>"><% file.path %></a><span class="minus"><% file.deletions %></span><span class="plus"><% file.insertions %></span></li>
<% END %>
<li> <% files %> file<% IF files > 1 %>s<% END %> changed <% IF type == 'source' %> (This is a file diff) <% ELSE %> (This is a version diff) <% END %><span class="minus"><% deletions %></span><span class="plus"><% insertions %></span>
</ul>
<% FOREACH file IN diff.statistics %>
<a name="<% file.path %>"></a>
<div class="diff-container">
<div class="diff-header">
<a href="/source/<% diff.target %>/<% file.path %>"><% file.path %></a>
</div>
<pre><code class="language-diff"><% parts = file.diff.split("\n"); WHILE parts; line = parts.shift; LAST IF line.match( '^\+' ); END; parts.join("\n") %></code></pre>
</div>
<% END %>
</div>