mizuho 0.9.17 → 0.9.18

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.tar.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJRfUauAAoJECrHRaUKISqM09MH/j1sGYjLful9ErhMCzipuxzC
6
- HI20E2ip8CmXyZS9eN+nyuKAm2K+joXu2crU/9PvnS50BagLDlIwJWexLir2oY2W
7
- 8EyhM0QN76hUThVLpTnVFvW5c3na0i3PhLyNOLPb900+zA49c4R1IU9dnQ7DvKDd
8
- Z9nih2YHqzuPcX3eEWW4dO/8AwpD9BOLd+3HWCEr61n29++IQLFzJiWFwZJ+6zN9
9
- 6hkU735x7l1ACL8VyBL0PJws7Ohz32fxsTnClack2etTzGJCrKP/IGquLDxTtgxO
10
- 1pVkhvWl/yklD3QdNtEjlSWq1PjTxh4VS77HYsKeaCDqP+YxMJ3D3uvmfdOJfOo=
11
- =XKeh
5
+ iQEcBAABAgAGBQJRfZGvAAoJECrHRaUKISqMZA0H/2pCwpt1nTW5DD/1qT36IEmX
6
+ NnRePYM6El9Ccd7ZyhcThTTMpm6yp2Ao3hZMXGNh1UNdLwjvkaAoJBJC8Cvq5ckZ
7
+ rJlvPrVJPoxlT3JSnp8J59siWIBWQwkXqskHUGXWBYJ1sjvoTXw7svNwj0HIvZwP
8
+ d9qV1uOmCxCMiWt6HQjCa+74avVXAPQRzwqBfBBIxVRG2IqhRq+XdeyAWZ2qasVi
9
+ /t6eUR5EamygYbABgYWdSoOmP0E6ZVF3uti+ihiZ/KFr574s9+o7J35DByrZwTj8
10
+ JO167i04pKm1Ot2Unmi+bjTD8BGtom7VqQOZBATS16Z4Hvef52ul6cpxKADHZeM=
11
+ =0j4v
12
12
  -----END PGP SIGNATURE-----
data/Rakefile CHANGED
@@ -1,6 +1,273 @@
1
1
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/lib"))
2
2
  require 'mizuho'
3
3
 
