webgen 1.5.0 → 1.7.1

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
  SHA256:
3
- metadata.gz: c7503141411c417cebfe4ce07f0c73743cb0d3d8f1106df4c44c10c002b36e21
4
- data.tar.gz: 27b7f63d682a006ad8d29708541abe0ad2684d83660d548ae4c133c025ae4137
3
+ metadata.gz: 1754f53e6bf21861fe5ede0bdc46d9ec59b5e38a0f011037b19a218f3b1ba642
4
+ data.tar.gz: 766b0d8e4ba1b5ad86d9ad7655e9c92cac3ba43dbeff2747c8a83cbec6f1cd33
5
5
  SHA512:
6
- metadata.gz: d48ff1a6abfd6fa03cb13da0fe4f65997049f93bdd4112cadbe877971e93cf6ad46a205db7ccc9bbc3cb3a5e978772f391a936e030804273dcfbcc9f60b51755
7
- data.tar.gz: 8ddcc6251a2004df145341c3185d7d629f42c828ce3bc93dc5a85ef6e952f6baa46fcddc6ab586eebb44e8322bfe443d9b721115ded0c3a765557bbb7f7677c3
6
+ metadata.gz: 2a05b2c6b2ea95ce22c58d57d6145e92fbdec870f27f750fc847fa372c96b9bf2ea751d6cacabe8bf344e3a1cdf08a8ea2d78b28966d864cd666b3ad378e0162
7
+ data.tar.gz: c3724710f6745d87dd92531f8b2f6a06a82be518af9057b46c9b4d62e94cbc9831c24b8b670c3525168dd2e999f67c37807e3c600d0737d93d1db2f547a68d3d
data/Rakefile CHANGED
@@ -109,16 +109,16 @@ EOF
109
109
 
110
110
  s.add_dependency('cmdparse', '~> 3.0', '>= 3.0.1')
111
111
  s.add_dependency('systemu', '~> 2.5')
112
- s.add_dependency('kramdown', '~> 1.3')
112
+ s.add_dependency('kramdown', '~> 2.3')
113
113
  s.add_development_dependency('rake', '>= 0.8.3')
114
114
  s.add_development_dependency('minitest', '~> 5.0')
115
115
  s.add_development_dependency('diff-lcs', '~> 1.0')
116
116
  s.add_development_dependency('maruku', '~> 0.7')
117
117
  s.add_development_dependency('RedCloth', '~> 4.1')
118
- s.add_development_dependency('haml', '~> 4.0')
118
+ s.add_development_dependency('haml', '~> 5.0')
119
119
  s.add_development_dependency('sass', '~> 3.2')
120
120
  s.add_development_dependency('builder', '~> 2.1')
121
- s.add_development_dependency('rdoc', '~> 4.0')
121
+ s.add_development_dependency('rdoc', '~> 6.0')
122
122
  s.add_development_dependency('coderay', '~> 1.0')
123
123
  s.add_development_dependency('erubis', '~> 2.6')
124
124
  s.add_development_dependency('rdiscount', '~> 1.3')
@@ -128,11 +128,9 @@ EOF
128
128
  s.files = PKG_FILES.to_a
129
129
  s.require_path = 'lib'
130
130
  s.executables = ['webgen']
131
- s.default_executable = 'webgen'
132
131
 
133
132
  #### Documentation
134
133
 
135
- s.has_rdoc = true
136
134
  s.rdoc_options = ['--line-numbers', '--main', 'API.rdoc']
137
135
  s.extra_rdoc_files = ['API.rdoc']
138
136
 
data/THANKS CHANGED
@@ -17,3 +17,4 @@ Thanks for donations to:
17
17
  * Mateusz Szczap
18
18
  * Michael Franzl
19
19
  * Roger Pack
20
+ * Damien Robert
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.7.1
@@ -5,7 +5,7 @@
5
5
  context.node.sitemap_entries.each do |item|
6
6
  %>
7
7
  <url>
8
- <loc><%= URI.escape(item.url) %></loc>
8
+ <loc><%= ERB::Util.url_encode(item.url) %></loc>
9
9
  <lastmod><%= item['modified_at'].iso8601 %></lastmod>
