nishisuke-blog-syntax 0.1.3 → 0.1.4
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: be771c601a7a4c581734c989b387f39ed6c7d9b5969f93ac642d55a9b8a6b000
|
4
|
+
data.tar.gz: 054141f1956bedc4aad98bad7cd20633fe8a82c66dbe46cb686aed6d07d141a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f997847397efad6ce7291bbf9e531b1fcde18136f6f5217b2422c1c29d3620751ad1e1d10ba9d3dbd46d0342133a9e88b3a3ec1944a7cc14ec0a298a8f262bae
|
7
|
+
data.tar.gz: 8c3fc227d143f9c3c3d2136be581b8e91786ba405f760d8c34039fa1545be82aaedb5039f01334f000a8494c690fa887a1809eb2536f2d23ee1df0f33eadcbe7
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'nishisuke_blog_syntax/formatter'
|
2
|
+
|
3
|
+
module NishisukeBlogSyntax
|
4
|
+
module Formatter
|
5
|
+
class HeadThreeFormatter < 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
|
+
"<h3>#{content_str}</h3>"
|
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 ListFormatter < 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
|
+
"<li>#{content_str}</li>"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -2,6 +2,8 @@ require 'nishisuke_blog_syntax/formatter/code_formatter'
|
|
2
2
|
require 'nishisuke_blog_syntax/formatter/shell_formatter'
|
3
3
|
require 'nishisuke_blog_syntax/formatter/paragraph_formatter'
|
4
4
|
require 'nishisuke_blog_syntax/formatter/sub_headline_formatter'
|
5
|
+
require 'nishisuke_blog_syntax/formatter/head_three_formatter'
|
6
|
+
require 'nishisuke_blog_syntax/formatter/list_formatter'
|
5
7
|
|
6
8
|
module NishisukeBlogSyntax
|
7
9
|
class RawText
|
@@ -26,6 +28,8 @@ module NishisukeBlogSyntax
|
|
26
28
|
Formatter::CodeFormatter.new,
|
27
29
|
Formatter::ParagraphFormatter.new,
|
28
30
|
Formatter::SubHeadlineFormatter.new,
|
31
|
+
Formatter::HeadThreeFormatter.new,
|
32
|
+
Formatter::ListFormatter.new,
|
29
33
|
]
|
30
34
|
end
|
31
35
|
|
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.4
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,6 +71,8 @@ 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/head_three_formatter.rb
|
75
|
+
- lib/nishisuke_blog_syntax/formatter/list_formatter.rb
|
74
76
|
- lib/nishisuke_blog_syntax/formatter/paragraph_formatter.rb
|
75
77
|
- lib/nishisuke_blog_syntax/formatter/shell_formatter.rb
|
76
78
|
- lib/nishisuke_blog_syntax/formatter/sub_headline_formatter.rb
|