rmake-notation 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -21,6 +21,21 @@ Gemをインストールして使ってください。
21
21
 
22
22
  $ gem install rmake-notation
23
23
 
24
+ Railsで使う際は、controllerに以下のように記述しています。helperに定義してもよいでしょう。
25
+
26
+ def generate_contents(content)
27
+ @rmake_notation ||= Object.new.extend Rmake::Notation
28
+ @rmake_notation.generate_contents(content)
29
+ end
30
+
31
+ helper_method :generate_contents
32
+
33
+ ## LICENSE
34
+
35
+ MIT License
36
+
37
+ Copyright (c) 2013 Rmake Developers
38
+
24
39
  ## TODO
25
40
 
26
41
  - specを書く(それに伴いテストしやすい構造に変更する)
@@ -1,5 +1,5 @@
1
1
  module Rmake
2
2
  module Notation
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -23,6 +23,17 @@ module Rmake::Notation
23
23
  message += err.backtrace.join("\n")
24
24
  message += "文章にエラーもしくは不正な文字が含まれているようです。確認してください。"
25
25
  end
26
+
27
+ def add_plugin(plugin)
28
+ @plugins ||= []
29
+
30
+ if (plugin.respond_to?(:target?) && plugin.respond_to?(:execute))
31
+ @plugins << plugin
32
+ true
33
+ else
34
+ false
35
+ end
36
+ end
26
37
 
27
38
  def to_blocks(content)
28
39
  contents = Array.new
@@ -317,8 +328,13 @@ EOS
317
328
  end
318
329
 
319
330
  else
320
- result = "[" + parsed_block.join(" ") + "]"
321
- result
331
+
332
+ result = execute_plugins(command, parsed_block)
333
+ if result
334
+
335
+ else
336
+ result = "[" + parsed_block.join(" ") + "]"
337
+ end
322
338
  end
323
339
 
324
340
  result
@@ -326,6 +342,22 @@ EOS
326
342
  "<div style=\"color:red;font-weight:bold;\">記述に間違いがあります: [" + parsed_block.join(" ") + "]</div>"
327
343
  end
328
344
 
345
+ def execute_plugins(command, parsed_block)
346
+ result = false
347
+
348
+ @plugins ||= []
349
+ @plugins.each do |plugin|
350
+ if plugin.target?(command)
351
+ result = plugin.execute(command, parsed_block)
352
+ break
353
+ end
354
+ end
355
+
356
+ result
357
+ rescue => err
358
+ parsed_block << "{{プラグインのエラー}}"
359
+ end
360
+
329
361
  def inline_to_html_from_block(block)
330
362
  block.gsub!(/[\[].*?[\]]/) {|s|
331
363
  s = self.inline_to_html(self.parse_inline(s))
data/lib/rmake-util.rb CHANGED
@@ -44,6 +44,3 @@ class Numeric #:nodoc:
44
44
  end
45
45
  end
46
46
 
47
- module Rmake::Util
48
- end
49
-
@@ -2,7 +2,7 @@
2
2
  require File.expand_path('../lib/rmake-notation/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["akasata", "Rmake Co., Ltd."]
5
+ gem.authors = ["Rmake Developers"]
6
6
  gem.email = ["akasata@rmake.net"]
7
7
  gem.description = %q{A simple wiki engine for Rmake. }
8
8
  gem.summary = %q{A simple wiki engine}
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmake-notation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - akasata
9
- - Rmake Co., Ltd.
8
+ - Rmake Developers
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-02-21 00:00:00.000000000 Z
12
+ date: 2013-02-22 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rspec
@@ -37,7 +36,6 @@ extra_rdoc_files: []
37
36
  files:
38
37
  - .gitignore
39
38
  - Gemfile
40
- - LICENSE
41
39
  - README.md
42
40
  - Rakefile
43
41
  - lib/rmake-notation.rb
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2013 TODO: Write your name
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.