10
10
  <changefreq><%= item['change_freq'] || context.node['default_change_freq'] %></changefreq>
11
11
  <% if priority = item['priority'] || context.node['default_priority'] %>
@@ -1,7 +1,6 @@
1
1
  --- name:content pipeline:erb
2
2
  \nonstopmode
3
- \documentclass{standalone}
4
- \usepackage{tikz}
3
+ \documentclass[tikz]{standalone}
5
4
 
6
5
  <% if context['content_processor.tikz.libraries'] %>
7
6
  \usetikzlibrary{<%= context['content_processor.tikz.libraries'].join(',') %>}
@@ -404,6 +404,20 @@ options:
404
404
  \tikz \draw (0,0) -- (0,2) -- (2,2);
405
405
  {tikz}
406
406
 
407
+ content_processor.tikz.engine:
408
+ summary: |
409
+ Specifies which LaTeX engine should be used. Default is pdflatex, but you may want to use
410
+ xelatex or lualatex if needed.
411
+ syntax: |
412
+ `pdflatex` or `lualatex` or `xelatex`
413
+ example:
414
+ config: |
415
+ content_processor.tikz.engine: lualatex
416
+ tag: |
417
+ {tikz:: {path: tikz.png, content_processor.tikz.engine: xelatex}}
418
+ \tikz \draw (0,0) -- (0,2) -- (2,2);
419
+ {tikz}
420
+
407
421
  content_processor.xmllint.options:
408
422
  summary: |
409
423
  Options passed to the `xmllint` command.
@@ -65,7 +65,7 @@ content_processor.register('Blocks')
65
65
  content_processor.register('Builder')
66
66
  content_processor.register('CSSMinify', :name => 'cssminify')
67
67
  content_processor.register('Erb')
68
- option('content_processor.erb.trim_mode', '', &is_string)
68
+ option('content_processor.erb.trim_mode', nil, &is_string)
69
69
 
70
70
  content_processor.register('Erubis')
71
71
  option('content_processor.erubis.use_pi', false, &true_or_false)
@@ -112,6 +112,7 @@ option('content_processor.tikz.resolution', '72 72',) do |val|
112
112
  end
113
113
  option('content_processor.tikz.transparent', false, &true_or_false)
114
114
  option('content_processor.tikz.template', '/templates/tikz.template', &is_string)
115
+ option('content_processor.tikz.engine', 'pdflatex', &is_string)
115
116
 
116
117
  content_processor.register('Xmllint')
117
118
  option('content_processor.xmllint.options', "--catalogs --noout --valid", &is_string)
@@ -13,7 +13,7 @@ module Webgen
13
13
 
14
14
  # Process the Ruby statements embedded in the content of +context+.
15
15
  def self.call(context)
16
- erb = ERB.new(context.content, nil, context.website.config['content_processor.erb.trim_mode'])
16
+ erb = ERB.new(context.content, trim_mode: context.website.config['content_processor.erb.trim_mode'])
17
17
  erb.filename = context.ref_node.alcn
18
18
  context.content = erb.result(binding)
19
19
  context
@@ -73,6 +73,9 @@ module Webgen
73
73
  ((context.persistent[:cp_html_head] || {})[:meta] || {}).merge(context.content_node['meta'] || {}).each do |name, content|
74
74
  result += "\n<meta name=\"#{ERB::Util.h(name)}\" content=\"#{ERB::Util.h(content)}\" />"
75
75
  end
76
+ ((context.persistent[:cp_html_head] || {})[:meta_property] || {}).merge(context.content_node['meta_property'] || {}).each do |property, content|
77
+ result += "\n<meta property=\"#{ERB::Util.h(property)}\" content=\"#{ERB::Util.h(content)}\" />"
78
+ end
76
79
  result
77
80
  end
78
81
 
@@ -7,7 +7,6 @@ require 'webgen/content_processor'
7
7
  require 'webgen/utils/external_command'
8
8
 
9
9
  Webgen::Utils::ExternalCommand.ensure_available!('pdflatex', '-v')
10
- Webgen::Utils::ExternalCommand.ensure_available!('pdfcrop', '--version')
11
10
  Webgen::Utils::ExternalCommand.ensure_available!('gs', '-v')
