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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86c218b0f1add7c6336f2a32ba68c7948511bf66c69e1d54dfdfc22ae7ae2fa8
|
4
|
+
data.tar.gz: 75e83c660a69df59a5e079d4949b07b4fe7cfb9c59fce70c475511a68fcaa9dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
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.
|
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
|
+
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
|