mumukit-content-type 1.8.1 → 1.9.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d40772b0c4d8e8f381ea661f5965a156a031009e11c545f4babf21537379a673
|
|
4
|
+
data.tar.gz: 6e6b7dc14f7aa6e02ad34d1663c29ac346ad464ec91bbc92ce69c9e3e6b0ca9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b2d71313b0bc72b734ddd0429d44f1f9245c782783a961b189dec687fd722084bf393899d0a1454184f522eecc70aef3073025d915bd12ecd74d4f47a92b1ec
|
|
7
|
+
data.tar.gz: 43ed8195e213794ec158e9ca952abfe9d485098a98e484fc73239810c0176750573ce03bec04cdbcd263c8a25e3d1cd4d5645e29eb597b795d32efa14853ec95
|
data/lib/mumukit/content_type.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Mumukit
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def to_html(content, options={})
|
|
12
|
-
content_html = htmlize content
|
|
12
|
+
content_html = htmlize content, options
|
|
13
13
|
content_html = Mumukit::ContentType::Sanitizer.sanitize(content_html) unless options[:skip_sanitization]
|
|
14
14
|
content_html&.html_safe
|
|
15
15
|
end
|
|
@@ -17,7 +17,18 @@ module Mumukit::ContentType::Markdown
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
class OneLinerHTML < HTML
|
|
21
|
+
def paragraph(text)
|
|
22
|
+
text
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.new_markdown(renderer)
|
|
27
|
+
Redcarpet::Markdown.new(renderer, autolink: true, fenced_code_blocks: true, no_intra_emphasis: true, tables: true)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
@@markdown = new_markdown HTML
|
|
31
|
+
@@one_liner_markdown = new_markdown OneLinerHTML
|
|
21
32
|
|
|
22
33
|
def self.title(title)
|
|
23
34
|
"**#{title}**"
|
|
@@ -35,16 +46,20 @@ module Mumukit::ContentType::Markdown
|
|
|
35
46
|
"`#{code}`"
|
|
36
47
|
end
|
|
37
48
|
|
|
38
|
-
def self.
|
|
49
|
+
def self.render_replacing_mu_logo(content, renderer)
|
|
39
50
|
mumuki_logo = '<i class="text-primary da da-mumuki"></i>'
|
|
40
|
-
|
|
51
|
+
renderer
|
|
41
52
|
.render(content)
|
|
42
53
|
.gsub('<span class="err">ム</span>', mumuki_logo)
|
|
43
54
|
.gsub('ム', mumuki_logo)
|
|
44
55
|
end
|
|
45
56
|
|
|
46
|
-
def self.htmlize(content)
|
|
47
|
-
|
|
57
|
+
def self.htmlize(content, options)
|
|
58
|
+
render_replacing_mu_logo(content, renderer_for(options)) if content
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.renderer_for(options)
|
|
62
|
+
options[:one_liner] ? @@one_liner_markdown : @@markdown
|
|
48
63
|
end
|
|
49
64
|
|
|
50
65
|
def self.name
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mumukit-content-type
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Franco Leonardo Bulgarelli
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-03-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|