diff --git a/tools/MarkdownParser/.gitignore b/tools/MarkdownParser/.gitignore new file mode 100644 index 00000000..bf1a3933 --- /dev/null +++ b/tools/MarkdownParser/.gitignore @@ -0,0 +1,4 @@ +bin +obj +*.user +*.suo diff --git a/tools/MarkdownParser/HtmlAgilityPack20/Html2Txt.dll b/tools/MarkdownParser/HtmlAgilityPack20/Html2Txt.dll new file mode 100644 index 00000000..cd05576c Binary files /dev/null and b/tools/MarkdownParser/HtmlAgilityPack20/Html2Txt.dll differ diff --git a/tools/MarkdownParser/HtmlAgilityPack20/HtmlAgilityPack.dll b/tools/MarkdownParser/HtmlAgilityPack20/HtmlAgilityPack.dll new file mode 100644 index 00000000..5fe1e014 Binary files /dev/null and b/tools/MarkdownParser/HtmlAgilityPack20/HtmlAgilityPack.dll differ diff --git a/tools/MarkdownParser/HtmlAgilityPack20/License.txt b/tools/MarkdownParser/HtmlAgilityPack20/License.txt new file mode 100644 index 00000000..f36517eb --- /dev/null +++ b/tools/MarkdownParser/HtmlAgilityPack20/License.txt @@ -0,0 +1,33 @@ +Copyright 2005-2007 Simon Mourier + +Microsoft Public License (Ms-PL) + +This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. + +1. Definitions + +The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. + +A "contribution" is the original software, or any additions or changes to the software. + +A "contributor" is any person that distributes its contribution under this license. + +"Licensed patents" are a contributor's patent claims that read directly on its contribution. + +2. Grant of Rights + +(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. + +(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. + +3. Conditions and Limitations + +(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. + +(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. + +(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. + +(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. + +(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/tools/MarkdownParser/Markdown.NET/License.text b/tools/MarkdownParser/Markdown.NET/License.text new file mode 100644 index 00000000..6d765065 --- /dev/null +++ b/tools/MarkdownParser/Markdown.NET/License.text @@ -0,0 +1,30 @@ +Copyright (c) 2004, John Gruber + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name "Markdown" nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +This software is provided by the copyright holders and contributors "as +is" and any express or implied warranties, including, but not limited +to, the implied warranties of merchantability and fitness for a +particular purpose are disclaimed. In no event shall the copyright owner +or contributors be liable for any direct, indirect, incidental, special, +exemplary, or consequential damages (including, but not limited to, +procurement of substitute goods or services; loss of use, data, or +profits; or business interruption) however caused and on any theory of +liability, whether in contract, strict liability, or tort (including +negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage. diff --git a/tools/MarkdownParser/Markdown.NET/anrControls.Markdown.NET.dll b/tools/MarkdownParser/Markdown.NET/anrControls.Markdown.NET.dll new file mode 100644 index 00000000..1126c8b5 Binary files /dev/null and b/tools/MarkdownParser/Markdown.NET/anrControls.Markdown.NET.dll differ diff --git a/tools/MarkdownParser/Markdown.NET/readme.txt b/tools/MarkdownParser/Markdown.NET/readme.txt new file mode 100644 index 00000000..50c942b0 --- /dev/null +++ b/tools/MarkdownParser/Markdown.NET/readme.txt @@ -0,0 +1,8 @@ +======================================================== +Markdown.NET --- a C# port of the original Markdown code +======================================================== + +ver 0.2.0.0 - Initial release +ver 1.0.1.7 - Code fixes to sync up with ver. 1.0.1b7 of the original Markdown +ver 1.0.1 - Code fixes to sync up with ver. 1.0.1 of the original Markdown. Also + from now on the code and binaries comes with a BSD license. diff --git a/tools/MarkdownParser/MarkdownParser.csproj b/tools/MarkdownParser/MarkdownParser.csproj new file mode 100644 index 00000000..5197bd5a --- /dev/null +++ b/tools/MarkdownParser/MarkdownParser.csproj @@ -0,0 +1,71 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4E991FAD-190C-4B19-BF9F-25783E9EC6C0} + Exe + Properties + MarkdownParser + MarkdownParser + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + Markdown.NET\anrControls.Markdown.NET.dll + + + False + HtmlAgilityPack20\Html2Txt.dll + + + False + HtmlAgilityPack20\HtmlAgilityPack.dll + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + \ No newline at end of file diff --git a/tools/MarkdownParser/MarkdownParser.sln b/tools/MarkdownParser/MarkdownParser.sln new file mode 100644 index 00000000..b6e89b5c --- /dev/null +++ b/tools/MarkdownParser/MarkdownParser.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkdownParser", "MarkdownParser.csproj", "{4E991FAD-190C-4B19-BF9F-25783E9EC6C0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4E991FAD-190C-4B19-BF9F-25783E9EC6C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4E991FAD-190C-4B19-BF9F-25783E9EC6C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4E991FAD-190C-4B19-BF9F-25783E9EC6C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4E991FAD-190C-4B19-BF9F-25783E9EC6C0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tools/MarkdownParser/Program.cs b/tools/MarkdownParser/Program.cs new file mode 100644 index 00000000..1697e20f --- /dev/null +++ b/tools/MarkdownParser/Program.cs @@ -0,0 +1,39 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; +using anrControls; +using HtmlAgilityPack.Samples; + +namespace MarkdownParser +{ + internal class Program + { + private static void Main(string[] args) + { + if (args.Length < 3) + { + Console.WriteLine("usage: MarkdownParser input_file html_output_file text_output_file"); + Environment.Exit(-1); + } + + if (!File.Exists(args[0])) + { + Console.WriteLine("{0} does not exist.", args[0]); + Environment.Exit(-1); + } + + //convert markdown to html + var markdownSource = File.ReadAllText(args[0]); + var htmlSource = new Markdown().Transform(markdownSource); + File.WriteAllText(args[1], htmlSource); + + //convert html to txt + var html2txt = new HtmlToText(); + var text = html2txt.Convert(args[1]); + //use OS newlines + text = Regex.Replace(text, "(?