fix(export): write LF line endings and keep titles on one line
AppendLine wrote CRLF on Windows; the document now uses LF everywhere and converts CRLF/CR inside card bodies and column descriptions. Column titles and the workspace name are collapsed to one line like card titles.
This commit is contained in:
1 parent
c12408d2e3
commit
8e144b9154
2 files changed
+85
-23
No files matched your search
@@ -123,7 +123,7 @@ public class MarkdownExporterTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalizes CRLF line endings so expected and actual compare consistently.
|
||||
/// Normalizes the expected document, built with the platform newline, to the exporter's LF.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to normalize.</param>
|
||||
/// <returns>The text with normalized line endings.</returns>
|
||||
@@ -139,7 +139,7 @@ public class MarkdownExporterTests
|
||||
try
|
||||
{
|
||||
Resources.Culture = culture;
|
||||
Assert.AreEqual(Normalize(BuildExpected(culture)), Normalize(ExportBoard()));
|
||||
Assert.AreEqual(Normalize(BuildExpected(culture)), ExportBoard());
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -225,7 +225,7 @@ public class MarkdownExporterTests
|
||||
[(tag, 1L)],
|
||||
ExportedAt);
|
||||
|
||||
StringAssert.Contains(markdown, string.Format(Resources.Culture, Resources.Export_TagsLine, expected) + Environment.NewLine);
|
||||
StringAssert.Contains(markdown, string.Format(Resources.Culture, Resources.Export_TagsLine, expected) + "\n");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -240,12 +240,12 @@ public class MarkdownExporterTests
|
||||
try
|
||||
{
|
||||
Resources.Culture = new CultureInfo("en");
|
||||
string markdown = Normalize(MarkdownExporter.Export(
|
||||
string markdown = MarkdownExporter.Export(
|
||||
"W",
|
||||
[new ColumnModel(1, "C", "line one\n# not a heading | pipe", 1, 1)],
|
||||
[new CardModel(1, 1, "T", "body\n\n## raw | `md`", 1, 1, [])],
|
||||
[],
|
||||
ExportedAt));
|
||||
ExportedAt);
|
||||
|
||||
StringAssert.Contains(markdown, "\nline one\n# not a heading | pipe\n");
|
||||
StringAssert.Contains(markdown, "\nbody\n\n## raw | `md`\n");
|
||||
@@ -256,6 +256,53 @@ public class MarkdownExporterTests
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LineEndingsAreLfOnEveryPlatform()
|
||||
{
|
||||
CultureInfo? original = Resources.Culture;
|
||||
try
|
||||
{
|
||||
Resources.Culture = new CultureInfo("en");
|
||||
string markdown = MarkdownExporter.Export(
|
||||
"W",
|
||||
[new ColumnModel(1, "C", "one\r\ntwo\rthree", 1, 1)],
|
||||
[new CardModel(1, 1, "T", "a\r\nb", 1, 1, [])],
|
||||
[],
|
||||
ExportedAt);
|
||||
|
||||
Assert.IsFalse(markdown.Contains('\r'));
|
||||
StringAssert.Contains(markdown, "\none\ntwo\nthree\n");
|
||||
StringAssert.Contains(markdown, "\na\nb\n");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Resources.Culture = original;
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ColumnTitleIsCollapsedToOneLine()
|
||||
{
|
||||
CultureInfo? original = Resources.Culture;
|
||||
try
|
||||
{
|
||||
Resources.Culture = new CultureInfo("en");
|
||||
string markdown = MarkdownExporter.Export(
|
||||
"W",
|
||||
[new ColumnModel(1, "To\r\nDo\nNow", string.Empty, 1, 1)],
|
||||
[],
|
||||
[],
|
||||
ExportedAt);
|
||||
|
||||
string heading = string.Format(Resources.Culture, Resources.Export_ColumnHeading, "To Do Now", 0);
|
||||
StringAssert.Contains(markdown, "\n" + heading + "\n");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Resources.Culture = original;
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ColumnsAndCardsAreExportedInIdOrder()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user