Skip to content

Commit 366dd5c

Browse files
authored
Merge pull request #12 from atifaziz/eols
Don't potentially mix EOL sequences in output documents
2 parents c6ab408 + 1174c02 commit 366dd5c

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

src/MarkdownSnippets/Processing/GitHubMarkdownProcessor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ static void ProcessFile(string sourceFile, MarkdownProcessor markdownProcessor,
6868
using (var reader = File.OpenText(sourceFile))
6969
using (var writer = File.CreateText(target))
7070
{
71-
writer.WriteLine($@"<!--
72-
This file was generate by MarkdownSnippets.
73-
Source File: {sourceFile.ReplaceCaseless(targetDirectory,"")}
74-
To change this file edit the source file and then re-run the generation using either the dotnet global tool (https://github.com/SimonCropp/MarkdownSnippets#githubmarkdownsnippets) or using the api (https://github.com/SimonCropp/MarkdownSnippets#running-as-a-unit-test).
75-
-->
76-
");
71+
writer.WriteLine(@"<!--");
72+
writer.WriteLine(@"This file was generate by MarkdownSnippets.");
73+
writer.WriteLine($@"Source File: {sourceFile.ReplaceCaseless(targetDirectory,"")}");
74+
writer.WriteLine(@"To change this file edit the source file and then re-run the generation using either the dotnet global tool (https://github.com/SimonCropp/MarkdownSnippets#githubmarkdownsnippets) or using the api (https://github.com/SimonCropp/MarkdownSnippets#running-as-a-unit-test).");
75+
writer.WriteLine(@"-->");
76+
7777
var processResult = markdownProcessor.Apply(reader, writer);
7878
var missing = processResult.MissingSnippets;
7979
if (missing.Any())

src/MarkdownSnippets/Processing/GitHubSnippetMarkdownHandling.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ public void AppendGroup(string key, IEnumerable<Snippet> snippets, TextWriter wr
3030

3131
void WriteSnippet(TextWriter writer, Snippet snippet)
3232
{
33-
var format = $@"```{snippet.Language}
34-
{snippet.Value}
35-
```";
36-
writer.WriteLine(format);
33+
writer.WriteLine($"```{snippet.Language}");
34+
writer.WriteLine(snippet.Value);
35+
writer.WriteLine("```");
3736

3837
if (snippet.Path != null)
3938
{

src/MarkdownSnippets/Processing/SimpleSnippetMarkdownHandling.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ public static void AppendGroup(string key, IEnumerable<Snippet> snippets, TextWr
2121

2222
static void WriteSnippet(TextWriter writer, Snippet snippet)
2323
{
24-
var format = $@"```{snippet.Language}
25-
{snippet.Value}
26-
```";
27-
writer.WriteLine(format);
24+
writer.WriteLine($@"```{snippet.Language}");
25+
writer.WriteLine(snippet.Value);
26+
writer.WriteLine(@"```");
2827
}
2928
}
3029
}

0 commit comments

Comments
 (0)