12
11
  Webgen::Utils::ExternalCommand.ensure_available!('convert', '-version')
13
12
  Webgen::Utils::ExternalCommand.ensure_available!('identify', '-version')
@@ -31,7 +30,7 @@ module Webgen
31
30
  def self.prepare_options(context)
32
31
  %w[content_processor.tikz.resolution content_processor.tikz.transparent
33
32
  content_processor.tikz.libraries content_processor.tikz.opts
34
- content_processor.tikz.template].each do |opt|
33
+ content_processor.tikz.template content_processor.tikz.engine].each do |opt|
35
34
  context[opt] = context.content_node[opt] || context.website.config[opt]
36
35
  end
37
36
  context['data'] = context.content
@@ -66,29 +65,35 @@ module Webgen
66
65
  def self.compile(context, cwd, tex_file, basename, ext)
67
66
  render_res, output_res = context['content_processor.tikz.resolution'].split(' ')
68
67
 
68
+ engine = context['content_processor.tikz.engine']
69
69
  File.write(tex_file, context.content)
70
- execute("pdflatex -shell-escape -interaction=nonstopmode -halt-on-error #{basename}.tex", cwd, context) do |_status, stdout, stderr|
70
+ execute("#{engine} -shell-escape -interaction=nonstopmode -halt-on-error #{basename}.tex", cwd, context) do |_status, stdout, stderr|
71
71
  errors = (stdout+stderr).scan(/^!(.*\n.*)/).join("\n")
