TriviaMD 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11a573c7c5f9f468ec7b5516223b03c82e969a8422a1e05618955e27c2362cc1
4
- data.tar.gz: 23bf44e763e2d73d21a88027a2f6e5453d0bcc5a9077d1fdf8f8549dd28e1a67
3
+ metadata.gz: 53443297da359fcb429e25eec19014ce804b445172fadfb1a4c7dc30761e805a
4
+ data.tar.gz: 8408e7e419e69586c10ccf5e356ab100a3fb9d56f22e62f2e0da7a9a3da8517f
5
5
  SHA512:
6
- metadata.gz: 231c1b0a2cdbae0012d3634f429c1e2c273666d092483ad701808d9ab092eb6ea5a6eb621cefde207282b7129cdad53b5ae03603992022352934c0f955c16d91
7
- data.tar.gz: 5082698b8f7d736fecd6402b17768587d0e15e53a891b5fbf90f6285b4eac732bf1bb11f5683938c00b792cb21a66d3ae0a8d17869b09d88aa45e1b88e618437
6
+ metadata.gz: 03ccbf020c565a1dd6f661379d7488c5c21467380e4b3195220562cab04249c3b47e5a6a6cc27a71f137784e2360f011348da9bd1a551c4479abf23ff794d3b6
7
+ data.tar.gz: 7a25d23e224033fa0938f3438ff87686ff0e708170435cffae8e9e260f0c468176a7779975bd4a91d438a366c1c9ef09b5875eb2c67b10774b4f3cb23adc5996
data/lib/quizzes_v1.rb CHANGED
@@ -39,7 +39,6 @@ class QuizzesV1
39
39
  question_text: question["question"],
40
40
  question_type: "multiple_answers_question",
41
41
  neutral_comments_html: question["reason"],
42
- neutral_comments: question["reason"],
43
42
  points_possible: 1
44
43
  }
45
44
  }
data/lib/trivia_parser.rb CHANGED
@@ -11,17 +11,17 @@ class TriviaParser
11
11
  def get_event(c)
12
12
  return { type: :event_trivia_header } if c.type == :header && c.options[:level] == 2 && c.options[:raw_text] == "Trivia"
13
13
  return { type: :event_header } if c.type == :header
14
- return { type: :event_reason, payload: { reason: parse_reason(c.children.first) } } if c.type == :p && (c.children.first.type == :codespan || c.children.first.type == :codeblock)
14
+ return { type: :event_reason, payload: { reason: parse_reason(c) } } if c.type == :codeblock
15
15
  return { type: :event_answers, payload: { answers: parse_answers(c) } } if c.type == :ul
16
16
  return { type: :event_question, payload: { question: c.children.first.children.first.value } } if c.type == :blockquote
17
17
  return { type: :no_event }
18
18
  end
19
19
 
20
20
  def parse_reason(c)
21
- if c.value.start_with?("html\n")
22
- c.value.split("html\n")[1].strip
21
+ if c.options[:lang] == "html"
22
+ c.value.strip
23
23
  else
24
- escape_html(c.value)
24
+ escape_html(c.value.strip)
25
25
  end
26
26
  end
27
27
 
@@ -51,7 +51,7 @@ class TriviaParser
51
51
 
52
52
  @doc.root.children.each do |c|
53
53
  event = get_event(c)
54
- puts [state, c.type, event] if @debug
54
+ p [state, c.type, event, c.children] if @debug
55
55
 
56
56
  case event[:type]
57
57
  when :event_trivia_header
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TriviaMD
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bence Pjatacsuk