github-to-canvas 0.1.10 → 0.1.15

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: d3bc9a9619a7d1f9433a60066075fe8e41c7a5f10c44dc54ace52615c9e5776d
4
- data.tar.gz: a39592e83cb79c15807d8acd075e9fbe263fff61a1e1e4260a7763eb795f9ae1
3
+ metadata.gz: 2fdb3495cf035026b326415c643f799389f104d417f3131504bc173756f6139b
4
+ data.tar.gz: 1e33feb5268015f1db19089686fe8c10299ec925f2b49c2c4a1f9b759fe5092f
5
5
  SHA512:
6
- metadata.gz: a3a439ee1a1d689877192742011d3e4bdf43c5cc8d7b754487280830321056a796dee3c30113816b539d23fd3fe5f7132f5ae52fcca76704ee026e913de0705f
7
- data.tar.gz: 24b47002d831b7389eced1a76fc120a9164a692f37be3984a8b078f253b2343204d5bcd8a767138d34168822291e240b5397e8ad20c001ed3ec8e1c6773e0873
6
+ metadata.gz: 4e3db83d774f1b815faf65f09b7cb63b2e76a04c80eef1671b1bf2130540a387ed89333556fc96257e56862885a3ce83670ebeb4094abd142e83b50c5dae3a5f
7
+ data.tar.gz: abe6c2dbd1ccc1e710f5ca9e32bfba5dadb7e1651ed03656115b3db1cbfc11b378d12f224a075952c87ada6411c2f989e401504290d0c8a71748adf664eef216
@@ -98,11 +98,11 @@ class CanvasInterface
98
98
  lesson_info = lesson_info[0] if lesson_info.kind_of?(Array)
99
99
  url = url.sub(/[^\/]+$/, lesson_info["page_id"].to_s)
100
100
  end
101
-
102
101
  response = RestClient.put(url, payload, headers)
103
- rescue
102
+ rescue Exception => e
104
103
  puts "Something went wrong while pushing lesson #{options[:id]} to course #{options[:course_id]}"
105
104
  puts "Make sure you are working on lessons that are not locked"
105
+ raise e
106
106
  abort
107
107
  end
108
108
  JSON.parse(response.body)
@@ -1,5 +1,5 @@
1
1
  require 'redcarpet'
2
- # require 'byebug'
2
+ require 'byebug'
3
3
  class CustomRender < Redcarpet::Render::HTML
4
4
  def block_code(code, lang)
5
5
  "<pre>" \
@@ -100,13 +100,28 @@ class RepositoryConverter
100
100
 
101
101
 
102
102
  def self.escape_existing_html(markdown)
103
- # markdown = markdown.gsub(/<\/(?!iframe)/, "&lt;/")
103
+ markdown = markdown.gsub(/```(\n|.)*```/) { |code|
104
+ # all blocks
105
+ code = code.gsub("<", "&lt;")
106
+ code = code.gsub(">", "&gt;")
107
+ }
108
+ # markdown = markdown.gsub(/(`)(.+?)(`)/) { |code|
109
+ # # all backticks
110
+
111
+ # if code.match?(/<(.*?)>/)
112
+ # code = code.gsub("<", "&lt;")
113
+ # code = code.gsub(">", "&gt;")
114
+ # end
115
+
116
+ # code
117
+ # }
104
118
  # markdown = markdown.gsub(/<(?!iframe)/, "&lt;")
105
119
  # markdown = markdown.gsub(/(?<!iframe)>/, "&gt;")
106
- # byebug
120
+
107
121
  # markdown = markdown.gsub(/```(.*?)```/) {|s|
108
122
  # byebug
109
123
  # }
124
+ markdown
110
125
  end
111
126
 
112
127
  def self.remove_header_and_footer(html)
@@ -1,3 +1,3 @@
1
1
  class GithubToCanvas
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.15"
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.1.10
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - maxwellbenton