nishisuke-blog-syntax 0.1.2 → 0.1.3

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: 0f59386919e11f1189c963eacac6c12106212ca229d681e2df37d85300534d3d
4
- data.tar.gz: 4ca04e391a7bc2990ee2070c115923b4018254b85e62f0de22c1c391f8812aed
3
+ metadata.gz: 86c218b0f1add7c6336f2a32ba68c7948511bf66c69e1d54dfdfc22ae7ae2fa8
4
+ data.tar.gz: 75e83c660a69df59a5e079d4949b07b4fe7cfb9c59fce70c475511a68fcaa9dd
5
5
  SHA512:
6
- metadata.gz: c7f26032b18f8009018c06bdbb6cc587d6ed910651b5fb8f863ef4e5e70672dc1b6522661262feafff83a624213b4cf4d3cf484f36f064293341d0e184571bd4
7
- data.tar.gz: a005e9dae3ac33694aefa66bc5759c5f36809ac1bdd1f4f83467a750a87c7d84e485fb350682b118d96da23f5832876ce0e0c042888079c49472c8da55ffd2d5
6
+ metadata.gz: cccd94cec6227ea0c3e8f4f4fdd6bde09504707cc8788200aa4e640dbc3832070eed9db81692f52ad58945d8dd8af6c8650b208feac619826e827e80d8a31313
7
+ data.tar.gz: 5f38bd69cd1ca2aae819c051bd79460d79913380d9e569d2c4dd58109a2e2ab693c7f29c668e82e755140f49a24d7007d65a1e65809975b48b482aae59401f0e
@@ -0,0 +1,21 @@
1
+ require 'nishisuke_blog_syntax/formatter'
2
+
3
+ module NishisukeBlogSyntax
4
+ module Formatter
5
+ class ParagraphFormatter < FormatterBase
6
+ SUBSTITUTE_REGEXP = /^>>>(.*?)<<<$/m
7
+ PARSE_REGEXP = /^>>>(.*)<<<$/m
8
+
9
+ private
10
+
11
+ def regexp
12
+ SUBSTITUTE_REGEXP
13
+ end
14
+
15
+ def substitute(matched)
16
+ content_str = matched.match(PARSE_REGEXP)[1]
17
+ "<p>#{content_str.split("\n").join('<br>')}</p>"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ require 'nishisuke_blog_syntax/formatter'
2
+
3
+ module NishisukeBlogSyntax
4
+ module Formatter
5
+ class SubHeadlineFormatter < FormatterBase
6
+ SUBSTITUTE_REGEXP = /^## .*$/
7
+ PARSE_REGEXP = /^## (.*)$/
8
+
9
+ private
10
+
11
+ def regexp
12
+ SUBSTITUTE_REGEXP
13
+ end
14
+
15
+ def substitute(matched)
16
+ content_str = matched.match(PARSE_REGEXP)[1]
17
+ "<h2>#{content_str}</h2>"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,7 @@
1
1
  require 'nishisuke_blog_syntax/formatter/code_formatter'
2
2
  require 'nishisuke_blog_syntax/formatter/shell_formatter'
3
+ require 'nishisuke_blog_syntax/formatter/paragraph_formatter'
4
+ require 'nishisuke_blog_syntax/formatter/sub_headline_formatter'
3
5
 
4
6
  module NishisukeBlogSyntax
5
7
  class RawText
@@ -22,6 +24,8 @@ module NishisukeBlogSyntax
22
24
  @@formatters ||= [
23
25
  Formatter::ShellFormatter.new,
24
26
  Formatter::CodeFormatter.new,
27
+ Formatter::ParagraphFormatter.new,
28
+ Formatter::SubHeadlineFormatter.new,
25
29
  ]
26
30
  end
27
31
 
@@ -1,3 +1,3 @@
1
1
  module NishisukeBlogSyntax
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nishisuke-blog-syntax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nishisuke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-11 00:00:00.000000000 Z
11
+ date: 2018-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,7 +71,9 @@ files:
71
71
  - lib/nishisuke_blog_syntax.rb
72
72
  - lib/nishisuke_blog_syntax/formatter.rb
73
73
  - lib/nishisuke_blog_syntax/formatter/code_formatter.rb
74
+ - lib/nishisuke_blog_syntax/formatter/paragraph_formatter.rb
74
75
  - lib/nishisuke_blog_syntax/formatter/shell_formatter.rb
76
+ - lib/nishisuke_blog_syntax/formatter/sub_headline_formatter.rb
75
77
  - lib/nishisuke_blog_syntax/raw_text.rb
76
78
  - lib/nishisuke_blog_syntax/version.rb
77
79
  - nishisuke_blog_syntax.gemspec