72
- raise Webgen::RenderError.new("Error while parsing TikZ picture commands with PDFLaTeX: #{errors}",
72
+ raise Webgen::RenderError.new("Error while parsing TikZ picture commands with #{engine}: #{errors}",
73
73
  'content_processor.tikz', context.dest_node, context.ref_node)
74
74
  end
75
75
 
76
- execute("pdfcrop #{basename}.pdf #{basename}.pdf", cwd, context)
77
-
78
76
  if context['content_processor.tikz.transparent'] && ext =~ /\.png/i
79
77
  cmd = "gs -dSAFER -dBATCH -dNOPAUSE -r#{render_res} -sDEVICE=pngalpha -dGraphicsAlphaBits=4 " +
80
78
  "-dTextAlphaBits=4 -sOutputFile=#{basename}#{ext} #{basename}.pdf"
79
+ elsif ext =~ /\.svg/i
80
+ # some installations of ghostscript (`gs`) also have a svg output device, but pdf2svg
81
+ # is a safer bet.
82
+ cmd = "pdf2svg #{basename}.pdf #{basename}.svg"
81
83
  else
82
84
  cmd = "convert -density #{render_res} #{basename}.pdf #{basename}#{ext}"
83
85
  end
84
86
  execute(cmd, cwd, context)
85
87
 
86
- if render_res != output_res
87
- _status, stdout, _stderr = execute("identify #{basename}#{ext}", cwd, context)
88
- width, height = stdout.scan(/\s\d+x\d+\s/).first.strip.split('x').collect do |s|
89
- s.to_f * output_res.to_f / render_res.to_f
88
+ # resizing doesn't really make sense on a vector graphic.
89
+ unless ext =~ /\.svg/i
90
+ if render_res != output_res
91
+ _status, stdout, _stderr = execute("identify #{basename}#{ext}", cwd, context)
92
+ width, height = stdout.scan(/\s\d+x\d+\s/).first.strip.split('x').collect do |s|
93
+ s.to_f * output_res.to_f / render_res.to_f
94
+ end
95
+ execute("convert -resize #{width}x#{height} #{basename}#{ext} #{basename}#{ext}", cwd, context)
90
96
  end
91
- execute("convert -resize #{width}x#{height} #{basename}#{ext} #{basename}#{ext}", cwd, context)
92
97
  end
93
98
  end
94
99
  private_class_method :compile
@@ -23,6 +23,13 @@ module Webgen
23
23
  (cp_hash[:meta] ||= {})[name] = content
24
24
  end
25
25
 
26
+ # Set the meta tag to the provided value, using +property+ instead of +name+.
27
+ #
28
+ # Note that some meta information keys may not be specified multiple times!
29
+ def meta_property(name, content)
30
+ (cp_hash[:meta_property] ||= {})[name] = content
31
+ end
32
+
26
33
  # Add a link to the given file in the HTML head section.
27
34
  #
28
35
  # The type can either be :css for CSS files or :js for javascript files. The path to the
@@ -35,7 +35,13 @@ module Webgen
35
35
 
36
36
  def item_data(alcn, key = nil) #:nodoc:
37
37
  mi = @website.tree[alcn].meta_info
38
- key.nil? ? (mi = mi.dup; mi.delete(CONTENT_MODIFICATION_KEY); mi) : mi[key].dup
38
+ if key.nil? && mi['modified_at_in_dest_path']
39
+ mi
40
+ elsif key.nil?
41
+ (mi = mi.dup; mi.delete(CONTENT_MODIFICATION_KEY); mi)
42
+ else
43
+ mi[key].dup
44
+ end
39
45
  end
40
46
 
41
47
  def item_changed?(iid, old_data) #:nodoc:
@@ -47,8 +47,9 @@ module Webgen
47
47
  klass_node = create_page_node_for_class(path, dir_node, klass, output_flag_file)
48
48
  api.class_nodes[klass.full_name] = klass_node
49
49
  klass_node.node_info[:api] = api
50
- klass.each_method {|method| create_fragment_node_for_method(path, klass_node, method)}
51
- klass.each_attribute {|attr| create_fragment_node_for_method(path, klass_node, attr)}
50
+ create_fragment_nodes_for_constants(path, klass_node, klass)
51
+ create_fragment_nodes_for_attributes(path, klass_node, klass)
52
+ create_fragment_nodes_for_methods(path, klass_node, klass)
52
53
  end
53
54
 
54
55
  rdoc.store.all_files.sort.each do |file|
@@ -91,7 +92,6 @@ module Webgen
91
92
  rdoc.options = rdoc_options(options)
92
93
  rdoc.store = rdoc_store(rdoc.options, cache_dir)
93
94
 
94
- rdoc.exclude = rdoc.options.exclude
95
95
  rdoc.last_modified.replace(rdoc.setup_output_dir(cache_dir, false))
96
96
 
97
97
  if !(rdoc.parse_files(rdoc.options.files)).empty?
@@ -179,13 +179,76 @@ module Webgen
179
179
  end
180
180
  protected :create_page_node_for_class
181
181
 
182
+ # Creates fragment nodes for constants under the "Constants" fragment.
183
+ def create_fragment_nodes_for_constants(api_path, klass_node, klass)
184
+ return if klass.constants.none? {|const| const.display? }
185
+ constants_url = "#{klass_node.alcn}#Constants"
186
+ path = Webgen::Path.new(constants_url,
187
+ {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
188
+ 'pipeline' => [], 'no_output' => true, 'title' => "Constants"})
189
+ const_node = @website.ext.path_handler.create_secondary_nodes(path).first
190
+ klass.constants.sort_by(&:name).each do |const|
191
+ create_fragment_node_for_constant(api_path, const_node, const)
192
+ end
193
+ end
194
+ protected :create_fragment_nodes_for_constants
195
+
196
+ # Create a fragment node for the given constant.
197
+ #
198
+ # A link definition entry for the method is also created.
199
+ def create_fragment_node_for_constant(api_path, parent_node, constant)
200
+ constant_url = "#{parent_node.alcn.sub(/#.*$/, '')}##{constant.name}"
201
+ path = Webgen::Path.new(constant_url,
202
+ {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
203
+ 'parent_alcn' => parent_node.alcn,
204
+ 'pipeline' => [], 'no_output' => true, 'title' => constant.name})
205
+ @website.ext.path_handler.create_secondary_nodes(path)
206
+ add_link_definition(api_path, constant.full_name, constant_url, constant.full_name)
207
+ end
208
+ protected :create_fragment_node_for_constant
209
+
210
+ # Creates fragment nodes for attributes under the "Attributes" fragment.
211
+ def create_fragment_nodes_for_attributes(api_path, parent_node, klass)
212
+ return if klass.attributes.none? {|attr| attr.display? }
213
+ attributes_url = "#{parent_node.alcn}#Attributes"
214
+ path = Webgen::Path.new(attributes_url,
215
+ {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
216
+ 'parent_alcn' => parent_node.alcn,
217
+ 'pipeline' => [], 'no_output' => true, 'title' => "Attributes"})
218
+ attr_node = @website.ext.path_handler.create_secondary_nodes(path).first
219
+ klass.attributes.sort_by(&:name).each do |attribute|
220
+ create_fragment_node_for_method(api_path, attr_node, attribute)
221
+ end
222
+ end
223
+ protected :create_fragment_nodes_for_attributes
224
+
225
+ # Creates fragment nodes for methods under the "Class Methods" or "Instance Methods"
226
+ # fragments.
227
+ def create_fragment_nodes_for_methods(api_path, klass_node, klass)
228
+ ["Class", "Instance"].each do |type|
229
+ method_list = klass.send("#{type.downcase}_method_list")
230
+ next if method_list.empty?
231
+ meth_url = "#{klass_node.alcn}##{type}-Methods"
232
+ path = Webgen::Path.new(meth_url,
233
+ {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
234
+ 'pipeline' => [], 'no_output' => true,
235
+ 'title' => "#{type} Methods"})
236
+ meth_node = @website.ext.path_handler.create_secondary_nodes(path).first
237
+ method_list.sort_by(&:name).each do |method|
238
+ create_fragment_node_for_method(api_path, meth_node, method)
239
+ end
240
+ end
241
+ end
242
+ protected :create_fragment_nodes_for_attributes
243
+
182
244
  # Create a fragment node for the given method.
183
245
  #
184
246
  # A link definition entry for the method is also created.
185
- def create_fragment_node_for_method(api_path, klass_node, method)
186
- method_url = "#{klass_node.alcn}##{method.aref}"
247
+ def create_fragment_node_for_method(api_path, parent_node, method)
248
+ method_url = "#{parent_node.alcn.sub(/#.*$/, '')}##{method.aref}"
187
249
  path = Webgen::Path.new(method_url,
188
250
  {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
251
+ 'parent_alcn' => parent_node.alcn,
189
252
  'pipeline' => [], 'no_output' => true, 'title' => method.name})
190
253
  @website.ext.path_handler.create_secondary_nodes(path)
191
254
  add_link_definition(api_path, method.full_name, method_url, method.full_name)
@@ -38,7 +38,7 @@ module Webgen
38
38
  def paths
39
39
  if !defined?(@paths)
40
40
  stream = open(@uri)
41
- stream = Zlib::GzipReader.new(stream) if @uri =~ /(\.tar\.gz|\.tgz)$/
41
+ stream = Zlib::GzipReader.new(stream) if @uri.to_s =~ /(\.tar\.gz|\.tgz)$/
42
42
  Archive::Tar::Minitar::Input.open(stream) do |input|
43
43
  @paths = input.collect do |entry|
44
44
  path = entry.full_name
@@ -97,6 +97,7 @@ module Webgen
97
97
 
98
98
  def initialize(website) # :nodoc:
99
99
  super()
100
+ @parser = nil
100
101
  website.blackboard.add_listener(:website_initialized, 'tag') do
101
102
  @parser = Webgen::Utils::TagParser.new(website.config['tag.prefix'])
102
103
  end
@@ -3,6 +3,6 @@
3
3
  module Webgen
4
4
 
5
5
  # The version of webgen.
6
- VERSION = '1.5.0'
6
+ VERSION = '1.7.1'
7
7
 
8
8
  end
@@ -13,13 +13,13 @@ class TestBuilder < Minitest::Test
13
13
  cp = Webgen::ContentProcessor::Builder
14
14
 
15
15
  @context.content = "xml.div(:path => context.node.alcn) { xml.strong('test'); " +
16
- "context.website; context; context.ref_node; context.dest_node }"
16
+ "context.website; context.ref_node; context.dest_node }"
17
17
  assert_equal("<div path=\"/test\">\n <strong>test</strong>\n</div>\n", cp.call(@context).content)
18
18
 
19
- @context.content = "xml.div do \n5+5\n+=+6\nend"
20
- assert_error_on_line(SyntaxError, 3) { cp.call(@context) }
19
+ @context.content = "xml.div do \n=+6\nend"
20
+ assert_error_on_line(SyntaxError, 2) { cp.call(@context) }
21
21
 
22
- @context.content = "xml.div do \n5+5\nunknown\n++6\nend"
22
+ @context.content = "xml.div do \nx=5+5\nunknown\n+6\nend"
23
23
  assert_error_on_line(NameError, 3) { cp.call(@context) }
24
24
  end
25
25
 
@@ -12,7 +12,7 @@ class TestHaml < Minitest::Test
12
12
  cp = Webgen::ContentProcessor::Haml
13
13
 
14
14
  @context.content = "#content\n %h1 Hallo\n = [context.node.alcn, context.ref_node.alcn, context.dest_node.alcn].join"
15
- assert_equal("<div id='content'>\n <h1>Hallo</h1>\n /test/test/test\n</div>\n", cp.call(@context).content)
15
+ assert_equal("<div id='content'>\n<h1>Hallo</h1>\n/test/test/test\n</div>\n", cp.call(@context).content)
16
16
 
17
17
  @context.content = "#cont\n % = + unknown"
18
18
  assert_error_on_line(Webgen::RenderError, 2) { cp.call(@context) }
@@ -24,13 +24,15 @@ class TestHtmlHead < Minitest::Test
24
24
 
25
25
  def test_tags_from_context_data
26
26
  @node.meta_info['meta'] = {'other' => 'me'}
27
+ @node.meta_info['meta_property'] = {'otherprop' => 'me'}
27
28
  context = Webgen::Context.new(@website, :chain => [@node])
28
29
  context.persistent[:cp_html_head] = {
29
30
  :js_file => ['hallo.js', 'hallo2.js', 'hallo.js'],
30
31
  :js_inline => ["somescript", "anotherscript"],
31
32
  :css_file => ['hallo.css', 'hallo2.css', 'hallo.css'],
32
33
  :css_inline => ["somestyle", "anotherstyle"],
33
- :meta => {:lucky => 'me<"'}
34
+ :meta => {:lucky => 'me<"'},
35
+ :meta_property => {:unlucky => 'me'},
34
36
  }
35
37
  assert_equal("\n<script type=\"text/javascript\" src=\"hallo.js\"></script>" +
36
38
  "\n<script type=\"text/javascript\" src=\"hallo2.js\"></script>" +
@@ -41,10 +43,15 @@ class TestHtmlHead < Minitest::Test
41
43
  "\n<style type=\"text/css\">/*<![CDATA[/*/\nsomestyle\n/*]]>*/</style>" +
42
44
  "\n<style type=\"text/css\">/*<![CDATA[/*/\nanotherstyle\n/*]]>*/</style>" +
43
45
  "\n<meta name=\"lucky\" content=\"me&lt;&quot;\" />" +
44
- "\n<meta name=\"other\" content=\"me\" />", @obj.tags_from_context_data(context))
46
+ "\n<meta name=\"other\" content=\"me\" />" +
47
+ "\n<meta property=\"unlucky\" content=\"me\" />" +
48
+ "\n<meta property=\"otherprop\" content=\"me\" />",
49
+ @obj.tags_from_context_data(context))
45
50
 
