diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2016-08-16 11:16:18 +0300 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2016-08-16 11:16:30 +0300 |
commit | 7a1d300de4df271e340429aea2fed47996286549 (patch) | |
tree | ebfc5ac8f90af8194e86042072a735366bffa975 /main/src/core/Mono.Texteditor | |
parent | ac70097c1f7a1a13b309fd466dfa268c46c9f5ac (diff) |
[Ide] Generalized the 'GetMarkup' system from the text editor.
Diffstat (limited to 'main/src/core/Mono.Texteditor')
3 files changed, 17 insertions, 12 deletions
diff --git a/main/src/core/Mono.Texteditor/AssemblyInfo.cs b/main/src/core/Mono.Texteditor/AssemblyInfo.cs index 62c18ad223..dce9093621 100644 --- a/main/src/core/Mono.Texteditor/AssemblyInfo.cs +++ b/main/src/core/Mono.Texteditor/AssemblyInfo.cs @@ -24,7 +24,7 @@ using System.Runtime.CompilerServices; // numbers with the '*' character (the default): [assembly: AssemblyVersion("1.0.0.0")] -[assembly: InternalsVisibleTo("MonoDevelop.TextEditor.Tests")] +[assembly: InternalsVisibleTo ("MonoDevelop.TextEditor.Tests")] // The following attributes specify the key for the sign of your assembly. See the // .NET Framework documentation for more information about signing. diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/HtmlWriter.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/HtmlWriter.cs index 531be58be9..08b0f7869f 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/HtmlWriter.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/HtmlWriter.cs @@ -32,7 +32,7 @@ using System.Linq; namespace Mono.TextEditor.Utils { - class ColoredSegment + public class ColoredSegment { public string Style { get; set; } public string Text { get; set; } @@ -74,16 +74,18 @@ namespace Mono.TextEditor.Utils return GenerateHtml (ColoredSegment.GetChunks (data, new TextSegment (0, data.Length)), data.ColorStyle, data.Options); } - internal static string GenerateHtml (List<List<ColoredSegment>> chunks, Mono.TextEditor.Highlighting.ColorScheme style, ITextEditorOptions options) + public static string GenerateHtml (List<List<ColoredSegment>> chunks, Mono.TextEditor.Highlighting.ColorScheme style, ITextEditorOptions options, bool includeBoilerplate = true) { var htmlText = new StringBuilder (); - htmlText.AppendLine (@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"); - htmlText.AppendLine ("<HTML>"); - htmlText.AppendLine ("<HEAD>"); - htmlText.AppendLine ("<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">"); - htmlText.AppendLine ("<META NAME=\"GENERATOR\" CONTENT=\"Mono Text Editor\">"); - htmlText.AppendLine ("</HEAD>"); - htmlText.AppendLine ("<BODY>"); + if (includeBoilerplate) { + htmlText.AppendLine (@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"); + htmlText.AppendLine ("<HTML>"); + htmlText.AppendLine ("<HEAD>"); + htmlText.AppendLine ("<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">"); + htmlText.AppendLine ("<META NAME=\"GENERATOR\" CONTENT=\"Mono Text Editor\">"); + htmlText.AppendLine ("</HEAD>"); + htmlText.AppendLine ("<BODY>"); + } htmlText.AppendLine ("<FONT face = '" + options.Font.Family + "'>"); bool first = true; @@ -109,7 +111,10 @@ namespace Mono.TextEditor.Utils } } htmlText.AppendLine ("</FONT>"); - htmlText.AppendLine ("</BODY></HTML>"); + + if (includeBoilerplate) { + htmlText.AppendLine ("</BODY></HTML>"); + } if (Platform.IsWindows) return GenerateCFHtml (htmlText.ToString ()); diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/RtfWriter.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/RtfWriter.cs index 9b2bfc0772..73323f3f3c 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/RtfWriter.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/RtfWriter.cs @@ -92,7 +92,7 @@ namespace Mono.TextEditor.Utils } } } - internal static string GenerateRtf (List<List<ColoredSegment>> chunks, Mono.TextEditor.Highlighting.ColorScheme style, ITextEditorOptions options) + public static string GenerateRtf (List<List<ColoredSegment>> chunks, Mono.TextEditor.Highlighting.ColorScheme style, ITextEditorOptions options) { var rtfText = new StringBuilder (); var colorList = new List<Cairo.Color> (); |