moodle2cc 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efde84072c49c29d27500a5561765dfc44e6efd1
4
- data.tar.gz: 0d4dccad78f1b425c6a2a8a07909370d8eb14648
3
+ metadata.gz: c3daa9082b4bd5b84e073f3f7df0aaa7bf2e6a41
4
+ data.tar.gz: 03628a247d0dac408fa3652352562cedd58364d9
5
5
  SHA512:
6
- metadata.gz: 4bd0763399e9e6ccf748452a816760ee551f449d50104996b59c724215c08b329bb91417c122c7d0eeb6d5de0cb2577da1b96c317cd4dbb9c71d36ccd077b75b
7
- data.tar.gz: f5a6678f1079198e8d70dbd43f134a619f9ac88395dd12015ba83bb852745c11cf2d66a28027a6b57cc737565b22ad70147929f99902c4dca1c33f7252b751f3
6
+ metadata.gz: fb774702ba2892c3bd20bff77f9b4b34f9a315934c1453918a6bd0576f266c0ade005f265240ad470264e71b6270f9ad6554e79960a45b5af6f9a957b56e7cdc
7
+ data.tar.gz: 530689ba43c0dd8b4d7a65065cc6019a54267d4524570e434d8da3d99837c31d0ab03ec5c2224e7985b5195b1bec04461b44a5ba9b9626a70078e91e94fd054c
data/Changelog CHANGED
@@ -1,3 +1,6 @@
1
+ 2014-04-09 Version 0.2.4
2
+ * Fix Moodle book conversion for titles and order
3
+
1
4
  2014-04-09 Version 0.2.3
2
5
  * Add converting of HSU forums
3
6
 
@@ -34,6 +34,7 @@ module Moodle2CC::Moodle2::Parsers
34
34
  end
35
35
  parse_module(activity_dir, book)
36
36
 
37
+ book.chapters.sort_by!{|c| c.pagenum.to_i}
37
38
  book
38
39
  end
39
40
 
@@ -19,10 +19,13 @@ module Moodle2CC
19
19
  page
20
20
  end
21
21
 
22
- if moodle_book.intro
22
+ if moodle_book.intro && moodle_book.intro.length > 0
23
23
  page = create_page(moodle_book.name)
24
24
  page.identifier = generate_unique_identifier_for_book_intro(moodle_book)
25
25
  page.body = moodle_book.intro
26
+ if pages.any?{|p| page.title == p.title}
27
+ page.title = "#{page.title} (Introduction)"
28
+ end
26
29
  pages.unshift(page)
27
30
  end
28
31
 
@@ -32,7 +35,7 @@ module Moodle2CC
32
35
  def convert_to_module_items(moodle_book)
33
36
  module_items = []
34
37
  module_items << create_title(moodle_book)
35
- module_items << create_introduction(moodle_book) if moodle_book.intro
38
+ module_items << create_introduction(moodle_book) if moodle_book.intro && moodle_book.intro.length > 0
36
39
  module_items += moodle_book.chapters.map { |chapter| create_chapter(chapter) }
37
40
  module_items
38
41
  end
@@ -30,7 +30,7 @@ module Moodle2CC
30
30
  }
31
31
 
32
32
  def generate_unique_resource_path(base_path, readable_name, file_extension = 'html')
33
- file_name_suffix = readable_name ? readable_name.downcase.strip.gsub(/\s/, '-') : ''
33
+ file_name_suffix = readable_name ? CGI::escape(readable_name.downcase.strip.gsub(/\s/, '-')) : ''
34
34
  ext = file_extension ? ".#{file_extension}" : ''
35
35
  File.join(base_path, generate_unique_identifier(), "#{file_name_suffix}#{ext}")
36
36
  end
@@ -1,3 +1,3 @@
1
1
  module Moodle2CC
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -29,7 +29,7 @@ describe Moodle2CC::Moodle2::Parsers::BookParser do
29
29
 
30
30
  it "sets subchapter to true for subchapters" do
31
31
  book = subject.parse.first
32
- chapter = book.chapters[1]
32
+ chapter = book.chapters.detect{|c| c.id == "2"}
33
33
  expect(chapter.subchapter).to be_true
34
34
  end
35
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moodle2cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Durtschi