mizuho 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
data/bin/mizuho CHANGED
@@ -5,7 +5,7 @@ require 'rubygems'
5
5
  require 'mizuho/generator'
6
6
 
7
7
  $KCODE = 'UTF-8'
8
- options = { :topbar => true }
8
+ options = { :topbar => true, :attributes => [] }
9
9
  parser = OptionParser.new do |opts|
10
10
  nl = "\n" + ' ' * 37
11
11
  opts.banner = "Usage: mizuho [options] INPUT"
@@ -37,6 +37,10 @@ parser = OptionParser.new do |opts|
37
37
  "'images/icons'.") do |value|
38
38
  options[:icons_dir] = value
39
39
  end
40
+ opts.on("-a", "--attribute=ATTRIBUTE", "Define or delete document attribute. Uses#{nl}" <<
41
+ "same syntax as asciidoc's '-a' option.") do |value|
42
+ options[:attributes] << value
43
+ end
40
44
  opts.on("-o", "--output FILE", String, "Specify the output filename.") do |value|
41
45
  options[:output] = value
42
46
  end
data/lib/mizuho.rb CHANGED
@@ -24,10 +24,10 @@ module Mizuho
24
24
  TEMPLATES_DIR = "#{SOURCE_ROOT}/templates"
25
25
  ASCIIDOC = "#{SOURCE_ROOT}/asciidoc/asciidoc.py"
26
26
 
27
- VERSION_STRING = "0.9.9"
27
+ VERSION_STRING = "0.9.10"
28
28
 
29
29
  if $LOAD_PATH.first != LIBDIR
30
30
  $LOAD_PATH.unshift(LIBDIR)
31
31
  $LOAD_PATH.uniq!
32
32
  end
33
- end if !defined?(Mizuho::SOURCE_ROOT)
33
+ end if !defined?(Mizuho::SOURCE_ROOT)
@@ -36,6 +36,7 @@ class Generator
36
36
  @id_map_file = options[:id_map] || default_id_map_filename(input)
37
37
  @icons_dir = options[:icons_dir]
38
38
  @conf_file = options[:conf_file]
39
+ @attributes = options[:attributes] || []
39
40
  @enable_topbar = options[:topbar]
40
41
  @commenting_system = options[:commenting_system]
41
42
  if @commenting_system == 'juvia'
@@ -52,7 +53,7 @@ class Generator
52
53
  warn "No ID map file, generating one (#{@id_map_file})..."
53
54
  end
54
55
  end
55
- self.class.run_asciidoc(@input_file, @output_file, @icons_dir, @conf_file)
56
+ self.class.run_asciidoc(@input_file, @output_file, @icons_dir, @conf_file, @attributes)
56
57
  transform(@output_file)
57
58
  if @commenting_system
58
59
  @id_map.save(@id_map_file)
@@ -66,7 +67,7 @@ class Generator
66
67
  end
67
68
  end
68
69
 
69
- def self.run_asciidoc(input, output, icons_dir = nil, conf_file = nil)
70
+ def self.run_asciidoc(input, output, icons_dir = nil, conf_file = nil, attributes = [])
70
71
  args = [
71
72
  "python", ASCIIDOC,
72
73
  "-b", "html5",
@@ -80,6 +81,10 @@ class Generator
80
81
  args << "-a"
81
82
  args << "iconsdir=#{icons_dir}"
82
83
  end
84
+ attributes.each do |attribute|
85
+ args << "-a"
86
+ args << attribute
87
+ end
83
88
  if conf_file
84
89
  # With the splat operator we support a string and an array of strings.
85
90
  [*conf_file].each do |cf|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mizuho
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 9
10
- version: 0.9.9
9
+ - 10
10
+ version: 0.9.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Hongli Lai