4
+ # Implements a simple preprocessor language:
5
+ #
6
+ # Today
7
+ # #if @today == :fine
8
+ # is a fine day.
9
+ # #elif @today == :good
10
+ # is a good day.
11
+ # #else
12
+ # is a sad day.
13
+ # #endif
14
+ # Let's go walking.
15
+ #
16
+ # When run with...
17
+ #
18
+ # Preprocessor.new.start('input.txt', 'output.txt', :today => :fine)
19
+ #
20
+ # ...will produce:
21
+ #
22
+ # Today
23
+ # is a fine day.
24
+ # Let's go walking.
25
+ #
26
+ # Highlights:
27
+ #
28
+ # * #if blocks can be nested.
29
+ # * Expressions are Ruby expressions, evaluated within the binding of a
30
+ # Preprocessor::Evaluator object.
31
+ # * Text inside #if/#elif/#else are automatically unindented.
32
+ class Preprocessor
33
+ def initialize
34
+ @indentation_size = 4
35
+ @debug = boolean_option('DEBUG')
36
+ end
37
+
38
+ def start(filename, output_filename, variables = {})
39
+ if output_filename
40
+ temp_output_filename = "#{output_filename}._new"
41
+ output = File.open(temp_output_filename, 'w')
42
+ else
43
+ output = STDOUT
44
+ end
45
+ the_binding = create_binding(variables)
46
+ context = []
47
+ @lineno = 1
48
+ @indentation = 0
49
+
50
+ each_line(filename) do |line|
51
+ debug("context=#{context.inspect}, line=#{line.inspect}")
52
+
53
+ name, args_string, cmd_indentation = recognize_command(line)
54
+ case name
55
+ when "if"
56
+ case context.last
57
+ when nil, :if_true, :else_true
58
+ check_indentation(cmd_indentation)
59
+ result = the_binding.eval(args_string, filename, @lineno)
60
+ context.push(result ? :if_true : :if_false)
61
+ inc_indentation
62
+ when :if_false, :else_false, :if_ignore
63
+ check_indentation(cmd_indentation)
64
+ inc_indentation
65
+ context.push(:if_ignore)
66
+ else
67
+ terminate "#if is not allowed in this context"
68
+ end
69
+ when "elif"
70
+ case context.last
71
+ when :if_true
72
+ dec_indentation
73
+ check_indentation(cmd_indentation)
74
+ inc_indentation
75
+ context[-1] = :if_false
76
+ when :if_false
77
+ dec_indentation
78
+ check_indentation(cmd_indentation)
79
+ inc_indentation
80
+ result = the_binding.eval(args_string, filename, @lineno)
81
+ context[-1] = result ? :if_true : :if_false
82
+ when :else_true, :else_false
83
+ terminate "#elif is not allowed after #else"
84
+ when :if_ignore
85
+ dec_indentation
86
+ check_indentation(cmd_indentation)
87
+ inc_indentation
88
+ else
89
+ terminate "#elif is not allowed outside #if block"
90
+ end
91
+ when "else"
92
+ case context.last
93
+ when :if_true
94
+ dec_indentation
95
+ check_indentation(cmd_indentation)
96
+ inc_indentation
97
+ context[-1] = :else_false
98
+ when :if_false
99
+ dec_indentation
100
+ check_indentation(cmd_indentation)
101
+ inc_indentation
102
+ context[-1] = :else_true
103
+ when :else_true, :else_false
104
+ terminate "it is not allowed to have multiple #else clauses in one #if block"
105
+ when :if_ignore
106
+ dec_indentation
107
+ check_indentation(cmd_indentation)
108
+ inc_indentation
109
+ else
110
+ terminate "#else is not allowed outside #if block"
111
+ end
112
+ when "endif"
113
+ case context.last
114
+ when :if_true, :if_false, :else_true, :else_false, :if_ignore
115
+ dec_indentation
116
+ check_indentation(cmd_indentation)
117
+ context.pop
118
+ else
119
+ terminate "#endif is not allowed outside #if block"
120
+ end
121
+ when "", nil
122
+ # Either a comment or not a preprocessor command.
123
+ case context.last
124
+ when nil, :if_true, :else_true
125
+ output.puts(unindent(line))
126
+ else
127
+ # Check indentation but do not output.
128
+ unindent(line)
129
+ end
130
+ else
131
+ terminate "Unrecognized preprocessor command ##{name.inspect}"
132
+ end
133
+
134
+ @lineno += 1
135
+ end
136
+ ensure
137
+ if output_filename && output
138
+ output.close
139
+ stat = File.stat(filename)
140
+ File.chmod(stat.mode, temp_output_filename)
141
+ File.chown(stat.uid, stat.gid, temp_output_filename) rescue nil
142
+ File.rename(temp_output_filename, output_filename)
143
+ end
144
+ end
145
+
146
+ private
147
+ UBUNTU_DISTRIBUTIONS = {
148
+ "lucid" => "10.04",
149
+ "maverick" => "10.10",
150
+ "natty" => "11.04",
151
+ "oneiric" => "11.10",
152
+ "precise" => "12.04",
153
+ "quantal" => "12.10",
154
+ "raring" => "13.04",
155
+ "saucy" => "13.10"
156
+ }
157
+
158
+ class Evaluator
159
+ def _infer_distro_table(name)
160
+ if UBUNTU_DISTRIBUTIONS.has_key?(name)
161
+ return UBUNTU_DISTRIBUTIONS
162
+ end
163
+ end
164
+
165
+ def is_distribution?(expr)
166
+ if @distribution.nil?
167
+ raise "The :distribution variable must be set"
168
+ else
169
+ if expr =~ /^(>=|>|<=|<|==|\!=)[\s]*(.+)/
170
+ comparator = $1
171
+ name = $2
172
+ else
173
+ raise "Invalid expression #{expr.inspect}"
174
+ end
175
+
176
+ table1 = _infer_distro_table(@distribution)
177
+ table2 = _infer_distro_table(name)
178
+ raise "Distribution name #{@distribution.inspect} not recognized" if !table1
179
+ raise "Distribution name #{name.inspect} not recognized" if !table2
180
+ v1 = table1[@distribution]
181
+ v2 = table2[name]
182
+
183
+ case comparator
184
+ when ">"
185
+ return v1 > v2
186
+ when ">="
187
+ return v1 >= v2
188
+ when "<"
189
+ return v1 < v2
190
+ when "<="
191
+ return v1 <= v2
192
+ when "=="
193
+ return v1 == v2
194
+ when "!="
195
+ return v1 != v2
196
+ else
197
+ raise "BUG"
198
+ end
199
+ end
200
+ end
201
+ end
202
+
203
+ def each_line(filename)
204
+ File.open(filename, 'r') do |f|
205
+ while true
206
+ begin
207
+ line = f.readline.chomp
208
+ rescue EOFError
209
+ break
210
+ end
211
+ yield line
212
+ end
213
+ end
214
+ end
215
+
216
+ def recognize_command(line)
217
+ if line =~ /^([\s\t]*)#(.+)/
218
+ indentation_str = $1
219
+ command = $2
220
+ name = command.scan(/^\w+/).first
221
+ args_string = command.sub(/^#{Regexp.escape(name)}[\s\t]*/, '')
222
+ return [name, args_string, indentation_str.to_s.size]
223
+ else
224
+ return nil
225
+ end
226
+ end
227
+
228
+ def create_binding(variables)
229
+ object = Evaluator.new
230
+ variables.each_pair do |key, val|
231
+ object.send(:instance_variable_set, "@#{key}", val)
232
+ end
233
+ return object.instance_eval do
234
+ binding
235
+ end
236
+ end
237
+
238
+ def inc_indentation
239
+ @indentation += @indentation_size
240
+ end
241
+
242
+ def dec_indentation
243
+ @indentation -= @indentation_size
244
+ end
245
+
246
+ def check_indentation(expected)
247
+ if expected != @indentation
248
+ terminate "wrong indentation: found #{expected} characters, should be #{@indentation}"
249
+ end
250
+ end
251
+
252
+ def unindent(line)
253
+ line =~ /^([\s\t]*)/
254
+ found = $1.to_s.size
255
+ if found >= @indentation
256
+ return line[@indentation .. -1]
257
+ else
258
+ terminate "wrong indentation: found #{found} characters, should be at least #{@indentation}"
259
+ end
260
+ end
261
+
262
+ def debug(message)
263
+ puts "DEBUG:#{@lineno}: #{message}" if @debug
264
+ end
265
+
266
+ def terminate(message)
267
+ abort "*** ERROR: line #{@lineno}: #{message}"
268
+ end
269
+ end
270
+
4
271
  def string_option(name, default_value = nil)
5
272
  value = ENV[name]
6
273
  if value.nil? || value.empty?
@@ -19,7 +286,7 @@ def boolean_option(name, default_value = false)
19
286
  end
20
287
  end
21
288
 
22
- def recursive_copy_files(files, destination_dir)
289
+ def recursive_copy_files(files, destination_dir, preprocess = false, variables = {})
23
290
  require 'fileutils' if !defined?(FileUtils)
24
291
  files.each_with_index do |filename, i|
25
292
  dir = File.dirname(filename)
@@ -27,7 +294,14 @@ def recursive_copy_files(files, destination_dir)
27
294
  FileUtils.mkdir_p("#{destination_dir}/#{dir}")
28
295
  end
29
296
  if !File.directory?(filename)
30
- FileUtils.install(filename, "#{destination_dir}/#{filename}")
297
+ if preprocess && filename =~ /\.pp$/
298
+ real_filename = filename.sub(/\.pp$/, '')
299
+ FileUtils.install(filename, "#{destination_dir}/#{real_filename}")
300
+ Preprocessor.new.start(filename, "#{destination_dir}/#{real_filename}",
301
+ variables)
302
+ else
303
+ FileUtils.install(filename, "#{destination_dir}/#{filename}")
304
+ end
31
305
  end
32
306
  printf "\r[%5d/%5d] [%3.0f%%] Copying files...", i + 1, files.size, i * 100.0 / files.size
33
307
  STDOUT.flush
@@ -39,11 +313,16 @@ def create_debian_package_dir(distribution)
39
313
  require 'mizuho/packaging'
40
314
  require 'time'
41
315
 
316
+ variables = {
317
+ :distribution => distribution
318
+ }
319
+
42
320
  sh "rm -rf #{PKG_DIR}/#{distribution}"
43
321
  sh "mkdir -p #{PKG_DIR}/#{distribution}"
44
322
  recursive_copy_files(Dir[*MIZUHO_FILES] - Dir[*MIZUHO_DEBIAN_EXCLUDE_FILES],
45
323
  "#{PKG_DIR}/#{distribution}")
46
- recursive_copy_files(Dir["debian/**/*"], "#{PKG_DIR}/#{distribution}")
324
+ recursive_copy_files(Dir["debian/**/*"], "#{PKG_DIR}/#{distribution}",
325
+ true, variables)
47
326
  changelog = File.read("#{PKG_DIR}/#{distribution}/debian/changelog")
48
327
  changelog =
49
328
  "mizuho (#{Mizuho::VERSION_STRING}-1~#{distribution}1) #{distribution}; urgency=low\n" +
@@ -80,14 +359,7 @@ task 'package:release' do
80
359
  end
81
360
  end
82
361
 
83
- # Dev
84
- # remake tarball
85
- # make package
86
- # Production
87
- # use existing tarball or make new
88
- # make package
89
-
90
- task 'package:debian:orig_tarball' do
362
+ task 'debian:orig_tarball' do
91
363
  if File.exist?("#{PKG_DIR}/mizuho_#{Mizuho::VERSION_STRING}.orig.tar.gz")
92
364
  puts "Debian orig tarball #{PKG_DIR}/mizuho_#{Mizuho::VERSION_STRING}.orig.tar.gz already exists."
93
365
  else
@@ -95,33 +367,46 @@ task 'package:debian:orig_tarball' do
95
367
 
96
368
  sh "rm -rf #{PKG_DIR}/#{BASENAME}"
97
369
  sh "mkdir -p #{PKG_DIR}/#{BASENAME}"
98
- recursive_copy_files(Dir[*MIZUHO_FILES] - Dir[*MIZUHO_DEBIAN_EXCLUDE_FILES],
99
- "#{PKG_DIR}/#{BASENAME}")
370
+ recursive_copy_files(
371
+ Dir[*MIZUHO_FILES] - Dir[*MIZUHO_DEBIAN_EXCLUDE_FILES],
372
+ "#{PKG_DIR}/#{BASENAME}"
373
+ )
100
374
  sh "cd #{PKG_DIR} && tar -c #{BASENAME} | gzip --best > #{BASENAME}.orig.tar.gz"
101
375
  end
102
376
  end
103
377
 
104
378
  desc "Build a Debian package for local testing"
105
- task 'package:debian:dev' do
106
- sh "dpkg-checkbuilddeps"
379
+ task 'debian:dev' do
107
380
  sh "rm -f #{PKG_DIR}/mizuho_#{Mizuho::VERSION_STRING}.orig.tar.gz"
108
- Rake::Task["package:debian:clean"].invoke
109
- Rake::Task["package:debian:orig_tarball"].invoke
110
- create_debian_package_dir("dev")
111
- sh "cd #{PKG_DIR}/dev && debuild -us -uc"
381
+ Rake::Task["debian:clean"].invoke
382
+ Rake::Task["debian:orig_tarball"].invoke
383
+ if distro = string_option('DISTRO')
384
+ distributions = [distro]
385
+ else
386
+ distributions = DISTRIBUTIONS
387
+ end
388
+ distributions.each do |distribution|
389
+ create_debian_package_dir(distribution)
390
+ sh "cd #{PKG_DIR}/#{distribution} && dpkg-checkbuilddeps"
391
+ end
392
+ distributions.each do |distribution|
393
+ sh "cd #{PKG_DIR}/#{distribution} && debuild -F -us -uc"
394
+ end
112
395
  end
113
396
 
114
397
  desc "Build Debian multiple source packages to be uploaded to repositories"
115
- task 'package:debian:production' => 'package:debian:orig_tarball' do
116
- sh "dpkg-checkbuilddeps"
398
+ task 'debian:production' => 'debian:orig_tarball' do
117
399
  DISTRIBUTIONS.each do |distribution|
118
400
  create_debian_package_dir(distribution)
401
+ sh "cd #{PKG_DIR}/#{distribution} && dpkg-checkbuilddeps"
402
+ end
403
+ DISTRIBUTIONS.each do |distribution|
119
404
  sh "cd #{PKG_DIR}/#{distribution} && debuild -S -k0x0A212A8C"
120
405
  end
121
406
  end
122
407
 
123
408
  desc "Clean Debian packaging products, except for orig tarball"
124
- task 'package:debian:clean' do
409
+ task 'debian:clean' do
125
410
  files = Dir["#{PKG_DIR}/*.{changes,build,deb,dsc,upload}"]
126
411
  sh "rm -f #{files.join(' ')}"
127
412
  sh "rm -rf #{PKG_DIR}/dev"
@@ -1,4 +1,25 @@
1
1
  #!/usr/bin/env ruby
2
- require File.expand_path(File.dirname(__FILE__) + "/../lib/mizuho")
2
+ # Copyright (c) 2013 Hongli Lai
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+
22
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
23
+ require 'mizuho'
3
24
  require 'mizuho/source_highlight'
4
- exec("python", Mizuho::ASCIIDOC, *ARGV)
25
+ exec(*[Mizuho::ASCIIDOC, ARGV].flatten)
@@ -12,7 +12,11 @@ XS-Ruby-Versions: all
12
12
  Package: mizuho
13
13
  Architecture: all
14
14
  XB-Ruby-Versions: ${ruby:Versions}
15
- Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-nokogiri (>= 1.5.0), source-highlight, asciidoc
15
+ #if is_distribution?('>= precise')
16
+ Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-nokogiri (>= 1.4.0), source-highlight, asciidoc (>= 8.6.0)
17
+ #else
18
+ Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, libnokogiri-ruby (>= 1.4.0), source-highlight
19
+ #endif
16
20
  Description: Documentation formatting tool
17
21
  Converts Asciidoc input files into nicely
18
22
  outputted HTML, possibly one file per chapter.
@@ -0,0 +1,4 @@
1
+ templates/* usr/share/mizuho/templates
2
+ #if is_distribution?('< precise')
3
+ asciidoc/* usr/share/mizuho/asciidoc
4
+ #endif
@@ -6,4 +6,5 @@ export DH_VERBOSE=1
6
6
 
7
7
  override_dh_install:
8
8
  dh_install
9
- sed -i 's/NATIVELY_PACKAGED = .*/NATIVELY_PACKAGED = true/' debian/mizuho/usr/lib/ruby/vendor_ruby/mizuho.rb
9
+ sed -i 's/NATIVELY_PACKAGED = .*/NATIVELY_PACKAGED = true/' debian/mizuho/usr/lib/ruby/vendor_ruby/mizuho.rb
10
+ sed -i 's/\/usr\/bin\/env ruby/\/usr\/bin\/ruby/' debian/mizuho/usr/bin/mizuho
@@ -19,12 +19,16 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Mizuho
22
- VERSION_STRING = "0.9.17"
22
+ VERSION_STRING = "0.9.18"
23
23
  NATIVELY_PACKAGED = false
24
24
 
25
25
  if NATIVELY_PACKAGED
26
- TEMPLATES_DIR = "/usr/share/mizuho/templates"
27
- ASCIIDOC = "asciidoc"
26
+ TEMPLATES_DIR = "/usr/share/mizuho/templates"
27
+ if File.exist?("/usr/share/mizuho/asciidoc")
28
+ ASCIIDOC = ["/usr/bin/python", "/usr/share/mizuho/asciidoc/asciidoc.py"]
29
+ else
30
+ ASCIIDOC = "/usr/bin/asciidoc"
31
+ end
28
32
  else
29
33
  SOURCE_ROOT = File.expand_path(File.dirname(__FILE__) + "/..")
30
34
  LIBDIR = "#{SOURCE_ROOT}/lib"
@@ -138,7 +138,7 @@ private
138
138
  header_div = (doc / "#header")[0]
139
139
  headers = (doc / "#content" / "h1, h2, h3, h4")
140
140
 
141
- head.add_child(stylesheet_tag)
141
+ head.add_child(make_node(stylesheet_tag, doc))
142
142
 
143
143
  # Remove footer with generation timestamp.
144
144
  (doc / "#footer-text").remove
@@ -156,37 +156,37 @@ private
156
156
  if header['class'] !~ /float/
157
157
  titles << header.text
158
158
  header['data-comment-topic'] = @id_map.associations[header.text]
159
- header.add_previous_sibling(create_comment_balloon)
159
+ header.add_previous_sibling(make_node(create_comment_balloon, doc))
160
160
  end
161
161
  end
162
162
  end
163
163
 
164
164
  # Add top bar.
165
165
  if @enable_topbar
166
- body.children.first.add_previous_sibling(topbar(title))
166
+ body.children.first.add_previous_sibling(make_node(topbar(title), doc))
167
167
  end
168
168
 
169
169
  # Add Mizuho Javascript.
170
- body.add_child(javascript_tag)
170
+ body.add_child(javascript_tag(doc))
171
171
 
172
172
  # Move preamble from content area to header area.
173
173
  if preamble = (doc / "#preamble")[0]
174
174
  preamble.remove
175
- header_div.add_child(preamble)
175
+ header_div.add_child(make_node(preamble, doc))
176
176
  end
177
177
 
178
178
  # Create a TOC after the preamble.
179
- toc_div = header_div.add_child(%Q{<div id="toc"></div>})[0]
179
+ toc_div = add_child_and_get(header_div, %Q{<div id="toc"></div>})
180
180
  if @commenting_system
181
181
  # Add a commenting balloon to the TOC title.
182
- toc_div.add_child(create_comment_balloon)
182
+ toc_div.add_child(make_node(create_comment_balloon, doc))
183
183
  end
184
- toc_div.add_child(%Q{<div id="toctitle">Table of Contents</div>})
184
+ toc_div.add_child(make_node(%Q{<div id="toctitle">Table of Contents</div>}, doc))
185
185
  headers.each do |header|
186
186
  if header['class'] !~ /float/
187
187
  level = header.name.scan(/\d+/).first
188
- div = toc_div.add_child("<div class=\"foo toclevel#{level}\"></div>")[0]
189
- link = div.add_child("<a></a>")[0]
188
+ div = add_child_and_get(toc_div, "<div class=\"foo toclevel#{level}\"></div>")
189
+ link = add_child_and_get(div, "<a></a>")
190
190
  link['href'] = '#' + header['id']
191
191
  link.content = header.text
192
192
  end
@@ -197,7 +197,7 @@ private
197
197
  # don't hide the header behind the top bar.
198
198
  # http://nicolasgallagher.com/jump-links-and-viewport-positioning/
199
199
  headers.each do |header|
200
- span = header.add_previous_sibling('<span class="anchor_helper"></span>')[0]
200
+ span = add_previous_sibling_and_get(header, '<span class="anchor_helper"></span>')
201
201
  span['id'] = header['data-anchor'] = header['id']
202
202
  header.remove_attribute('id')
203
203
  end
@@ -255,8 +255,9 @@ private
255
255
  return content
256
256
  end
257
257
 
258
- def javascript_tag
259
- content = %Q{<script>}
258
+ def javascript_tag(doc)
259
+ node = Nokogiri::XML::Node.new('script', doc)
260
+ content = ""
260
261
  content << File.read("#{TEMPLATES_DIR}/jquery-1.7.1.min.js") << "\n"
261
262
  content << File.read("#{TEMPLATES_DIR}/jquery.hashchange-1.0.0.js") << "\n"
262
263
  content << File.read("#{TEMPLATES_DIR}/mizuho.js") << "\n"
@@ -270,8 +271,8 @@ private
270
271
  }
