html-pipeline-bungo 0.4.0 → 0.5.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
  SHA1:
3
- metadata.gz: 77c3efefacb98fb699a122aaf6b73a2e70ee6903
4
- data.tar.gz: 830c25a52f62b7eeeff418e5d9970ec94e69a01a
3
+ metadata.gz: 43cf0811cb6d5b495f42fbce1c76983c59e7da07
4
+ data.tar.gz: 68f668bb184ecaffa7479367d32ddffb37e51051
5
5
  SHA512:
6
- metadata.gz: e3affbb69dcca67e1b16033f1dea598cd23361fc48e35081083dcfbd27754176468d4f26f36f209fef3560b679b44235ed81836580ce25c54970463bda8a1184
7
- data.tar.gz: fdc412a4518f0edd00ad277c3192567045d6709bf48d3d88e5ff2c5132b5f0500f3e81009dd3ee37e49daaf2b46965a3da46d766d2f3764b0cb2b66143dabf79
6
+ metadata.gz: 4c687f2a6cc7672f27cea3e5613b14311299ccbb232ffda1ccb158e68cd77f8cd259dd97772a80996eac2c6112de72968c5d529173f0ba1cd99baa5280c36793
7
+ data.tar.gz: 84addeb44ff23f3f2ceb81e38dd819ef41db96e9c86ffc27ab37efa8bdd5631fe5c0edf2916d9aa626c46e66946d355507bad19395da7655ab84c5beea285971
@@ -0,0 +1,19 @@
1
+ module HTML
2
+ class Pipeline
3
+
4
+ class BoldFilter < TextFilter
5
+ def call
6
+ bold_filter(@text)
7
+ end
8
+
9
+ private
10
+
11
+ def bold_filter(text)
12
+ text.gsub(/:([^:]+?)\!/) do |match|
13
+ "<b>#{$1}</b>"
14
+ end
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ module HTML
2
+ class Pipeline
3
+
4
+ class EmphFilter < TextFilter
5
+ def call
6
+ emph_dot_filter(@text)
7
+ end
8
+
9
+ private
10
+
11
+ def emph_dot_filter(text)
12
+ text.gsub(/:([^:]+?)\.\./) do |match|
13
+ literals = $1.split(//).map{|lt| "<span class='boten'>#{lt}</span>"}
14
+ "<span class='botenparent'>#{literals.join}</span>"
15
+ end
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ module HTML
2
+ class Pipeline
3
+ class ParagraphFilter < TextFilter
4
+
5
+ def call
6
+ paragraph_filter(@text)
7
+ end
8
+
9
+ private
10
+
11
+ def paragraph_filter(text)
12
+ "<p>#{text.gsub(/\r\n|\r|\n/, "</p><p>")}</p>"
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module HTML
2
+ class Pipeline
3
+ class RubyFilter < TextFilter
4
+
5
+ def call
6
+ ruby_filter(@text)
7
+ end
8
+
9
+ private
10
+
11
+ def ruby_filter(text)
12
+ text.gsub(/:([^:]+?)\(([^:]+?)\)/) do |match|
13
+ "<ruby><rb>#{$1}</rb><rp>(</rp><rt>#{$2}</rt><rp>)</rp></ruby>"
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -1,7 +1,7 @@
1
1
  module Html
2
2
  module Pipeline
3
3
  module Bungo
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
6
6
  end
7
7
  end
@@ -1,11 +1,17 @@
1
1
  require "html/pipeline"
2
2
  require "html/pipeline/bungo/version"
3
- require "html/pipeline/bungo/bungo_filter.rb"
3
+ require "html/pipeline/bungo/bold_filter.rb"
4
+ require "html/pipeline/bungo/emph_filter.rb"
5
+ require "html/pipeline/bungo/paragraph_filter.rb"
6
+ require "html/pipeline/bungo/ruby_filter.rb"
4
7
  require "html/pipeline/bungo/nowrap_plain_text_input_filter.rb"
5
8
 
6
9
  module Html
7
10
  module Pipeline
8
- autoload :BungoFilter, 'html/pipeline/bungo/bungo_filter'
11
+ autoload :BoldFilter, 'html/pipeline/bungo/bold_filter'
12
+ autoload :EmphFilter, 'html/pipeline/bungo/emph_filter'
13
+ autoload :ParagraphFilter, 'html/pipeline/bungo/paragraph_filter'
14
+ autoload :RubyFilter, 'html/pipeline/bungo/ruby_filter'
9
15
  autoload :NowrapPlainTextFilter, 'html/pipeline/bungo/nowrap_plain_text_input_filter'
10
16
  end
11
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline-bungo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tetuyoko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-28 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline
@@ -98,8 +98,11 @@ files:
98
98
  - bin/setup
99
99
  - html-pipeline-bungo.gemspec
100
100
  - lib/html/pipeline/bungo.rb
101
- - lib/html/pipeline/bungo/bungo_filter.rb
101
+ - lib/html/pipeline/bungo/bold_filter.rb
102
+ - lib/html/pipeline/bungo/emph_filter.rb
102
103
  - lib/html/pipeline/bungo/nowrap_plain_text_input_filter.rb
104
+ - lib/html/pipeline/bungo/paragraph_filter.rb
105
+ - lib/html/pipeline/bungo/ruby_filter.rb
103
106
  - lib/html/pipeline/bungo/version.rb
104
107
  homepage: https://github.com/tetuyoko/html-pipeline-bungo
105
108
  licenses:
@@ -1,41 +0,0 @@
1
- module HTML
2
- class Pipeline
3
- class BungoFilter < TextFilter
4
- def call
5
- html = @text
6
- html = ruby_fliter(html)
7
- html = emph_dot_fliter(html)
8
- html = bold_fliter(html)
9
- html = paragraph_fliter(html)
10
- html.rstrip!
11
- html
12
- end
13
-
14
- private
15
-
16
- def ruby_fliter(text)
17
- text.gsub(/:([^:]+?)\(([^:]+?)\)/) do |match|
18
- "<ruby><rb>#{$1}</rb><rp>(</rp><rt>#{$2}</rt><rp>)</rp></ruby>"
19
- end
20
- end
21
-
22
- def emph_dot_fliter(text)
23
- text.gsub(/:([^:]+?)\.\./) do |match|
24
- literals = $1.split(//).map{|lt| "<span class='boten'>#{lt}</span>"}
25
- "<span class='botenparent'>#{literals.join}</span>"
26
- end
27
- end
28
-
29
- def bold_fliter(text)
30
- text.gsub(/:([^:]+?)\!/) do |match|
31
- "<b>#{$1}</b>"
32
- end
33
- end
34
-
35
- def paragraph_fliter(text)
36
- "<p>#{text.gsub(/\r\n|\r|\n/, "</p><p>")}</p>"
37
- end
38
-
39
- end
40
- end
41
- end