coradoc 2.0.26 → 2.0.27

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: 6b56fd30c086580f71f5b576a209ba6ad20c5aa590fbd09d62477a7f85a4988f
4
- data.tar.gz: 8be8c3211cf7dc7d1545c8d86966687c645e4929046d65c54a4a2d4f6c9f5cd2
3
+ metadata.gz: 6f0a260bb97d25d5c24d430e81c1f4c8c4a0d816612d4826ab890f8d96b22d14
4
+ data.tar.gz: e65497a27738a34a7bfb8800386318419202314e12844b551f49ee6a02894aaf
5
5
  SHA512:
6
- metadata.gz: 9d6ec746cd4a049f0668aa367091817faf0c87ed9c35840f3b548124836701c0f1ac6c0ddc99fcdcb5420e6c15e3f972eec6c869c055d464dc518049af4d242c
7
- data.tar.gz: 33abcf1caabfb83b74f803affc8a12d4f74bd9290e0607d91a7033121db317229831c43da321edcf30dc3c97a080ca6b304c1186101dc17038867413ad8e802f
6
+ metadata.gz: d45b3690762230b10766ffabc1228b42533f30d8acc28016f226a6ea692bc4403f9589996e8bf61d059f8fddf29c1f9d6adaa1c98b4593089886089bedc4e1e5
7
+ data.tar.gz: 9c70fcfee207fd897113f62beb55c08c1cff19212daa65b8590f65a2af4a4221d00162529df154c50b38b3578f48c96adf431fea03c1dda4ed59228ebc57c680
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coradoc
4
+ module CoreModel
5
+ class AbstractBlock < Block
6
+ def self.semantic_type
7
+ :abstract
8
+ end
9
+ end
10
+ end
11
+ end
@@ -41,6 +41,13 @@ module Coradoc
41
41
  # @return [Array<MetadataEntry>] additional metadata entries
42
42
  attribute :metadata_entries, MetadataEntry, collection: true
43
43
 
44
+ # 1-indexed source line where this element begins, when known.
45
+ # Populated by format transformers (e.g., AsciiDoc's SourceLineExtractor)
46
+ # so consumers can map AST nodes back to the source text. nil for
47
+ # programmatically constructed models. Single source of truth across
48
+ # all CoreModel types (Issue 1, STATUS-2026-06-28).
49
+ attribute :source_line, :integer
50
+
44
51
  # Construct an instance and yield it for in-place mutation.
45
52
  #
46
53
  # This is the programmatic-construction entry point for CoreModel
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coradoc
4
+ module CoreModel
5
+ class PartintroBlock < Block
6
+ def self.semantic_type
7
+ :partintro
8
+ end
9
+ end
10
+ end
11
+ end
@@ -69,6 +69,8 @@ module Coradoc
69
69
  autoload :ExampleBlock, "#{__dir__}/core_model/example_block"
70
70
  autoload :QuoteBlock, "#{__dir__}/core_model/quote_block"
71
71
  autoload :SidebarBlock, "#{__dir__}/core_model/sidebar_block"
72
+ autoload :AbstractBlock, "#{__dir__}/core_model/abstract_block"
73
+ autoload :PartintroBlock, "#{__dir__}/core_model/partintro_block"
72
74
  autoload :LiteralBlock, "#{__dir__}/core_model/literal_block"
73
75
  autoload :PassBlock, "#{__dir__}/core_model/pass_block"
74
76
  autoload :StemBlock, "#{__dir__}/core_model/stem_block"
@@ -360,7 +360,7 @@ module Coradoc
360
360
  private
361
361
 
362
362
  def build_message
363
- msg = "Format '#{requested_format}' is not supported"
363
+ msg = "Format '#{requested_format}' is not registered"
364
364
  msg += ". Available formats: #{available_formats.join(', ')}" if available_formats.any?
365
365
  msg
366
366
  end
@@ -14,9 +14,8 @@ module Coradoc
14
14
  def parse(text, format:)
15
15
  format_module = FormatCatalog.get_format(format)
16
16
  unless format_module
17
- raise UnsupportedFormatError,
18
- "Format '#{format}' is not registered. " \
19
- "Available formats: #{FormatCatalog.registered_formats.join(', ')}"
17
+ raise UnsupportedFormatError.new(format,
18
+ available: FormatCatalog.registered_formats)
20
19
  end
21
20
 
22
21
  text = Hooks.invoke(:before_parse, text, format: format)
@@ -66,7 +65,7 @@ module Coradoc
66
65
 
67
66
  def serialize(model, to:, **)
68
67
  format_module = FormatCatalog.get_format(to)
69
- raise UnsupportedFormatError, "Format '#{to}' is not registered" unless format_module
68
+ raise UnsupportedFormatError.new(to, available: FormatCatalog.registered_formats) unless format_module
70
69
 
71
70
  model = Hooks.invoke(:before_serialize, model, format: to)
72
71
  result = format_module.serialize(model, **)
@@ -84,7 +83,10 @@ module Coradoc
84
83
  raise UnsupportedFormatError, "Could not detect format for: #{path}" unless source_format
85
84
 
86
85
  format_module = FormatCatalog.get_format(source_format)
87
- raise UnsupportedFormatError, "Format '#{source_format}' is not registered" unless format_module
86
+ unless format_module
87
+ raise UnsupportedFormatError.new(source_format,
88
+ available: FormatCatalog.registered_formats)
89
+ end
88
90
 
89
91
  if FormatCatalog.binary_format?(source_format)
90
92
  format_module.parse_to_core(path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coradoc
4
- VERSION = '2.0.26'
4
+ VERSION = '2.0.27'
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.26
4
+ version: 2.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -55,6 +55,7 @@ files:
55
55
  - lib/coradoc/configurable.rb
56
56
  - lib/coradoc/coradoc.rb
57
57
  - lib/coradoc/core_model.rb
58
+ - lib/coradoc/core_model/abstract_block.rb
58
59
  - lib/coradoc/core_model/annotation_block.rb
59
60
  - lib/coradoc/core_model/attribute_reference_resolver.rb
60
61
  - lib/coradoc/core_model/base.rb
@@ -94,6 +95,7 @@ files:
94
95
  - lib/coradoc/core_model/open_block.rb
95
96
  - lib/coradoc/core_model/output_artifact.rb
96
97
  - lib/coradoc/core_model/paragraph_block.rb
98
+ - lib/coradoc/core_model/partintro_block.rb
97
99
  - lib/coradoc/core_model/pass_block.rb
98
100
  - lib/coradoc/core_model/quote_block.rb
99
101
  - lib/coradoc/core_model/raw_inline_element.rb