mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
more fixes for matching
This commit is contained in:
@@ -15,17 +15,22 @@ public record LocalQuizQuestionAnswer
|
||||
public static LocalQuizQuestionAnswer ParseMarkdown(string input, string questionType)
|
||||
{
|
||||
var isCorrect = input[0] == '*' || input[1] == '*';
|
||||
string startingQuestionPattern = @"^(\*?[a-z]?\))|\[\s*\]|\[\*\]|\^ ";
|
||||
var text = Regex.Replace(input, startingQuestionPattern, string.Empty).Trim();
|
||||
|
||||
if(questionType == QuestionType.MATCHING)
|
||||
if (questionType == QuestionType.MATCHING)
|
||||
{
|
||||
|
||||
string matchingPattern = @"^\^ ?";
|
||||
var textWithoutMatchDelimiter = Regex.Replace(input, matchingPattern, string.Empty).Trim();
|
||||
return new LocalQuizQuestionAnswer()
|
||||
{
|
||||
Correct = true,
|
||||
Text = text.Split('-')[0].Trim(),
|
||||
MatchedText = string.Join("-", text.Split('-')[1..]).Trim(),
|
||||
Text = textWithoutMatchDelimiter.Split('-')[0].Trim(),
|
||||
MatchedText = string.Join("-", textWithoutMatchDelimiter.Split('-')[1..]).Trim(),
|
||||
};
|
||||
}
|
||||
|
||||
string startingQuestionPattern = @"^(\*?[a-z]?\))|\[\s*\]|\[\*\]|\^ ";
|
||||
var text = Regex.Replace(input, startingQuestionPattern, string.Empty).Trim();
|
||||
return new LocalQuizQuestionAnswer()
|
||||
{
|
||||
Correct = isCorrect,
|
||||
|
||||
Reference in New Issue
Block a user