gyazz-markup 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +5 -0
- data/README.md +9 -3
- data/bin/gyazz-markup +32 -11
- data/gyazz-markup.gemspec +2 -0
- data/lib/gyazz-markup/markup.rb +2 -1
- data/lib/gyazz-markup/options.rb +2 -1
- data/lib/gyazz-markup/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58e314752f4b892c06667aca81310ca64bad1c8c
|
4
|
+
data.tar.gz: 2bbf2129f76d622c6e02207b76d91162ebd66259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d83085b2af85d03ec7e21012e02757fadd89da875c3b1057bd0f3e082b6e10c51edfacd696fe45448c9bb9a7bcf20f58bb48c09bc7af43c98442b52092237db
|
7
|
+
data.tar.gz: 66e4b88eed7ab9a6869fc22dcc4e881f5258394fc1a8b6efc060713e30cb48eb25b369e3e70cd8f5ed46ce56942c3c51b9158bdf310cefec9a8b9cde2c4adf65
|
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -24,9 +24,14 @@ gm = GyazzMarkup::Markup.new
|
|
24
24
|
puts gm.markup str
|
25
25
|
```
|
26
26
|
|
27
|
-
|
27
|
+
options
|
28
28
|
```ruby
|
29
|
-
gm = GyazzMarkup::Markup.new(
|
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
|
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
|
-
|
9
|
-
|
10
|
-
STDERR.puts "
|
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 "
|
13
|
-
STDERR.puts "
|
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
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
22
|
-
|
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"
|
data/lib/gyazz-markup/markup.rb
CHANGED
@@ -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
|
-
"
|
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)
|
data/lib/gyazz-markup/options.rb
CHANGED
data/lib/gyazz-markup/version.rb
CHANGED
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.
|
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-
|
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
|