46
51
  context.persistent[:cp_html_head] = nil
47
- assert_equal("\n<meta name=\"other\" content=\"me\" />", @obj.tags_from_context_data(context))
52
+ assert_equal("\n<meta name=\"other\" content=\"me\" />" +
53
+ "\n<meta property=\"otherprop\" content=\"me\" />",
54
+ @obj.tags_from_context_data(context))
48
55
 
49
56
  end
50
57
 
@@ -14,10 +14,10 @@ class TestContentProcessorRuby < Minitest::Test
14
14
  @context.content = "context.content = context.dest_node.alcn"
15
15
  assert_equal(@context.dest_node.alcn, cp.call(@context).content)
16
16
 
17
- @context.content = "5+5\n+=+6\n"
17
+ @context.content = "x = 5+5\n+=+6\n"
18
18
  assert_error_on_line(SyntaxError, 2) { cp.call(@context) }
19
19
 
20
- @context.content = "5+5\nunknown\n++6"
20
+ @context.content = "x = 5+5\nunknown\n++6"
21
21
  assert_error_on_line(NameError, 2) { cp.call(@context) }
22
22
  end
23
23
 
@@ -14,7 +14,7 @@ class TestSass < Minitest::Test
14
14
  @website.config['content_processor.sass.options'] = {}
