-
Notifications
You must be signed in to change notification settings - Fork 1
/
Proposal.pas
137 lines (116 loc) · 4.71 KB
/
Proposal.pas
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
namespace SwiftEvolutionSync;
type
Proposal = public class
public
constructor withFileName(aFileName: String);
begin
ID := aFileName.LastPathComponent.SplitAtFirstOccurrenceOf("-")[0];
//Name :=
Text := File.ReadText(aFileName).Trim;
var lLines := Text.Replace(#13, #10).Split(#10);
Name := lLines[0].Substring(1).Trim;
SwiftOrgLink := SWIFT_ORG_BASE_URL+aFileName.LastPathComponent;
for each l in lLines index i do begin
if i = 0 then
continue;
if l.StartsWith("##") then
break;
if l.StartsWith("* Status:") then begin
AppleStatus := l.SplitAtFirstOccurrenceOf(":")[1].Trim.Replace("*", "");
if AppleStatus.StartsWith("Implemented ") then begin
if AppleStatus.Contains("(") then
AppleImplementedIn := AppleStatus.SplitAtFirstOccurrenceOf("(")[1].Trim.SplitAtFirstOccurrenceOf(")")[0].Trim(['(', ')'])
else if AppleStatus.Contains(" in ") then
AppleImplementedIn := AppleStatus.SplitAtFirstOccurrenceOf(" in ")[1]
else
AppleImplementedIn := AppleStatus.SplitAtFirstOccurrenceOf(" ")[1];
AppleImplementedIn := AppleImplementedIn.Replace("for ", "").Trim();
AppleStatus := AppleStatus.SplitAtFirstOccurrenceOf(" ")[0];
//writeLn($'{ID} AppleStatus {AppleStatus} AppleImplementedIn {AppleImplementedIn}');
end;
if AppleStatus.ToLower.Contains("review") then
AppleStatus := "Review";
if AppleStatus.ToLower.Contains("accepted") then
AppleStatus := "Accepted";
if AppleStatus.ToLower.Contains("accepted") then
AppleStatus := "Accepted";
if AppleStatus.ToLower.Contains("returned") then
AppleStatus := "Returned";
end;
end;
end;
property ID: String; readonly;
property Name: String; readonly;
property Text: String; readonly;
property SwiftOrgLink: String; readonly;
property Known: Boolean;
property NotApplicable: Boolean;
property SwiftBaseLibrary: Boolean;
property Implemented: Boolean;
property ImplementedIn: String;
property WontImplement: Boolean;
property IssueID: String;
property Comment: String;
property AppleStatus: String; readonly;
property AppleImplementedIn: String; readonly;
property Tracked: Boolean read NotApplicable or SwiftBaseLibrary or Implemented or (length(IssueID) > 0);
method GetElementsStatusString: String;
begin
result := ID;
if NotApplicable then
result := result+", Not Applicable";
if SwiftBaseLibrary then
result := result+", Swift Base Library";
if length(IssueID) > 0 then
result := result+", ID="+IssueID;
if Implemented then
result := result + ", Implemented";
if length(ImplementedIn) > 0 then
result := result + ", In="+ImplementedIn;
if WontImplement then
result := result + ", WontImplement";
if length(Comment) > 0 then
result := result + ", Comment="+Comment;
result := result.Trim();
end;
method GetMarkdown: String;
begin
result := "* ";
if NotApplicable or WontImplement then
result := result+"<s style=""color: gray;"">"
else if Implemented then
result := result+"<s style=""color: green;"">"
else if not Tracked then
result := result+"<span style=""color: red;"">";
var lName := Name;
if length(lName) > 75 then
lName :=lName.Substring(0, 75)+"…";
result := result+String.Format("[SE-{0}]({1}) {2}", ID, SwiftOrgLink, lName);
if NotApplicable or Implemented or WontImplement then
result := result+"</s>"
else if not Tracked then
result := result+"</span>";
if NotApplicable then begin
result := result+" — (Not applicable)"
end
else if Implemented then begin
if length(ImplementedIn) > 0 then
result := result+" — <b>(done, "+ImplementedIn+")</b>"
else
result := result+" — <b>(done)</b>";
end
else if WontImplement then begin
result := result+" — (won't implement)";
end
else if length(IssueID) > 0 then begin
if IssueID.ToUpperInvariant.StartsWith("E") then
result := result+" — <b>("+IssueID.ToUpperInvariant+")</b>"
else
result := result+" — <b>(#"+IssueID+")</b>"
end
else if SwiftBaseLibrary then begin
result := result+" — <b>(SBL)</b>"
end;
end;
end;
end.