github-to-canvas 0.0.43 → 0.0.44

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
  SHA256:
3
- metadata.gz: 6e37325db45799844237ba747240be9e85d677e9dc1289836c01205e51cd9f4f
4
- data.tar.gz: cad741664204320b94a578ab4e617afd8c4b0e8e209c8ead9e8b91493d97b693
3
+ metadata.gz: 8b61892e1b9cb865805407fb6be99f32272c3b30a3e82b463b265ee08d9f129f
4
+ data.tar.gz: 945b3501b5ccd9da9fade3f3e8dc941a3e18e7f643f9478a6eab09c12f199018
5
5
  SHA512:
6
- metadata.gz: 45753e9af5e7da01e1daccb8b89fe76d3edd6bda219cc47c6662d03e047e7ce323b0d2270fbc04120a2f7b57224f9eea31f3bade71a3a5d2fbddf4278f73dac2
7
- data.tar.gz: 95c4ce9a722bd3ce2e8e4f9ec9ea933fbf92ad627f29719c02ce8fc7b547616baed012b26059d91b6e6d3df8d60b52b74f7b8587a7589237c80c740cda1f177f
6
+ metadata.gz: 00fb2c6010207bda79a45b1035e76ed4eb7af0452f83bfd827227bd704d908c13431d4cf089e1991ae5a025e273b9feaf32dc9b41664478fb79dfc614b40bf70
7
+ data.tar.gz: 93439fa450f1ffbabe96d4a2f44048841d2064cdb0627ba896eb775b35faca653de201a7d284e018f21ea2a1fadc950b71556a5d6ffc6623bded98e115014673
@@ -129,11 +129,20 @@ end
129
129
 
130
130
  if !options[:name]
131
131
  if options[:file_to_convert]
132
- options[:name] = options[:file_to_convert]
132
+ markdown = File.read("#{Dir.pwd}/#{options[:file_to_convert]}")
133
+ if markdown.match?(/^# .+?\n\n/)
134
+ options[:name] = markdown.match(/^# .+?\n\n/)[0].strip.gsub("# ","").gsub("#","")
135
+ elsif markdown.match?(/^# .+?\n/)
136
+ options[:name] = markdown.match(/^# .+?\n/)[0].strip.gsub("# ","").gsub("#","")
137
+ else
138
+ options[:name] = options[:file_to_convert]
139
+ end
133
140
  else
134
141
  markdown = File.read("#{Dir.pwd}/README.md")
135
142
  if markdown.match?(/^# .+?\n\n/)
136
- options[:name] = markdown.match(/^# .+?\n\n/)[0].strip.slice(2,markdown.length)
143
+ options[:name] = markdown.match(/^# .+?\n\n/)[0].strip.gsub("# ","").gsub("#","")
144
+ elsif markdown.match?(/^# .+?\n/)
145
+ options[:name] = markdown.match(/^# .+?\n/)[0].strip.gsub("# ","").gsub("#","")
137
146
  else
138
147
  options[:name] = File.basename(Dir.getwd)
139
148
  end
@@ -58,7 +58,8 @@ class CanvasInterface
58
58
  index = nil
59
59
  end
60
60
  end
61
-
61
+ puts ""
62
+ puts ""
62
63
  puts "Info for Course #{course} from #{ENV['CANVAS_API_PATH']}"
63
64
  puts ""
64
65
  puts "## Pages ##"
@@ -11,7 +11,8 @@ class RepositoryConverter
11
11
  end
12
12
 
13
13
  def self.remove_header(readme)
14
- readme.gsub(/^# .+?\n\n/,"")
14
+ readme.gsub!(/^# .+?\n\n/,"")
15
+ readme.gsub(/^# .+?\n/,"")
15
16
  end
16
17
 
17
18
  def self.remove_footer(readme)
@@ -40,27 +41,27 @@ class RepositoryConverter
40
41
  end
41
42
 
42
43
  def self.adjust_local_markdown_images(readme, raw_remote_url, branch)
43
- readme.gsub!(/\!\[.+\]\(.+\)/) {|image|
44
- if !image.match('amazonaws.com') && !image.match('https://') && !image.match('youtube')
45
- image.gsub!(/\(.+\)/) { |path|
44
+ readme.gsub!(/\!\[.+\]\(.+\)/) {|image_markdown|
45
+ if !image_markdown.match?('amazonaws.com') && !image_markdown.match?('https://') && !image_markdown.match?('http://') && !image_markdown.match?('youtube')
46
+ image_markdown.gsub!(/\(.+\)/) { |path|
46
47
  path.delete_prefix!("(")
47
48
  path.delete_suffix!(")")
48
49
  "(" + raw_remote_url + "/#{branch}/" + path + ")"
49
50
  }
50
51
  end
51
- image
52
+ image_markdown
52
53
  }
53
54
  end
54
55
 
55
56
  def self.adjust_local_html_images(readme, raw_remote_url)
56
- readme.gsub!(/src=\"[\s\S]*?" /) { |img|
57
- if !img.match('amazonaws.com') && !img.match('https://') && !img.match('youtube')
58
- img.gsub!(/\"/, "")
59
- img.gsub!(/src=/, '')
60
- img.strip!
61
- 'src="' + raw_remote_url + '/master/' + img + '"'
57
+ readme.gsub!(/src=\"[\s\S]*?"/) { |image_source|
58
+ if !image_source.match?('amazonaws.com') && !image_source.match?('https://') && !image_source.match?('http://') && !image_source.match?('youtube')
59
+ image_source.gsub!(/\"/, "")
60
+ image_source.gsub!(/src=/, '')
61
+ image_source.strip!
62
+ 'src="' + raw_remote_url + '/master/' + image_source + '"'
62
63
  else
63
- img
64
+ image_source
64
65
  end
65
66
  }
66
67
  end
@@ -1,3 +1,3 @@
1
1
  class GithubToCanvas
2
- VERSION = "0.0.43"
2
+ VERSION = "0.0.44"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-to-canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - maxwellbenton