15
15
  cp = Webgen::ContentProcessor::Sass
16
16
 
17
- @context.content = "#main\n :background-color #000"
17
+ @context.content = "#main\n background-color: #000"
18
18
  result = "#main {\n background-color: #000; }\n"
19
19
  assert_equal(result, cp.call(@context).content)
20
20
 
@@ -19,13 +19,13 @@ class TestContentProcessorTikz < Minitest::Test
19
19
 
20
20
  @context.node.define_singleton_method(:[]) {|_ignored| nil}
21
21
 
22
- call('\tikz \draw (0,0) -- (0,1);', 'test.png', [], '', '72 72', false)
23
- Timeout.timeout(0.2) { call('\tikz \draw (0,0) -- (0,1);', 'test.png', [], '', '72 72', false) } # test cache
22
+ call('\tikz \draw (0,0) -- (1,1);', 'test.png', [], '', '72 72', false)
23
+ Timeout.timeout(0.2) { call('\tikz \draw (0,0) -- (1,1);', 'test.png', [], '', '72 72', false) } # test cache
24
24
  refute_nil(@context.content)
25
25
 
26
26
  assert_raises(Webgen::RenderError) { call('\tikz \asdfasdfasf', 'test.png', [], '', '72 72', false) }
27
27
 
28
- call('\tikz \draw (0,0) -- (0,1);', '/images/test.gif', ['arrows'], '->', '72 72', true)
28
+ call('\tikz \draw (0,0) -- (1,1);', '/images/test.gif', ['arrows'], '->', '72 72', true)
29
29
  refute_nil(@context.content)
