bin/benchmark.rb in wp2txt-0.7.0 vs bin/benchmark.rb in wp2txt-0.7.5

- old
+ new

@@ -20,16 +20,17 @@ Benchmark.bm do |x| x.report do wpconv = Wp2txt::Runner.new(parent, input_file, output_dir, tfile_size, convert, strip_tmarker) wpconv.extract_text do |article| - title = format_wiki! article.title - title = "[[#{title}]]\n" + format_wiki!(article.title) + title = "[[#{article.title}]]\n" + convert_characters!(title) - contents = "\nCATEGORIES: " - contents += article.categories.join(", ") - contents += "\n\n" + contents = "\nCATEGORIES: " + contents += article.categories.join(", ") + contents += "\n\n" article.elements.each do |e| case e.first when :mw_heading format_wiki!(e.last) @@ -53,13 +54,14 @@ line = e.last line += "\n\n" else next end - contents += line - remove_templates!(contents) + contents << line end - + format_article!(contents) + convert_characters!(contents) + ##### cleanup ##### if /\A\s*\z/m =~ contents result = "" else result = title + "\n" + contents