pettanr_simple_format 0.0.13 → 0.0.14

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDE2M2MzNTZjYjRkMGI0OTRhYzllMDM3YjUxNTgwZjBjODczNjk4ZQ==
5
- data.tar.gz: !binary |-
6
- MDQyYzQ3NTczZjdhZDhjZWJhOTg2NGIyNmRiZjk0OWQ3YTc0ZTVkMg==
2
+ SHA1:
3
+ metadata.gz: 13eaf668bad2d6bdd021a09b2a74de8cb18c68cc
4
+ data.tar.gz: 908acf82e969eda110ec57921a6cb0115895ada3
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YzNlOTExZGM0MjViZTVlZjZjNjg1OGM3NzQxY2Y0YzhiMGE0OTk0YmI5YWY2
10
- Yjk0ZDFkYWU3MzQ4M2MxNWRiZGRmZTUwZGFlMmRlZjczN2ZkZTU3MzMxMTA3
11
- ZjMyOWRmZmU1ZmVhZTQ0MjA0ZTI4NjM3OTUyNjJmMDkyODYwMGM=
12
- data.tar.gz: !binary |-
13
- NzVmMzFlOTA4NjE1MGNiYzI1MDI5MTIxZjZhYjE5NDBhZGI0NTcxNGQ5MGFi
14
- ZTZhMTg0MmRhMjU3ZDQxYmZiNWM2OTFlNTMzMWE4MjkwMjRmMzA3ZWMzMWY5
15
- MjdkYWQ1ZDI4MjE4NzhlZGIwMGMwYjcyYzA4MTVlMmFiNDQ5YmQ=
6
+ metadata.gz: 98f8487e8990e1168b9cf5d7acaea0957646e5c91b856887690f9a2d81c00d490acca6203ff1b471be1f882e347dab0f31606dbf1022142e775f369f9acdee93
7
+ data.tar.gz: 1829160f21c126a27d3e5193eccde9eeb5107608ef385b9c585ad27952246098e68d927be1b946ebdc3af6a2edd833b5c05204b3d43a54f8dec3221dcafb010b
@@ -1,2 +1,19 @@
1
1
  module PettanrSimpleFormat
2
+ class Renderer
3
+ def self.render content
4
+ self.simple_format(content)
5
+ end
6
+
7
+ def self.simple_format text
8
+ #text = Sanitize.clean(text.to_s, Sanitize::Config::RESTRICTED)
9
+ text = ERB::Util.html_escape(text.to_s)
10
+ start_tag = '<p>'
11
+ text.gsub!(/\r\n?/, "\n")
12
+ text.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline -> paragraph
13
+ text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
14
+ text.insert 0, start_tag
15
+ text.concat("</p>")
16
+ text
17
+ end
18
+ end
2
19
  end
@@ -1,3 +1,3 @@
1
1
  module PettanrSimpleFormat
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pettanr_simple_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - yasushiito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-15 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: sqlite3
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ! '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ! '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
+ dependencies: []
27
13
  description: This software is a WritingFormat plugin for PettanR
28
14
  email:
29
15
  - yasusiito@gmail.com
@@ -60,17 +46,17 @@ require_paths:
60
46
  - lib
61
47
  required_ruby_version: !ruby/object:Gem::Requirement
62
48
  requirements:
63
- - - ! '>='
49
+ - - ">="
64
50
  - !ruby/object:Gem::Version
65
51
  version: '0'
66
52
  required_rubygems_version: !ruby/object:Gem::Requirement
67
53
  requirements:
68
- - - ! '>='
54
+ - - ">="
69
55
  - !ruby/object:Gem::Version
70
56
  version: '0'
71
57
  requirements: []
72
58
  rubyforge_project:
73
- rubygems_version: 2.3.0
59
+ rubygems_version: 2.4.8
74
60
  signing_key:
75
61
  specification_version: 4
76
62
  summary: SimpleFormat for PettanR Speech