271
272
  content << File.read("#{TEMPLATES_DIR}/juvia.js") << "\n"
272
273
  end
273
- content << %Q{</script>}
274
- return content
274
+ node.content = content
275
+ return node
275
276
  end
276
277
 
277
278
  def create_comment_balloon
@@ -303,6 +304,27 @@ private
303
304
  exit 1 if fail
304
305
  end
305
306
 
307
+ # For Nokogiri 1.4.0 compatibility
308
+ def make_node(html, doc)
309
+ result = Nokogiri::XML::Node.new('div', doc)
310
+ result.inner_html = html
311
+ return result.children[0]
312
+ end
313
+
314
+ # For Nokogiri 1.4.0 compatibility
315
+ def add_child_and_get(node, html)
316
+ result = node.add_child(make_node(html, node.document))
317
+ result = result[0] if result.is_a?(Array)
318
+ return result
319
+ end
320
+
321
+ # For Nokogiri 1.4.0 compatibility
322
+ def add_previous_sibling_and_get(node, html)
323
+ result = node.add_previous_sibling(make_node(html, node.document))
324
+ result = result[0] if result.is_a?(Array)
325
+ return result
326
+ end
327
+
306
328
  def gather_content(header)
307
329
  result = []
308
330
  elem = header
@@ -31,8 +31,6 @@ MIZUHO_FILES = [
31
31
 
32
32
  MIZUHO_DEBIAN_EXCLUDE_FILES = [
33
33
  "Rakefile",
34
- "bin/mizuho-asciidoc",
35
34
  "debian/**/*",
36
- "asciidoc/**/*",
37
35
  "source-highlight/**/*",
38
36
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mizuho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.17
4
+ version: 0.9.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.5.0
21
+ version: 1.4.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.5.0
29
+ version: 1.4.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: sqlite3
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -67,9 +67,9 @@ files:
67
67
  - lib/mizuho.rb
68
68
  - debian/changelog
69
69
  - debian/compat
70
- - debian/control
70
+ - debian/control.pp
71
71
  - debian/copyright
72
- - debian/mizuho.install
72
+ - debian/mizuho.install.pp
73
73
  - debian/rules
74
74
  - debian/source/format
75
75
  - test/generator_spec.rb
metadata.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJRfUauAAoJECrHRaUKISqMgT0IAKxFN+AphNrA0XnEUwY1xgE/
6
- zkHfRaoy6GL18BcanZ6jLgKLmf5II4co0xTQBXF+H5kyspe9nSteqGTyDkGlhlPV
7
- Bdx0heIFQLiw41DaIUgxuz+N0RZvp+jjIYOZGSvaJ3mjuc7G9CShVs5sFH8dCM+o
8
- oOHMT1zYT3qZpz8dz21rWcW96mHrIf8YI7aRvBK2vKZ8DX9qT+vgzNmM4iwUyq1H
9
- +9/xiM3+C0Juv7dtHyjfpiNH92jf2yR4VDnyv7ACDrqVsxRno646HzBqmkFxAUuT
10
- iOs2UY31DmufUaq1yUJGUCLhLbhFxTdGbeY2r/fWliOOWvQE7C4hnrg1kt58Nvc=
11
- =X/o9
5
+ iQEcBAABAgAGBQJRfZGvAAoJECrHRaUKISqMbMIH/2nKsOHJx3cpvpm4TDYBu1bH
6
+ /3/JWQl5p7XatzxntKWce7WyGDFk3+lfmYRfu+WDGC8AEqlq4Vo/wctVwgx48HWp
7
+ 8GP89+2VUEBaMynFNkxH2Uq4fzs95AZGWUDOq35BN7i1JkcPdjJIt5341ak7UPLr
8
+ x096QNFUwqH5b/Fnd7hVog9eR8zA1pokKWf2FPKNv7XWrsvPr3iTVd9L2Uui2Bzn
9
+ DzbuaRWMkt7naJlHLoahEdUhuZFWmjFRmTVsI+ZsC/y7hHz+KaFL7n++Um3dasSn
10
+ Wl+NKEtqZ5wis0Rgvb7cPeb08Mm6j36qxFCQMFqleTTR+91vzyfiD3HLB4jBHyo=
11
+ =FC1H
12
12
  -----END PGP SIGNATURE-----
@@ -1 +0,0 @@
1
- templates/* usr/share/mizuho/templates