pnote_client 1.0.1 → 1.1.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
- SHA1:
3
- metadata.gz: aefca9ca088bc2820cb547cc1440e8f16171f330
4
- data.tar.gz: 7f906da6182fc767d86f66f609f2125154f1e873
2
+ SHA256:
3
+ metadata.gz: 9b025808db4353d3e90385878656f10e3422c9437dd34d94a4e89bb62f3e01b7
4
+ data.tar.gz: 90c140ab343ac7d8367c212827411479d2570ac17d7a6606c585381b29867aa8
5
5
  SHA512:
6
- metadata.gz: 5206517055ab81f50e9dd8fd55c0b3b2a0ec884d92ba7503bdf5213a4ea6b038b9b85a7111bc7741c64c06463006efa2990666dd9e899e3e7776ce97533ddd25
7
- data.tar.gz: 44fcad012662f3149139acc9134ddb415fa1f981921e6f4501e2394f08913495c44ceaaa1b96885e5d7a188274b1abbe4d19be588bdb2da5c90bf9b406a1b05f
6
+ metadata.gz: 841b14e3656a5a0974c0f69adf014b97fa7bddb2cb09de954d6aef0d3b25d1749b3d30e03ca11681d1749caebd5ac36199eab9ff4efca9341713d9b4bd781a39
7
+ data.tar.gz: e9b068740e7cc0740b3d5e854b2e34a03e716ee3aa426ba3fe41ff3f5b8f4d2276470b27d930802449080ae26cb2812ece3815ef1ebe07784fd471c150922748
@@ -28,41 +28,20 @@ module PnoteClient
28
28
  @pnote_document.chapters.each do |chapter|
29
29
  chapter_hash = {
30
30
  title: chapter.title,
31
- sub_chapters: [],
32
- practices: []
31
+ sub_chapters: []
33
32
  }
34
33
  result[:chapters] << chapter_hash
35
34
 
36
- # 단원의 소단원 목록
37
- chapter.sub_chapters.each do |sub_chapter|
35
+ unless chapter.practices.empty? # 심화단원일 경우 "실전문제" 소단원 하나 만들어서 전부 넣기
38
36
  sub_chapter_hash = {
39
- title: sub_chapter.title,
40
- concepts: [],
37
+ title: '실전문제',
41
38
  exercises: [],
42
39
  practices: []
43
40
  }
44
41
  chapter_hash[:sub_chapters] << sub_chapter_hash
45
42
 
46
- sub_chapter.concepts.each do |concept|
47
- concept_hash = {
48
- title: concept.title,
49
- content: concept.content
50
- }
51
-
52
- sub_chapter_hash[:concepts] << concept_hash
53
- end
54
-
55
- sub_chapter.exercises.each do |exercise|
56
- exercise_hash = {
57
- question: exercise.question,
58
- answer: exercise.answer,
59
- explaination: exercise.explaination,
60
- choices: exercise.choices
61
- }
62
- sub_chapter_hash[:exercises] << exercise_hash
63
- end
64
-
65
- sub_chapter.practices.each do |practice|
43
+ # 심화단원의 실전 문제
44
+ chapter.practices.each do |practice|
66
45
  practice_hash = {
67
46
  question: practice.question,
68
47
  answer: practice.answer,
@@ -73,19 +52,47 @@ module PnoteClient
73
52
  }
74
53
  sub_chapter_hash[:practices] << practice_hash
75
54
  end
76
- end
55
+ else # 일반 단원일경우 소단원 채우기
56
+ chapter.sub_chapters.each do |sub_chapter|
57
+ sub_chapter_hash = {
58
+ title: sub_chapter.title,
59
+ concepts: [],
60
+ exercises: [],
61
+ practices: []
62
+ }
63
+ chapter_hash[:sub_chapters] << sub_chapter_hash
77
64
 
78
- # 단원의 실전 문제
79
- chapter.practices.each do |practice|
80
- practice_hash = {
81
- question: practice.question,
82
- answer: practice.answer,
83
- explaination: practice.explaination,
84
- teacher_comments: practice.teacher_comments.sort_by {|tc| tc.index }.map(&:content),
85
- choices: practice.choices,
86
- tip: practice.tip
87
- }
88
- chapter_hash[:practices] << practice_hash
65
+ sub_chapter.concepts.each do |concept|
66
+ concept_hash = {
67
+ title: concept.title,
68
+ content: concept.content
69
+ }
70
+
71
+ sub_chapter_hash[:concepts] << concept_hash
72
+ end
73
+
74
+ sub_chapter.exercises.each do |exercise|
75
+ exercise_hash = {
76
+ question: exercise.question,
77
+ answer: exercise.answer,
78
+ explaination: exercise.explaination,
79
+ choices: exercise.choices
80
+ }
81
+ sub_chapter_hash[:exercises] << exercise_hash
82
+ end
83
+
84
+ sub_chapter.practices.each do |practice|
85
+ practice_hash = {
86
+ question: practice.question,
87
+ answer: practice.answer,
88
+ explaination: practice.explaination,
89
+ teacher_comments: practice.teacher_comments.sort_by {|tc| tc.index }.map(&:content),
90
+ choices: practice.choices,
91
+ tip: practice.tip
92
+ }
93
+ sub_chapter_hash[:practices] << practice_hash
94
+ end
95
+ end
89
96
  end
90
97
  end
91
98
 
@@ -16,7 +16,7 @@ module PnoteClient
16
16
  end
17
17
 
18
18
  def content
19
- return "![image](#{@bin_item_id})"
19
+ return "\n![image](#{@bin_item_id})\n"
20
20
  end
21
21
 
22
22
  def textable?
@@ -37,7 +37,7 @@ module PnoteClient
37
37
  rows: rows_content
38
38
  }.to_json
39
39
 
40
- return "![table](#{json})"
40
+ return "\n![table](#{json})\n"
41
41
  end
42
42
 
43
43
  def textable?
@@ -42,7 +42,7 @@ module PnoteClient
42
42
  paragraphs << Paragraph.from_tag(pg_tag)
43
43
  end
44
44
 
45
- bin_item_tags = doc.xpath("//BINITEM")
45
+ bin_item_tags = doc.xpath("//BINITEM[@Type=Embedding]")
46
46
  bin_item_tags.each do |bin_item_tag|
47
47
  bin_items << BinaryItem.new(bin_item_tag, doc)
48
48
  end
@@ -1,3 +1,3 @@
1
1
  module PnoteClient
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pnote_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bluesh55
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-20 00:00:00.000000000 Z
11
+ date: 2019-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.6.14
151
+ rubygems_version: 2.7.8
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Convert PNote(.hml) file to json file