Skip to content

Commit

Permalink
Include last good version in caniuse boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Jan 2, 2017
1 parent e22ae3a commit a39bdf0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/wattsi.pas
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ TBug = record
TVersionedState = record
State: TImplGoodState;
Version: UTF8String;
LastVersion: UTF8String;
end;
TFeature = record
CanIUseCode: UTF8String;
Expand Down Expand Up @@ -1011,7 +1012,7 @@ TCrossReferences = record
{$IFDEF VERBOSE_ANNOTATIONS} Writeln(' found=', Found); {$ENDIF}
if (Found) then
begin
P := E(eP, ['class', 'support'], [E(eStrong, [T('Support:')]), T(' ')]);
P := E(eP, ['class', 'support'], [E(eStrong, [T('Support:')]), T(' ' + Feature.CanIUseCode, Document)]);
for BrowserIndex in TBrowserIndex do
begin
if (Feature.FirstGoodVersion[BrowserIndex].Version <> '') then
Expand All @@ -1021,14 +1022,16 @@ TCrossReferences = record
P.AppendChild(E(eSpan, ['class', Browsers[BrowserIndex].Code + ' yes'], Document,
[E(eSpan, [T(Browsers[BrowserIndex].Name, Document)]),
T(' '),
E(eSpan, [T(Feature.FirstGoodVersion[BrowserIndex].Version, Document), T('+')])]));
E(eSpan, [T(Feature.FirstGoodVersion[BrowserIndex].Version, Document), T('-'),
T(Feature.FirstGoodVersion[BrowserIndex].LastVersion, Document)])]));
end;
sAlmost:
begin
P.AppendChild(E(eSpan, ['class', Browsers[BrowserIndex].Code + ' partial'], Document,
[E(eSpan, [E(eSpan, [T(Browsers[BrowserIndex].Name, Document)]),
T(' (limited) ')]),
E(eSpan, [T(Feature.FirstGoodVersion[BrowserIndex].Version, Document), T('+')])]));
E(eSpan, [T(Feature.FirstGoodVersion[BrowserIndex].Version, Document), T('-'),
T(Feature.FirstGoodVersion[BrowserIndex].LastVersion, Document)])]));
end;
sNo:
begin
Expand All @@ -1047,7 +1050,7 @@ TCrossReferences = record
if (Found) then
Status.AppendChild(E(eP, ['class', 'caniuse'], [T('Source: '), E(eA, ['href', 'http://caniuse.com/#feat=' + Feature.CanIUseCode], Document, [T('caniuse.com')])]))
else
Status.AppendChild(E(eP, ['class', 'caniuse'], [T('Soo also: '), E(eA, ['href', 'http://caniuse.com/#feat=' + Feature.CanIUseCode], Document, [T('caniuse.com')])]));
Status.AppendChild(E(eP, ['class', 'caniuse'], [T('See also: '), E(eA, ['href', 'http://caniuse.com/#feat=' + Feature.CanIUseCode], Document, [T('caniuse.com')])]));
end;
end
else
Expand Down Expand Up @@ -2089,6 +2092,7 @@ procedure PreProcessCanIUseData(const CanIUseJSONFilename: AnsiString);
for BrowserIndex in TBrowserIndex do
begin
Feature.FirstGoodVersion[BrowserIndex].Version := '';
Feature.FirstGoodVersion[BrowserIndex].LastVersion := '';
Browser := Browsers[BrowserIndex];
for VersionIndex := High(Browsers[BrowserIndex].Versions) downto Low(Browsers[BrowserIndex].Versions) do // $R-
begin
Expand Down Expand Up @@ -2116,6 +2120,8 @@ procedure PreProcessCanIUseData(const CanIUseJSONFilename: AnsiString);
NewState := sAlmost
else
NewState := sNo;
if (Feature.FirstGoodVersion[BrowserIndex].Version = '') then
Feature.FirstGoodVersion[BrowserIndex].LastVersion := Browser.Versions[VersionIndex];
if ((Feature.FirstGoodVersion[BrowserIndex].Version <> '') and (Feature.FirstGoodVersion[BrowserIndex].State <> NewState)) then
break;
Feature.FirstGoodVersion[BrowserIndex].Version := Browser.Versions[VersionIndex];
Expand Down

0 comments on commit a39bdf0

Please sign in to comment.