30
30
  end
31
31
 
@@ -44,7 +44,7 @@ class TestContentProcessorTikz < Minitest::Test
44
44
  end
45
45
 
46
46
  def teardown
47
- FileUtils.rm_rf(@website.directory) if @website
47
+ #FileUtils.rm_rf(@website.directory) if @website
48
48
  end
49
49
 
50
50
  end
@@ -8,7 +8,8 @@ class TestNodeMetaInfo < Minitest::Test
8
8
  def setup
9
9
  @website = Object.new
10
10
  @node = node = Object.new
11
- @node.define_singleton_method(:meta_info) { {'key' => 'value'} }
11
+ @meta_info_data = meta_info_data = {'key' => 'value'}
12
+ @node.define_singleton_method(:meta_info) { meta_info_data }
12
13
  @website.define_singleton_method(:tree) { {'alcn' => node} }
13
14
  @obj = Webgen::ItemTracker::NodeMetaInfo.new(@website)
14
15
  end
@@ -24,6 +25,13 @@ class TestNodeMetaInfo < Minitest::Test
24
25
  refute_same(@node.meta_info, @obj.item_data('alcn'))
25
26
  assert_equal('value', @obj.item_data('alcn', 'key'))
26
27
  refute_same(@node.meta_info['key'], @obj.item_data('alcn', 'key'))
28
+
29
+ @meta_info_data['modified_at'] = 5
30
+ assert_equal({'key' => 'value'}, @obj.item_data('alcn'))
31
+ @meta_info_data['modified_at_in_dest_path'] = true
32
+
33
+ assert_equal({'key' => 'value', 'modified_at' => 5, 'modified_at_in_dest_path' => true},
34
+ @obj.item_data('alcn'))
27
35
  end
28
36
 
29
37
  def test_item_changed?
@@ -5,6 +5,18 @@ require 'webgen/path_handler/api'
5
5
 
6
6
  class TestPathHandlerApi < Minitest::Test
7
7
 
8
+ # Some Constant
9
+ TEST_CONST = 42
10
+
11
+ # Other Constant
12
+ OTHER_CONST = 43
13
+
14
+ def self.test_meth; end
15
+ def self.other_meth; end
16
+
17
+ attr_reader :test_attr
18
+ attr_reader :other_attr
19
+
8
20
  class SampleTestSubclass
9
21
  end
10
22
 
