");
+
+ Formatter.BeginTypeAddition (Output);
State.Indent = 0;
AddedInner (target);
- Output.WriteLine ("");
- Output.WriteLine ("Added value{0}:
", list.Count () > 1 ? "s" : String.Empty); - Output.WriteLine ("");
- } else {
- base.BeforeAdding (list);
- }
- }
-
- public override void BeforeRemoving (IEnumerable list)
- {
- first = true;
- if (State.BaseType == "System.Enum") {
- Output.WriteLine ("Removed value{0}:
", list.Count () > 1 ? "s" : String.Empty);
- Output.WriteLine ("");
- } else {
- base.BeforeRemoving (list);
- }
- }
}
}
\ No newline at end of file
diff --git a/mcs/tools/mono-api-html/Formatter.cs b/mcs/tools/mono-api-html/Formatter.cs
new file mode 100644
index 0000000000..88318600d8
--- /dev/null
+++ b/mcs/tools/mono-api-html/Formatter.cs
@@ -0,0 +1,88 @@
+//
+// Authors
+// Sebastien Pouliot
+//
+// Copyright 2018 Microsoft Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Xml.Linq;
+using System.Text;
+
+namespace Xamarin.ApiDiff {
+
+ public abstract class Formatter {
+
+ public static Formatter Current { get; set; }
+
+ public abstract string LesserThan { get; }
+ public abstract string GreaterThan { get; }
+
+ public abstract void BeginDocument (TextWriter output, string title);
+ public virtual void EndDocument (TextWriter output)
+ {
+ }
+
+ public abstract void BeginAssembly (TextWriter output);
+ public virtual void EndAssembly (TextWriter output)
+ {
+ }
+
+ public abstract void BeginNamespace (TextWriter output, string action = "");
+ public virtual void EndNamespace (TextWriter output)
+ {
+ }
+
+ public abstract void BeginTypeAddition (TextWriter output);
+ public abstract void EndTypeAddition (TextWriter output);
+
+ public abstract void BeginTypeModification (TextWriter output);
+ public virtual void EndTypeModification (TextWriter output)
+ {
+ }
+
+ public abstract void BeginTypeRemoval (TextWriter output);
+ public virtual void EndTypeRemoval (TextWriter output)
+ {
+ }
+
+ public abstract void BeginMemberAddition (TextWriter output, IEnumerable list, MemberComparer member);
+ public abstract void AddMember (TextWriter output, MemberComparer member, bool isInterfaceBreakingChange, string obsolete, string description);
+ public abstract void EndMemberAddition (TextWriter output);
+
+ public abstract void BeginMemberModification (TextWriter output, string sectionName);
+ public abstract void EndMemberModification (TextWriter output);
+
+ public abstract void BeginMemberRemoval (TextWriter output, IEnumerable list, MemberComparer member);
+ public abstract void RemoveMember (TextWriter output, MemberComparer member, bool breaking, string obsolete, string description);
+ public abstract void EndMemberRemoval (TextWriter output);
+
+ public abstract void RenderObsoleteMessage (StringBuilder output, MemberComparer member, string description, string optionalObsoleteMessage);
+
+ public abstract void DiffAddition (StringBuilder output, string text, bool breaking);
+ public abstract void DiffModification (StringBuilder output, string old, string @new, bool breaking);
+ public abstract void DiffRemoval (StringBuilder output, string text, bool breaking);
+ public abstract void Diff (TextWriter output, ApiChange apichange);
+ }
+}
diff --git a/mcs/tools/mono-api-html/Helpers.cs b/mcs/tools/mono-api-html/Helpers.cs
index 8769785c47..854c1b2938 100644
--- a/mcs/tools/mono-api-html/Helpers.cs
+++ b/mcs/tools/mono-api-html/Helpers.cs
@@ -143,7 +143,7 @@ namespace Xamarin.ApiDiff {
if (pos >= 0) {
int end = type.LastIndexOf (']');
string subtype = type.Substring (pos + 3, end - pos - 3);
- return type.Substring (0, pos) + "<" + GetTypeName (subtype) + ">";
+ return type.Substring (0, pos) + Formatter.Current.LesserThan + GetTypeName (subtype) + Formatter.Current.GreaterThan;
}
switch (type) {
diff --git a/mcs/tools/mono-api-html/HtmlFormatter.cs b/mcs/tools/mono-api-html/HtmlFormatter.cs
new file mode 100644
index 0000000000..55fd4f4ba6
--- /dev/null
+++ b/mcs/tools/mono-api-html/HtmlFormatter.cs
@@ -0,0 +1,308 @@
+//
+// Authors
+// Sebastien Pouliot
+//
+// Copyright 2013 Xamarin Inc. http://www.xamarin.com
+// Copyright 2018 Microsoft Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml.Linq;
+using System.Text;
+
+namespace Xamarin.ApiDiff {
+
+ public class HtmlFormatter : Formatter {
+
+ public override string LesserThan => "<";
+ public override string GreaterThan => ">";
+
+ protected void Indent (TextWriter output)
+ {
+ for (int i = 0; i < State.Indent; i++)
+ output.Write ("\t");
+ }
+
+ public override void BeginDocument (TextWriter output, string title)
+ {
+ output.WriteLine ("");
+ if (State.Colorize) {
+ output.WriteLine ("");
+ }
+ output.WriteLine (
+ @"");
+ }
+
+ public override void BeginAssembly (TextWriter output)
+ {
+ output.WriteLine ($"{State.Assembly}.dll
");
+ if (!State.IgnoreNonbreaking) {
+ output.WriteLine ("");
+ output.WriteLine ("");
+ output.WriteLine ("
");
+ }
+ output.WriteLine ("");
+ }
+
+ public override void EndAssembly (TextWriter output)
+ {
+ output.WriteLine (" ");
+ output.WriteLine ("");
+ }
+
+ public override void BeginNamespace (TextWriter output, string action)
+ {
+ output.WriteLine ($" ");
+ output.WriteLine ($"{action}Namespace {State.Namespace}
");
+ }
+
+ public override void EndNamespace (TextWriter output)
+ {
+ output.WriteLine ($" ");
+ }
+
+ public override void BeginTypeAddition (TextWriter output)
+ {
+ output.WriteLine ($" ");
+ output.WriteLine ($"New Type {State.Namespace}.{State.Type}
");
+ output.WriteLine ("");
+ }
+
+ public override void EndTypeAddition (TextWriter output)
+ {
+ output.WriteLine ("");
+ output.WriteLine ($" ");
+ }
+
+ public override void BeginTypeModification (TextWriter output)
+ {
+ output.WriteLine ($" ");
+ output.WriteLine ($"Type Changed: {State.Namespace}.{State.Type}
");
+ }
+
+ public override void EndTypeModification (TextWriter output)
+ {
+ output.WriteLine ($" ");
+ }
+
+ public override void BeginTypeRemoval (TextWriter output)
+ {
+ output.Write ($"Removed Type {State.Namespace}.{State.Type}
");
+ }
+
+ public override void BeginMemberAddition (TextWriter output, IEnumerable list, MemberComparer member)
+ {
+ output.WriteLine ("");
+ if (State.BaseType == "System.Enum") {
+ output.WriteLine ("Added value{0}:
", list.Count () > 1 ? "s" : String.Empty);
+ output.WriteLine ("");
+ } else {
+ output.WriteLine ("Added {0}:
", list.Count () > 1 ? member.GroupName : member.ElementName);
+ output.WriteLine ("");
+ }
+ State.Indent++;
+ }
+
+ public override void AddMember (TextWriter output, MemberComparer member, bool isInterfaceBreakingChange, string obsolete, string description)
+ {
+ output.Write ("", member.ElementName, isInterfaceBreakingChange ? "breaking" : string.Empty, isInterfaceBreakingChange ? "data-is-breaking" : "data-is-non-breaking");
+ output.Write ($"{obsolete}{description}");
+ output.WriteLine ("");
+ }
+
+ public override void EndMemberAddition (TextWriter output)
+ {
+ State.Indent--;
+ output.WriteLine ("");
+ output.WriteLine ("");
+ }
+
+ public override void BeginMemberModification (TextWriter output, string sectionName)
+ {
+ output.WriteLine ($"{sectionName}:
");
+ output.WriteLine ("");
+ }
+
+ public override void EndMemberModification (TextWriter output)
+ {
+ output.WriteLine ("");
+ }
+
+ public override void BeginMemberRemoval (TextWriter output, IEnumerable list, MemberComparer member)
+ {
+ if (State.BaseType == "System.Enum") {
+ output.WriteLine ("Removed value{0}:
", list.Count () > 1 ? "s" : String.Empty);
+ output.WriteLine ("");
+ } else {
+ output.WriteLine ("Removed {0}:
\n", list.Count () > 1 ? member.GroupName : member.ElementName);
+ output.WriteLine ("");
+ }
+ State.Indent++;
+ }
+
+ public override void RemoveMember (TextWriter output, MemberComparer member, bool breaking, string obsolete, string description)
+ {
+ Indent (output);
+ output.Write ("", member.ElementName, breaking ? "data-is-breaking" : "data-is-non-breaking", breaking ? "breaking" : string.Empty);
+ if (obsolete.Length > 0) {
+ output.Write (obsolete);
+ Indent (output);
+ }
+ output.Write (description);
+ output.WriteLine ("");
+ }
+
+ public override void RenderObsoleteMessage (StringBuilder output, MemberComparer member, string description, string optionalObsoleteMessage)
+ {
+ output.Append ($"");
+ output.Append ("[Obsolete (");
+ if (!String.IsNullOrEmpty (optionalObsoleteMessage))
+ output.Append ('"').Append (optionalObsoleteMessage).Append ('"');
+ output.AppendLine (")]");
+ output.Append (description);
+ output.Append ("");
+ }
+
+ public override void EndMemberRemoval (TextWriter output)
+ {
+ State.Indent--;
+ output.WriteLine ("");;
+ }
+
+ public override void DiffAddition (StringBuilder output, string text, bool breaking)
+ {
+ output.Append ("");
+ output.Append (text);
+ output.Append ("");
+ }
+
+ public override void DiffModification (StringBuilder output, string old, string @new, bool breaking)
+ {
+ if (old.Length > 0)
+ DiffRemoval (output, old, breaking);
+ if (old.Length > 0 && @new.Length > 0)
+ output.Append (' ');
+ if (@new.Length > 0)
+ DiffAddition (output, @new, false);
+ }
+
+ public override void DiffRemoval (StringBuilder output, string text, bool breaking)
+ {
+ output.Append ("");
+ output.Append (text);
+ output.Append ("");
+ }
+
+ public override void Diff (TextWriter output, ApiChange apichange)
+ {
+ output.Write ("", apichange.Breaking ? "data-is-breaking" : "data-is-non-breaking");
+ foreach (var line in apichange.Member.ToString ().Split ('\n')) {
+ output.Write ('\t');
+ output.WriteLine (line);
+ }
+ output.Write ("");
+ }
+ }
+}
diff --git a/mcs/tools/mono-api-html/MarkdownFormatter.cs b/mcs/tools/mono-api-html/MarkdownFormatter.cs
new file mode 100644
index 0000000000..9b8b65dd10
--- /dev/null
+++ b/mcs/tools/mono-api-html/MarkdownFormatter.cs
@@ -0,0 +1,199 @@
+//
+// Authors
+// Sebastien Pouliot
+//
+// Copyright 2018 Microsoft Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml.Linq;
+using System.Text;
+
+namespace Xamarin.ApiDiff {
+
+ public class MarkdownFormatter : Formatter {
+
+ public override string LesserThan => "<";
+ public override string GreaterThan => ">";
+
+ public override void BeginDocument (TextWriter output, string title)
+ {
+ output.WriteLine ($"# {title}");
+ output.WriteLine ();
+ }
+
+ public override void BeginAssembly (TextWriter output)
+ {
+ // this serves as ToC (table of content) entries so we skip the "Assembly: " prefix
+ output.WriteLine ($"## {State.Assembly}.dll");
+ output.WriteLine ();
+ }
+
+ public override void BeginNamespace (TextWriter output, string action)
+ {
+ output.WriteLine ($"### {action}Namespace {State.Namespace}");
+ output.WriteLine ();
+ }
+
+ public override void BeginTypeAddition (TextWriter output)
+ {
+ output.WriteLine ($"#### New Type: {@State.Namespace}.{State.Type}");
+ output.WriteLine ();
+ output.WriteLine ("```csharp");
+ }
+
+ public override void EndTypeAddition (TextWriter output)
+ {
+ output.WriteLine ("```");
+ output.WriteLine ();
+ }
+
+ public override void BeginTypeModification (TextWriter output)
+ {
+ output.WriteLine ($"#### Type Changed: {State.Namespace}.{State.Type}");
+ output.WriteLine ();
+ }
+
+ public override void BeginTypeRemoval (TextWriter output)
+ {
+ output.WriteLine ($"#### Removed Type {State.Namespace}.{State.Type}");
+ }
+
+ public override void BeginMemberAddition (TextWriter output, IEnumerable list, MemberComparer member)
+ {
+ if (State.BaseType == "System.Enum") {
+ output.WriteLine ("Added value{0}:", list.Count () > 1 ? "s" : String.Empty);
+ } else {
+ output.WriteLine ("Added {0}:", list.Count () > 1 ? member.GroupName : member.ElementName);
+ }
+ output.WriteLine ();
+ output.WriteLine ("```csharp");
+ }
+
+ public override void AddMember (TextWriter output, MemberComparer member, bool isInterfaceBreakingChange, string obsolete, string description)
+ {
+ output.Write (obsolete);
+ output.WriteLine (description);
+ }
+
+ public override void EndMemberAddition (TextWriter output)
+ {
+ output.WriteLine ("```");
+ output.WriteLine ();
+ }
+
+ public override void BeginMemberModification (TextWriter output, string sectionName)
+ {
+ output.WriteLine ($"{sectionName}:");
+ output.WriteLine ();
+ output.WriteLine ("```diff");
+ }
+
+ public override void EndMemberModification (TextWriter output)
+ {
+ output.WriteLine ("```");
+ output.WriteLine ();
+ }
+
+ public override void BeginMemberRemoval (TextWriter output, IEnumerable list, MemberComparer member)
+ {
+ if (State.BaseType == "System.Enum") {
+ output.WriteLine ("Removed value{0}:", list.Count () > 1 ? "s" : String.Empty);
+ } else {
+ output.WriteLine ("Removed {0}:", list.Count () > 1 ? member.GroupName : member.ElementName);
+ }
+ output.WriteLine ();
+ output.WriteLine ("```csharp");
+ }
+
+ public override void RemoveMember (TextWriter output, MemberComparer member, bool is_breaking, string obsolete, string description)
+ {
+ output.Write (obsolete);
+ output.WriteLine (description);
+ }
+
+ public override void EndMemberRemoval (TextWriter output)
+ {
+ output.WriteLine ("```");
+ output.WriteLine ();
+ }
+
+ public override void RenderObsoleteMessage (StringBuilder output, MemberComparer member, string description, string optionalObsoleteMessage)
+ {
+ output.Append ("[Obsolete (");
+ if (!String.IsNullOrEmpty (optionalObsoleteMessage))
+ output.Append ('"').Append (optionalObsoleteMessage).Append ('"');
+ output.AppendLine (")]");
+ output.Append (description);
+ }
+
+ string Clean (string line, string remove, string keep)
+ {
+ var cleaned = line.Replace (remove, String.Empty);
+ int s = cleaned.IndexOf (keep, StringComparison.Ordinal);
+ if (s != -1) {
+ int e = cleaned.IndexOf (keep, s + keep.Length, StringComparison.Ordinal);
+ cleaned = cleaned.Remove (s, e - s + keep.Length);
+ }
+ while (cleaned.Contains (" "))
+ cleaned = cleaned.Replace (" ", " ");
+ return cleaned;
+ }
+
+ public override void DiffAddition (StringBuilder output, string text, bool breaking)
+ {
+ output.Append ("+++");
+ output.Append (text);
+ output.Append ("+++");
+ }
+
+ public override void DiffModification (StringBuilder output, string old, string @new, bool breaking)
+ {
+ if (old.Length > 0)
+ DiffAddition (output, old, breaking);
+ if (@new.Length > 0)
+ DiffRemoval (output, @new, true);
+ }
+
+ public override void DiffRemoval (StringBuilder output, string text, bool breaking)
+ {
+ output.Append ("---");
+ output.Append (text);
+ output.Append ("---");
+ }
+
+ public override void Diff (TextWriter output, ApiChange apichange)
+ {
+ foreach (var line in apichange.Member.ToString ().Split ('\n')) {
+ if (line.Contains ("+++")) {
+ output.WriteLine ("-{0}", Clean (line, "+++", "---"));
+ output.WriteLine ("+{0}", Clean (line, "---", "+++"));
+ } else {
+ output.WriteLine (" {0}", line);
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/tools/mono-api-html/MemberComparer.cs b/mcs/tools/mono-api-html/MemberComparer.cs
index b32e17e343..413be610ea 100644
--- a/mcs/tools/mono-api-html/MemberComparer.cs
+++ b/mcs/tools/mono-api-html/MemberComparer.cs
@@ -128,13 +128,13 @@ namespace Xamarin.ApiDiff {
if (State.IgnoreAdded.Any (re => re.IsMatch (memberDescription)))
continue;
if (!a) {
- BeforeAdding (elements);
+ Formatter.BeginMemberAddition (Output, elements, this);
a = true;
}
Added (item, false);
}
if (a)
- AfterAdding ();
+ Formatter.EndMemberAddition (Output);
}
void Modify (ApiChanges modified)
@@ -142,18 +142,13 @@ namespace Xamarin.ApiDiff {
foreach (var changes in modified) {
if (State.IgnoreNonbreaking && changes.Value.All (c => !c.Breaking))
continue;
- Output.WriteLine ("{0}:
", changes.Key);
- Output.WriteLine ("");
+ Formatter.BeginMemberModification (Output, changes.Key);
foreach (var element in changes.Value) {
if (State.IgnoreNonbreaking && !element.Breaking)
continue;
- Output.Write ("", element.Breaking ? "data-is-breaking" : "data-is-non-breaking");
- foreach (var line in element.Member.ToString ().Split ('\n'))
- Output.WriteLine ("\t{0}", line);
- Output.Write ("");
-
+ Formatter.Diff (Output, element);
}
- Output.WriteLine ("");
+ Formatter.EndMemberModification (Output);
}
}
@@ -169,13 +164,14 @@ namespace Xamarin.ApiDiff {
if (State.IgnoreNonbreaking && !IsBreakingRemoval (item))
continue;
if (!r) {
- BeforeRemoving (elements);
+ Formatter.BeginMemberRemoval (Output, elements, this);
+ first = true;
r = true;
}
Removed (item);
}
if (r)
- AfterRemoving ();
+ Formatter.EndMemberRemoval (Output);
}
public abstract string GetDescription (XElement e);
@@ -189,8 +185,6 @@ namespace Xamarin.ApiDiff {
if (o.Length > 0)
sb.Append (" (\"").Append (o).Append ("\")");
sb.AppendLine ("]");
- for (int i = 0; i < State.Indent + 1; i++)
- sb.Append ('\t');
}
return sb;
}
@@ -206,14 +200,6 @@ namespace Xamarin.ApiDiff {
return base.Equals (source, target, changes);
}
- public virtual void BeforeAdding (IEnumerable list)
- {
- first = true;
- Output.WriteLine ("");
- Output.WriteLine ("Added {0}:
", list.Count () > 1 ? GroupName : ElementName);
- Output.WriteLine ("");
- }
-
public override void Added (XElement target, bool wasParentAdded)
{
var o = GetObsoleteMessage (target);
@@ -221,29 +207,14 @@ namespace Xamarin.ApiDiff {
Output.WriteLine ();
Indent ();
bool isInterfaceBreakingChange = !wasParentAdded && IsInInterface (target);
- Output.Write ("\t", ElementName, isInterfaceBreakingChange ? "breaking" : string.Empty, isInterfaceBreakingChange ? "data-is-breaking" : "data-is-non-breaking");
- Output.Write ("{0}{1}", o, GetDescription (target));
- Output.WriteLine ("");
+ Formatter.AddMember (Output, this, isInterfaceBreakingChange, o.ToString (), GetDescription (target));
first = false;
}
- public virtual void AfterAdding ()
- {
- Output.WriteLine ("");
- Output.WriteLine ("");
- }
-
public override void Modified (XElement source, XElement target, ApiChanges change)
{
}
- public virtual void BeforeRemoving (IEnumerable list)
- {
- first = true;
- Output.WriteLine ("Removed {0}:
\n", list.Count () > 1 ? GroupName : ElementName);
- Output.WriteLine ("");
- }
-
public override void Removed (XElement source)
{
var o = GetObsoleteMessage (source);
@@ -252,18 +223,10 @@ namespace Xamarin.ApiDiff {
bool is_breaking = IsBreakingRemoval (source);
- Indent ();
- Output.Write ("\t", ElementName, is_breaking ? "data-is-breaking" : "data-is-non-breaking", is_breaking ? "breaking" : string.Empty);
- Output.Write ("{0}{1}", o, GetDescription (source));
- Output.WriteLine ("");
+ Formatter.RemoveMember (Output, this, is_breaking, o.ToString (), GetDescription (source));
first = false;
}
- public virtual void AfterRemoving ()
- {
- Output.WriteLine ("");;
- }
-
string RenderGenericParameter (XElement gp)
{
var sb = new StringBuilder ();
@@ -291,7 +254,7 @@ namespace Xamarin.ApiDiff {
if (srcCount == 0 && tgtCount == 0)
return;
- change.Append ("<");
+ change.Append (Formatter.LesserThan);
for (int i = 0; i < Math.Max (srcCount, tgtCount); i++) {
if (i > 0)
change.Append (", ");
@@ -310,7 +273,7 @@ namespace Xamarin.ApiDiff {
}
}
}
- change.Append (">");
+ change.Append (Formatter.GreaterThan);
}
protected string FormatValue (string type, string value)
@@ -603,13 +566,7 @@ namespace Xamarin.ApiDiff {
return; // neither is obsolete
var change = new ApiChange (GetDescription (source));
change.Header = "Obsoleted " + GroupName;
- change.Append (string.Format ("", ElementName));
- change.Append ("[Obsolete (");
- if (tgtObsolete != string.Empty)
- change.Append ("\"").Append (tgtObsolete).Append ("\"");
- change.Append (")]\n");
- change.Append (GetDescription (target));
- change.Append ("");
+ Formatter.RenderObsoleteMessage (change.Member, this, GetDescription (target), tgtObsolete);
change.AnyChange = true;
changes.Add (source, target, change);
} else if (tgtObsolete == null) {
diff --git a/mcs/tools/mono-api-html/NamespaceComparer.cs b/mcs/tools/mono-api-html/NamespaceComparer.cs
index 65b802ebbe..b509eb5424 100644
--- a/mcs/tools/mono-api-html/NamespaceComparer.cs
+++ b/mcs/tools/mono-api-html/NamespaceComparer.cs
@@ -57,20 +57,18 @@ namespace Xamarin.ApiDiff {
public override void Added (XElement target, bool wasParentAdded)
{
- string name = target.Attribute ("name").Value;
- var namespaceDescription = $"{name}: Added namespace";
+ var namespaceDescription = $"{State.Namespace}: Added namespace";
State.LogDebugMessage ($"Possible -n value: {namespaceDescription}");
if (State.IgnoreNew.Any (re => re.IsMatch (namespaceDescription)))
return;
- Output.WriteLine (" ", name);
- Output.WriteLine ("New Namespace {0}
", name);
- Output.WriteLine ();
+ Formatter.BeginNamespace (Output, "New ");
// list all new types
- foreach (var addedType in target.Element ("classes").Elements ("class"))
+ foreach (var addedType in target.Element ("classes").Elements ("class")) {
+ State.Type = addedType.Attribute ("name").Value;
comparer.Added (addedType, true);
- Output.WriteLine (" ", name);
- Output.WriteLine ();
+ }
+ Formatter.EndNamespace (Output);
}
public override void Modified (XElement source, XElement target, ApiChanges differences)
@@ -83,10 +81,9 @@ namespace Xamarin.ApiDiff {
State.Output = output;
if (s.Length > 0) {
var name = target.Attribute ("name").Value;
- Output.WriteLine (" ", name);
- Output.WriteLine ("Namespace {0}
", name);
+ Formatter.BeginNamespace (Output);
Output.WriteLine (s);
- Output.WriteLine (" ", name);
+ Formatter.EndNamespace (Output);
}
}
@@ -99,14 +96,14 @@ namespace Xamarin.ApiDiff {
if (State.IgnoreRemoved.Any (re => re.IsMatch (namespaceDescription)))
return;
- Output.WriteLine (" ", name);
- Output.WriteLine ("Removed Namespace {0}
", name);
+ Formatter.BeginNamespace (Output, "Removed ");
Output.WriteLine ();
// list all removed types
- foreach (var removedType in source.Element ("classes").Elements ("class"))
+ foreach (var removedType in source.Element ("classes").Elements ("class")) {
+ State.Type = comparer.GetTypeName (removedType);
comparer.Removed (removedType);
- Output.WriteLine (" ", name);
- Output.WriteLine ();
+ }
+ Formatter.EndNamespace (Output);
}
}
}
\ No newline at end of file
diff --git a/mcs/tools/mono-api-html/mono-api-html.exe.sources b/mcs/tools/mono-api-html/mono-api-html.exe.sources
index 69a26798db..f196dd3cd7 100644
--- a/mcs/tools/mono-api-html/mono-api-html.exe.sources
+++ b/mcs/tools/mono-api-html/mono-api-html.exe.sources
@@ -6,8 +6,11 @@ Comparer.cs
ConstructorComparer.cs
EventComparer.cs
FieldComparer.cs
+Formatter.cs
Helpers.cs
+HtmlFormatter.cs
InterfaceComparer.cs
+MarkdownFormatter.cs
MemberComparer.cs
MethodComparer.cs
NamespaceComparer.cs
diff --git a/mono/mini/mini-llvm.c.REMOVED.git-id b/mono/mini/mini-llvm.c.REMOVED.git-id
index 536fa39a8a..c3a9f3902a 100644
--- a/mono/mini/mini-llvm.c.REMOVED.git-id
+++ b/mono/mini/mini-llvm.c.REMOVED.git-id
@@ -1 +1 @@
-741e2651dcdcdecf5ac93994dfb77b53acf446ba
\ No newline at end of file
+e6b7b70a3ecfdc193c1fee5bb30558e4224252c8
\ No newline at end of file
diff --git a/mono/mini/version.h b/mono/mini/version.h
index 92466c122c..20c53f4da9 100644
--- a/mono/mini/version.h
+++ b/mono/mini/version.h
@@ -1 +1 @@
-#define FULL_VERSION "explicit/1f3334f"
+#define FULL_VERSION "explicit/33a9dca"
diff --git a/po/mcs/de.gmo b/po/mcs/de.gmo
index 15b2e7643a..f58d716fe2 100644
Binary files a/po/mcs/de.gmo and b/po/mcs/de.gmo differ
diff --git a/po/mcs/de.po.REMOVED.git-id b/po/mcs/de.po.REMOVED.git-id
index 4f8ab21246..942c643ec5 100644
--- a/po/mcs/de.po.REMOVED.git-id
+++ b/po/mcs/de.po.REMOVED.git-id
@@ -1 +1 @@
-a5b96637c3a14d3ff54d08a69b9be2dab301459a
\ No newline at end of file
+d41d73147f2851a5a673fd18b45fceaae78e3025
\ No newline at end of file
diff --git a/po/mcs/es.gmo b/po/mcs/es.gmo
index b810450541..6c7fb28a17 100644
Binary files a/po/mcs/es.gmo and b/po/mcs/es.gmo differ
diff --git a/po/mcs/es.po.REMOVED.git-id b/po/mcs/es.po.REMOVED.git-id
index 6cd4e4ff42..64424bb659 100644
--- a/po/mcs/es.po.REMOVED.git-id
+++ b/po/mcs/es.po.REMOVED.git-id
@@ -1 +1 @@
-a62d543177eb487ce400a5c919cfc87a7c4b3880
\ No newline at end of file
+144a82c66e1f0499961ff7c2fbfbd42f298b91db
\ No newline at end of file
diff --git a/po/mcs/ja.gmo b/po/mcs/ja.gmo
index 0b3ada0dbf..6455e38579 100644
Binary files a/po/mcs/ja.gmo and b/po/mcs/ja.gmo differ
diff --git a/po/mcs/ja.po.REMOVED.git-id b/po/mcs/ja.po.REMOVED.git-id
index a43e96359b..0f134599ea 100644
--- a/po/mcs/ja.po.REMOVED.git-id
+++ b/po/mcs/ja.po.REMOVED.git-id
@@ -1 +1 @@
-04ee6e6515a55fe2f33a80529c0c3ebab18fc86a
\ No newline at end of file
+c8f9a61d85ec94cf5bb390a5dfe4cddc3a17b314
\ No newline at end of file
diff --git a/po/mcs/mcs.pot b/po/mcs/mcs.pot
index 0092baa378..35912285e7 100644
--- a/po/mcs/mcs.pot
+++ b/po/mcs/mcs.pot
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: mono 5.14.0.116\n"
+"Project-Id-Version: mono 5.14.0.121\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2018-06-01 08:17+0000\n"
+"POT-Creation-Date: 2018-06-02 08:31+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
diff --git a/po/mcs/pt_BR.gmo b/po/mcs/pt_BR.gmo
index d9037a68df..d4219a4c83 100644
Binary files a/po/mcs/pt_BR.gmo and b/po/mcs/pt_BR.gmo differ
diff --git a/po/mcs/pt_BR.po.REMOVED.git-id b/po/mcs/pt_BR.po.REMOVED.git-id
index cd9d18c50f..ba00e1e1b4 100644
--- a/po/mcs/pt_BR.po.REMOVED.git-id
+++ b/po/mcs/pt_BR.po.REMOVED.git-id
@@ -1 +1 @@
-da5743e70ab27b9dae6a254153bd1ac41d49b5bf
\ No newline at end of file
+d9b795430351c1d58879bde8bd04efcf57186470
\ No newline at end of file