mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 23:58:31 -06:00
Always use \n, not Environment.NewLine
This commit is contained in:
@@ -38,7 +38,7 @@ public record LocalQuiz
|
||||
public string ToMarkdown()
|
||||
{
|
||||
var questionMarkdownArray = Questions.Select(q => q.ToMarkdown()).ToArray();
|
||||
var questionDelimiter = Environment.NewLine + Environment.NewLine + "---" + Environment.NewLine + Environment.NewLine;
|
||||
var questionDelimiter = "\n\n---\n\n";
|
||||
var questionMarkdown = string.Join(questionDelimiter, questionMarkdownArray);
|
||||
|
||||
return $@"Name: {Name}
|
||||
@@ -57,7 +57,7 @@ Description: {Description}
|
||||
public static LocalQuiz ParseMarkdown(string input)
|
||||
{
|
||||
|
||||
var splitInput = input.Split("---" + Environment.NewLine);
|
||||
var splitInput = input.Split("---\n");
|
||||
var settings = splitInput[0];
|
||||
var quizWithoutQuestions = getQuizWithOnlySettings(settings);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public record LocalQuizQuestion
|
||||
public string ToMarkdown()
|
||||
{
|
||||
var answerArray = Answers.Select(getAnswerMarkdown);
|
||||
var answersText = string.Join(Environment.NewLine, answerArray);
|
||||
var answersText = string.Join("\n", answerArray);
|
||||
var questionTypeIndicator = QuestionType == "essay" || QuestionType == "short_answer" ? QuestionType : "";
|
||||
|
||||
return $@"Points: {Points}
|
||||
@@ -25,7 +25,7 @@ public record LocalQuizQuestion
|
||||
private string getAnswerMarkdown(LocalQuizQuestionAnswer answer, int index)
|
||||
{
|
||||
var multilineMarkdownCompatibleText = answer.Text.StartsWith("```")
|
||||
? Environment.NewLine + answer.Text
|
||||
? "\n" + answer.Text
|
||||
: answer.Text;
|
||||
|
||||
if (QuestionType == "multiple_answers")
|
||||
@@ -53,7 +53,7 @@ public record LocalQuizQuestion
|
||||
|
||||
public static LocalQuizQuestion ParseMarkdown(string input, int questionIndex)
|
||||
{
|
||||
var lines = input.Trim().Split(Environment.NewLine);
|
||||
var lines = input.Trim().Split("\n");
|
||||
var firstLineIsPoints = lines.First().Contains("points: ", StringComparison.CurrentCultureIgnoreCase);
|
||||
|
||||
var textHasPoints = lines.Length > 0
|
||||
@@ -84,7 +84,7 @@ public record LocalQuizQuestion
|
||||
)
|
||||
.ToArray()
|
||||
: linesWithoutAnswers;
|
||||
var description = string.Join(Environment.NewLine, descriptionLines);
|
||||
var description = string.Join("\n", descriptionLines);
|
||||
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ public record LocalQuizQuestion
|
||||
}
|
||||
|
||||
if (acc.Count != 0) // Append to the previous line if there is one
|
||||
acc[^1] += Environment.NewLine + line;
|
||||
acc[^1] += "\n" + line;
|
||||
else
|
||||
acc.Add(line);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user