@@ -44,9 +56,31 @@ class TestPathHandlerApi < Minitest::Test
44
56
  assert(@website.tree["#{test_alcn}#method-i-setup"])
45
57
  assert_equal(["#{test_alcn}#method-i-setup", 'TestPathHandlerApi#setup'],
46
58
  @website.ext.link_definitions['my_api:TestPathHandlerApi#setup'])
59
+ assert(@website.tree["#{test_alcn}#method-c-test_meth"])
60
+ assert_equal(["#{test_alcn}#method-c-test_meth", 'TestPathHandlerApi::test_meth'],
61
+ @website.ext.link_definitions['my_api:TestPathHandlerApi::test_meth'])
62
+ assert(@website.tree["#{test_alcn}#attribute-i-test_attr"])
63
+ assert_equal(["#{test_alcn}#attribute-i-test_attr", 'TestPathHandlerApi#test_attr'],
64
+ @website.ext.link_definitions['my_api:TestPathHandlerApi#test_attr'])
65
+ assert(@website.tree["#{test_alcn}#TEST_CONST"])
66
+ assert_equal(["#{test_alcn}#TEST_CONST", 'TestPathHandlerApi::TEST_CONST'],
67
+ @website.ext.link_definitions['my_api:TestPathHandlerApi::TEST_CONST'])
47
68
  assert(@website.tree['/my_dir/API_rdoc.en.html'])
48
69
  assert(@website.tree['/my_dir/TestPathHandlerApi/SampleTestSubclass.en.html'])
49
70
 
71
+ collector = lambda do |node|
72
+ node.children.empty? ? node.lcn : [node.lcn, node.children.map(&collector)]
73
+ end
74
+ result = @website.tree[test_alcn].children.map(&collector)
75
+
76
+ assert_equal([["#Constants", ["#OTHER_CONST", "#TEST_CONST"]],
77
+ ["#Attributes", ["#attribute-i-other_attr", "#attribute-i-test_attr"]],
78
+ ["#Class-Methods", ["#method-c-other_meth", "#method-c-test_meth"]],
79
+ ["#Instance-Methods", ["#method-i-assert_common_tests_for_create_nodes",
80
+ "#method-i-setup", "#method-i-setup_for_create_nodes", "#method-i-teardown",
81
+ "#method-i-test_create_nodes", "#method-i-test_create_nodes_hierarchical",
82
+ "#method-i-test_rdoc_options", "#method-i-test_rdoc_store"]]], result)
83
+
50
84
  cache_dir = @website.tmpdir(File.join('path_handler.api', 'my_api'))
51
85
  assert(File.directory?(cache_dir))
52
86
  end
@@ -74,10 +74,12 @@ class TestContext < Minitest::Test
74
74
  @context.html_head.inline_fragment(:css, "content")
75
75
  @context.html_head.inline_fragment(:js, "content")
76
76
  @context.html_head.meta('name', 'content')
77
+ @context.html_head.meta_property('property', 'content')
77
78
 
78
79
  assert_equal(['content'], @context.persistent[:cp_html_head][:css_inline])
79
80
  assert_equal(['content'], @context.persistent[:cp_html_head][:js_inline])
80
81
  assert_equal({'name' => 'content'}, @context.persistent[:cp_html_head][:meta])
82
+ assert_equal({'property' => 'content'}, @context.persistent[:cp_html_head][:meta_property])
81
83
  end
82
84
 
83
85
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-06 00:00:00.000000000 Z
11
+ date: 2020-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdparse
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '1.3'
53
+ version: '2.3'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '1.3'
60
+ version: '2.3'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '4.0'
137
+ version: '5.0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '4.0'
144
+ version: '5.0'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: sass
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -176,14 +176,14 @@ dependencies:
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '4.0'
179
+ version: '6.0'
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '4.0'
186
+ version: '6.0'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: coderay
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -516,8 +516,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
516
516
  - !ruby/object:Gem::Version
517
517
  version: '0'
518
518
  requirements: []
519
- rubyforge_project:
520
- rubygems_version: 2.7.3
519
+ rubygems_version: 3.0.3
521
520
  signing_key:
522
521
  specification_version: 4
523
522
  summary: webgen is a fast, powerful, and extensible static website generator.