gyazz-markup 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: b5e085e9edc178a618d908e2032af1196cc9ad13
4
- data.tar.gz: 6609495dd8f43259c613a6efab19bba93439eacd
3
+ metadata.gz: 58e314752f4b892c06667aca81310ca64bad1c8c
4
+ data.tar.gz: 2bbf2129f76d622c6e02207b76d91162ebd66259
5
5
  SHA512:
6
- metadata.gz: 1dd4d4fd7358d83b02d10b91937e1551506c40b81be9a75e7e835b657f74924d9babc3bfa14f46a49e45c6813ba3eedeb1d9a3ca01e7a74d4db7f6ca446cd53a
7
- data.tar.gz: 1c978ad9a1b417f08d6ee436b54723e2f86d00fec96de94abbbb62ea73ab877582d42743bf4a53a3d6493e9bc41b2c41318d31b35a464b73f151c86ffbf5e71b
6
+ metadata.gz: 1d83085b2af85d03ec7e21012e02757fadd89da875c3b1057bd0f3e082b6e10c51edfacd696fe45448c9bb9a7bcf20f58bb48c09bc7af43c98442b52092237db
7
+ data.tar.gz: 66e4b88eed7ab9a6869fc22dcc4e881f5258394fc1a8b6efc060713e30cb48eb25b369e3e70cd8f5ed46ce56942c3c51b9158bdf310cefec9a8b9cde2c4adf65
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.1.3 2013-04-08
2
+
3
+ * update gyazz-markup command
4
+ * list prefix option
5
+
1
6
  === 0.1.2 2013-04-08
2
7
 
3
8
  * div indent
data/README.md CHANGED
@@ -24,9 +24,14 @@ gm = GyazzMarkup::Markup.new
24
24
  puts gm.markup str
25
25
  ```
26
26
 
27
- config
27
+ options
28
28
  ```ruby
29
- gm = GyazzMarkup::Markup.new(:host => 'http://gyazz.com', :wiki => 'shokai')
29
+ gm = GyazzMarkup::Markup.new(
30
+ :host => 'http://gyazz.com',
31
+ :wiki => 'shokai'
32
+ :indent => 'div',
33
+ :prefix => '-'
34
+ )
30
35
  puts gm.markup str
31
36
  ```
32
37
 
@@ -51,7 +56,8 @@ wikilink [[shokai::かずすけ]]
51
56
  bbb2
52
57
  ```
53
58
 
54
- % gyazz-markup samples/sample.txt
59
+ % gyazz-markup --help
60
+ % gyazz-markup -i samples/sample.txt
55
61
 
56
62
  <img src="http://shokai.org/archive/file/780a435810de562eed7fc4be802ca180.png">
57
63
 
data/bin/gyazz-markup CHANGED
@@ -2,21 +2,42 @@
2
2
  # -*- coding: utf-8 -*-
3
3
  $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
4
4
  require 'rubygems'
5
-
6
5
  require 'gyazz-markup'
6
+ require 'args_parser'
7
+
8
+ parser = ArgsParser.parse ARGV do
9
+ arg :input, 'input file', :alias => :i
10
+ arg :output, 'output file', :alias => :o
11
+ arg :wiki, 'wiki name', :default => 'test'
12
+ arg :host, 'host name', :default => 'http://gyazz.com'
13
+ arg :indent, 'list indent tag'
14
+ arg :prefix, 'list prefix'
15
+ arg :help, 'show help', :alias => :h
16
+ end
7
17
 
8
- input, wiki = ARGV[0..1]
9
- unless input
10
- STDERR.puts "== gyazz-markup v#{GyazzMarkup::VERSION}"
18
+ if parser.has_option? :help or !parser.has_param? :input
19
+ STDERR.puts "gyazz-markup - convert gyazz syntax to HTML (v#{GyazzMarkup::VERSION} )"
20
+ STDERR.puts " https://github.com/shokai/gyazz-markup"
21
+ STDERR.puts parser.help
11
22
  STDERR.puts
12
- STDERR.puts " % gyazz-markup input.txt"
13
- STDERR.puts " % gyazz-markup input.txt WIKINAME"
23
+ STDERR.puts "e.g."
24
+ STDERR.puts " gyazz-markup -i input.txt"
25
+ STDERR.puts " gyazz-markup -i input.txt -wiki shokai -indent div -prefix \"-\""
14
26
  exit 1
15
27
  end
16
28
 
17
- puts '<style type="text/css">'
18
- 0.upto(5).each do |i|
19
- puts ".gyazz_indent#{i}{ margin-left : #{i*20}px; }"
29
+ if parser.has_param? :indent
30
+ puts '<style type="text/css">'
31
+ 0.upto(5).each do |i|
32
+ puts ".gyazz_indent#{i}{ margin-left : #{i*20}px; }"
33
+ end
34
+ puts '</style>'
20
35
  end
21
- puts '</style>'
22
- puts GyazzMarkup::Markup.new(:wiki => wiki, :indent => :div).markup(open(input).read)
36
+
37
+ txt = open(parser[:input]).read
38
+ puts GyazzMarkup::Markup.new(
39
+ :wiki => parser[:wiki],
40
+ :host => parser[:host],
41
+ :indent => parser[:indent],
42
+ :prefix => parser[:prefix]
43
+ ).markup(txt)
data/gyazz-markup.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "args_parser"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.3"
22
24
  spec.add_development_dependency "rake"
23
25
  spec.add_development_dependency "minitest"
@@ -35,7 +35,8 @@ module GyazzMarkup
35
35
  def markup_indent(str)
36
36
  return str unless options[:indent]
37
37
  indent_count = str.scan(/^(\s*).*$/)[0][0].size
38
- "<#{options[:indent]} class=\"gyazz_indent#{indent_count}\">#{str.strip}</#{options[:indent]}>"
38
+ prefix = "#{options[:prefix]} " if options[:prefix]
39
+ "<#{options[:indent]} class=\"gyazz_indent#{indent_count}\">#{prefix}#{str.strip}</#{options[:indent]}>"
39
40
  end
40
41
 
41
42
  def markup_image(str)
@@ -5,7 +5,8 @@ module GyazzMarkup
5
5
  {
6
6
  :host => 'http://gyazz.com',
7
7
  :wiki => 'test',
8
- :indent => nil
8
+ :indent => nil,
9
+ :prefix => nil
9
10
  }
10
11
  end
11
12
 
@@ -1,3 +1,3 @@
1
1
  module GyazzMarkup
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gyazz-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-07 00:00:00.000000000 Z
11
+ date: 2013-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: args_parser
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement