pettanr_simple_format 0.0.1

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.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = PettanrSimpleFormat
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'PettanrSimpleFormat'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ module PettanrSimpleFormat
2
+ class ApplicationController < ::ActionController
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ require_dependency "pettanr_simple_format/application_controller"
2
+
3
+ module PettanrSimpleFormat
4
+ class WritingFormatsController < ApplicationController
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ module PettanrSimpleFormat
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PettanrSimpleFormat
2
+ module WritingFormatsHelper
3
+ end
4
+ end
@@ -0,0 +1,18 @@
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::BASIC)
9
+ start_tag = '<p>'
10
+ text.gsub!(/\r\n?/, "\n")
11
+ text.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline -> paragraph
12
+ text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
13
+ text.insert 0, start_tag
14
+ text.concat("</p>")
15
+ text
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>PettanrSimpleFormat</title>
5
+ <%= stylesheet_link_tag "pettanr_simple_format/application", :media => "all" %>
6
+ <%= javascript_include_tag "pettanr_simple_format/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,6 @@
1
+ ja:
2
+ activerecord:
3
+ models:
4
+ attributes:
5
+ pettanr_simple_format:
6
+ new:
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ PettanrSimpleFormat::Engine.routes.draw do
2
+ end
@@ -0,0 +1,8 @@
1
+ class CreatePettanrSimpleFormatRenderers < ActiveRecord::Migration
2
+ def change
3
+ create_table :pettanr_simple_format_renderers do |t|
4
+
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ {
2
+ "simple_format@pettan.com": {
3
+ "classname": "SimpleFormat",
4
+ "caption": "シンプル",
5
+ "system_picture_file": "icon.png",
6
+ "settings": {
7
+ }
8
+ }
9
+ }
data/db/work/icon.png ADDED
Binary file
@@ -0,0 +1 @@
1
+ {"simple_format@pettan.com":{"classname":"SimpleFormat","caption":"シンプル","settings":{},"system_picture_id":{"text":"iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAACr0lEQVR4nOVbWbICIQwM1juG9z8Z95j3hSJDIEuzaVf5J0s6nUzYQozxoh/G38zBns+n6H8xxsEzeWMoAVKDe+1GEgInoGX0dcmiLYTA9okmI6ByQM1wqcE9lIQQ4YhwE1AajjKaQ0mGl4iHp3Fu/HVdw42vjWPNMwkmBcz2OgeEGtQKWOF1Dgg1qAgojd8FHhLEBOxqfIKVBBEBqcPVku8hn5+UhC4B3iy7EpK5NwnYXfYcNOEgCgGk8SGEamWHhnTOLAF53J8KST6oEnBy3HPgbGqGwMneT+jZcCNgpPRbsZ9yg/SnQSsU3PsB1oTmTYQhBIiTPhSwc+JLRU7+07YnuqvArQDNRJLXdyLYtR/wDXgRsLP8UaiFwfYKGF05bk3AjJJ56sFIjhnGSfAgmh//FuOtRVCJMg9MUUBv0jXie1UjyllDCeCM0Ew+/2/eH6qmGJIEa1K1FEwlahWgNyTgBNQMt3qJa4fMVVACPF7n+uDAhYYWMAIQxmvbw1eDKFgntqI2gBCQTxzhlZGhUwKqAI/xqyrDB9H7VNVaoSHboL8Y3NjJZpgCTvQ+0eTVYK/kXbEXsXQ57DUeoZwXAZ48YAHS89b4JxpYCI0Gajw3AZqSFLVOQKrngwBEGGhOc7TjlP1YVpjlRSrIfkCayKgwqPWL+mLcQsCjgpaktac6nHIsYcN5n6ijAOvWk3QlV9vh8fRZQuLEahKcdV1dShRC7pxN7Fdgdl2QjPQcgHJoOVT0GZxNwkw0CciZ2+UgA42uAmY+X1kBUQjk+eBEJahvidVwYjhIcopqLXAiCT2oF0MlCSuJ8N4eIzKuBRIJKbaQh5VScMZqSXAthmKMHyQQrX00Zbnh+tXP5iTvDWEE1AYtYX04mWPbh5M1oC5dH/V0Nkc58Z97PF1ix7L6Hyx/wVLh6Ka1AAAAAElFTkSuQmCC"}}}
@@ -0,0 +1,5 @@
1
+ module PettanrSimpleFormat
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace PettanrSimpleFormat
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module PettanrSimpleFormat
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "pettanr_simple_format/engine"
2
+
3
+ module PettanrSimpleFormat
4
+ end
@@ -0,0 +1,10 @@
1
+ namespace :pettanr_simple_format do
2
+ desc "Import json format WritingFormat data"
3
+ task :import => :environment do
4
+ json = File.expand_path('../../../', __FILE__) + '/db/work/pettanr_simple_format.json'
5
+ puts 'Importing ' + json + "\n"
6
+ r = WritingFormat.import json
7
+ WritingFormat.disp_import_error r
8
+ end
9
+
10
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :pettanr_simple_format do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pettanr_simple_format
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - yasushiito
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: This software is a WritingFormat plugin for PettanR
47
+ email:
48
+ - yasusiito@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - app/assets/javascripts/pettanr_simple_format/application.js
54
+ - app/assets/javascripts/pettanr_simple_format/writing_formats.js
55
+ - app/assets/stylesheets/pettanr_simple_format/application.css
56
+ - app/assets/stylesheets/pettanr_simple_format/writing_formats.css
57
+ - app/controllers/pettanr_simple_format/application_controller.rb
58
+ - app/controllers/pettanr_simple_format/writing_formats_controller.rb
59
+ - app/helpers/pettanr_simple_format/application_helper.rb
60
+ - app/helpers/pettanr_simple_format/writing_formats_helper.rb
61
+ - app/models/pettanr_simple_format/renderer.rb
62
+ - app/views/layouts/pettanr_simple_format/application.html.erb
63
+ - config/locales/pettanr_simple_format.ja.yml
64
+ - config/routes.rb
65
+ - db/migrate/20130728095257_create_pettanr_simple_format_renderers.rb
66
+ - db/pettanr_simple_format.json
67
+ - db/work/icon.png
68
+ - db/work/pettanr_simple_format.json
69
+ - lib/pettanr_simple_format/engine.rb
70
+ - lib/pettanr_simple_format/version.rb
71
+ - lib/pettanr_simple_format.rb
72
+ - lib/tasks/pettanr_simple_format.rake
73
+ - lib/tasks/pettanr_simple_format_tasks.rake
74
+ - MIT-LICENSE
75
+ - Rakefile
76
+ - README.rdoc
77
+ homepage: https://github.com/yasushiito/circle_speech_balloon/wiki
78
+ licenses: []
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 1.8.25
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: SimpleFormat for PettanR Speech
101
+ test_files: []