class GithubToCanvasQuiz::Parser::Markdown::Quiz
Parses a markdown file and returns a Quiz
Public Instance Methods
parse()
click to toggle source
# File lib/github_to_canvas_quiz/parser/markdown/quiz.rb, line 10 def parse Model::Quiz.new( course_id: frontmatter['course_id'], id: frontmatter['id'], repo: frontmatter['repo'], title: title, description: description ) end
Private Instance Methods
description()
click to toggle source
Description - rest of document after the first H1
# File lib/github_to_canvas_quiz/parser/markdown/quiz.rb, line 34 def description scanner = Helpers::NodeScanner.new(html) scanner.scan_until('h1') scanner.scan_rest.to_html.strip end
html()
click to toggle source
Convert the markdown to HTML for scanning
# File lib/github_to_canvas_quiz/parser/markdown/quiz.rb, line 23 def html @html ||= MarkdownConverter.new(markdown).to_html end
title()
click to toggle source
Title - contents of first H1
# File lib/github_to_canvas_quiz/parser/markdown/quiz.rb, line 28 def title scanner = Helpers::NodeScanner.new(html) scanner.scan_until('h1').last.content end