coradoc 2.0.20 → 2.0.21

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: 05f1c48e0de6edb3f2473ab0e1c0cdb4747c513bf805820b8456846888b86c37
4
- data.tar.gz: caaadd87ea878292673070688c08c8a7bfb7c39c58173f928e1960eb5af397ad
3
+ metadata.gz: a4ebd4f989cb1c3bc9c6adcede592e91c6013a29bf94c3d12319e03c5c42ab38
4
+ data.tar.gz: d321f36297bb31aac76fe30a6195aa9cd1456c840dfb1888405c0e36f474c4b7
5
5
  SHA512:
6
- metadata.gz: 86f2108a83a94d30b5660586c5b83085b1b9f1ebd0ab470d21292f258cc0473d4769eb266394082d335a7d39ed2499297f0d4d1f1e2ac517c42f3d5b3bbe3527
7
- data.tar.gz: aa4241a2a9c0ae8cec854b747b76a709bb8954b9bbbf6a3c15b3ebaad77f7b1dea199fc57129541fadcce94bee957cde48f7c3bda906379a5095a4893efdd0e1
6
+ metadata.gz: 1bba8d765b1af164d1713f16013eddbdbc906340f37d1918777fd3ec1c6f1ec784e869155ccae100b6d4a4306bea003c4031fbf6276890608471a97d5a407bd2
7
+ data.tar.gz: e76a4e152ebbc25ee03732c6870fbfbdf062d8a3e0af8423b4da9486d14483952a56a3af6b25c256a6350e60e475afa89112e25931b08b47209884ceb1e8089a
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coradoc
4
+ module CoreModel
5
+ # Inline raw passthrough — content the source format marked as "do not
6
+ # process". AsciiDoc's `+++raw+++` is the canonical producer. Spokes
7
+ # that lack a passthrough concept (most of them) should emit the
8
+ # content verbatim, since the original author explicitly chose raw
9
+ # markup (often HTML) knowing it would be passed through.
10
+ class RawInlineElement < InlineElement
11
+ def self.format_type
12
+ 'raw_inline'
13
+ end
14
+ end
15
+ end
16
+ end
@@ -36,6 +36,7 @@ module Coradoc
36
36
  autoload :SpanElement, "#{__dir__}/core_model/inline_element"
37
37
  autoload :TermElement, "#{__dir__}/core_model/inline_element"
38
38
  autoload :LineBreakElement, "#{__dir__}/core_model/inline_element"
39
+ autoload :RawInlineElement, "#{__dir__}/core_model/raw_inline_element"
39
40
  autoload :StructuralElement, "#{__dir__}/core_model/structural_element"
40
41
  autoload :DocumentElement, "#{__dir__}/core_model/structural_element"
41
42
  autoload :SectionElement, "#{__dir__}/core_model/structural_element"
@@ -23,6 +23,11 @@ module Coradoc
23
23
  def passed?
24
24
  duration < threshold
25
25
  end
26
+
27
+ def format_line
28
+ status = passed? ? 'PASS' : 'FAIL'
29
+ " #{status} #{name}: #{duration.round(4)}s (threshold: #{threshold}s)"
30
+ end
26
31
  end
27
32
 
28
33
  ComparisonResult = Struct.new(:name, :duration, :baseline, keyword_init: true) do
@@ -31,6 +36,12 @@ module Coradoc
31
36
 
32
37
  (duration - baseline).abs / baseline > pct
33
38
  end
39
+
40
+ def format_line
41
+ status = regressed? ? 'WARN' : 'OK'
42
+ baseline_str = baseline ? "(baseline: #{baseline.round(4)}s)" : '(no baseline)'
43
+ " #{status} #{name}: #{duration.round(4)}s #{baseline_str}"
44
+ end
34
45
  end
35
46
 
36
47
  class << self
@@ -50,14 +61,15 @@ module Coradoc
50
61
  { results:, failed_count: failed, total: results.size }
51
62
  end
52
63
 
53
- def print_results(summary)
54
- results = summary[:results]
55
- results.each do |r|
56
- status = r.passed? ? 'PASS' : 'FAIL'
57
- puts " #{status} #{r.name}: #{r.duration.round(4)}s (threshold: #{r.threshold}s)"
64
+ def print_results(summary_or_results)
65
+ if summary_or_results.is_a?(Hash)
66
+ summary = summary_or_results
67
+ summary[:results].each { |r| puts r.format_line }
68
+ puts
69
+ puts "#{summary[:total] - summary[:failed_count]}/#{summary[:total]} passed"
70
+ else
71
+ Array(summary_or_results).each { |r| puts r.format_line }
58
72
  end
59
- puts
60
- puts "#{summary[:total] - summary[:failed_count]}/#{summary[:total]} passed"
61
73
  end
62
74
 
63
75
  def compare_with_baseline(baseline_path, iterations: 3)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coradoc
4
- VERSION = '2.0.20'
4
+ VERSION = '2.0.21'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coradoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.20
4
+ version: 2.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -88,6 +88,7 @@ files:
88
88
  - lib/coradoc/core_model/paragraph_block.rb
89
89
  - lib/coradoc/core_model/pass_block.rb
90
90
  - lib/coradoc/core_model/quote_block.rb
91
+ - lib/coradoc/core_model/raw_inline_element.rb
91
92
  - lib/coradoc/core_model/reviewer_block.rb
92
93
  - lib/coradoc/core_model/sidebar_block.rb
93
94
  - lib/coradoc/core_model/source_block.rb