mumukit-content-type 1.8.1 → 1.9.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
2
  SHA256:
3
- metadata.gz: 2639ef97bf0f0aa18b30ecf68e13c00ff35489817185eb33cb4994cc4d3c34d5
4
- data.tar.gz: 757d5badf75ff9a5ee8e799308e155a39a5049ed98e077e8a8fd1c1b0d212397
3
+ metadata.gz: d40772b0c4d8e8f381ea661f5965a156a031009e11c545f4babf21537379a673
4
+ data.tar.gz: 6e6b7dc14f7aa6e02ad34d1663c29ac346ad464ec91bbc92ce69c9e3e6b0ca9e
5
5
  SHA512:
6
- metadata.gz: dcfbd78109450fc46f919108c3e98be2039f2de51855897f1577708c63cb6de474d78c37baa4dbc1a6176970cdbb5a56b8a5860f071cdf840889d1586b190d04
7
- data.tar.gz: dff6bbc9434d06e3ada387b3a911b150bf17e815d709e3476f9696458f57c3dc47d20a6f0047b36dd5c964de426cc073a31b23cfe92dfe5145bed6aa713899a4
6
+ metadata.gz: 0b2d71313b0bc72b734ddd0429d44f1f9245c782783a961b189dec687fd722084bf393899d0a1454184f522eecc70aef3073025d915bd12ecd74d4f47a92b1ec
7
+ data.tar.gz: 43ed8195e213794ec158e9ca952abfe9d485098a98e484fc73239810c0176750573ce03bec04cdbcd263c8a25e3d1cd4d5645e29eb597b795d32efa14853ec95
@@ -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
@@ -9,11 +9,11 @@ module Mumukit::ContentType::Html
9
9
  "<pre>#{code}</pre>"
10
10
  end
11
11
 
12
- def self.htmlize(content)
12
+ def self.htmlize(content, _options)
13
13
  content
14
14
  end
15
15
 
16
16
  def self.name
17
17
  'html'
18
18
  end
19
- end
19
+ end
@@ -17,7 +17,18 @@ module Mumukit::ContentType::Markdown
17
17
  end
18
18
  end
19
19
 
20
- @@markdown = Redcarpet::Markdown.new(HTML, autolink: true, fenced_code_blocks: true, no_intra_emphasis: true, tables: true)
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.replace_mu_logo(content)
49
+ def self.render_replacing_mu_logo(content, renderer)
39
50
  mumuki_logo = '<i class="text-primary da da-mumuki"></i>'
40
- @@markdown
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
- replace_mu_logo(content) if content
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
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module ContentType
3
- VERSION = '1.8.1'
3
+ VERSION = '1.9.0'
4
4
  end
5
5
  end
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.8.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: 2019-09-03 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler