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 +4 -4
- data/lib/coradoc/core_model/abstract_block.rb +11 -0
- data/lib/coradoc/core_model/base.rb +7 -0
- data/lib/coradoc/core_model/partintro_block.rb +11 -0
- data/lib/coradoc/core_model.rb +2 -0
- data/lib/coradoc/errors.rb +1 -1
- data/lib/coradoc/pipeline.rb +7 -5
- data/lib/coradoc/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f0a260bb97d25d5c24d430e81c1f4c8c4a0d816612d4826ab890f8d96b22d14
|
|
4
|
+
data.tar.gz: e65497a27738a34a7bfb8800386318419202314e12844b551f49ee6a02894aaf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d45b3690762230b10766ffabc1228b42533f30d8acc28016f226a6ea692bc4403f9589996e8bf61d059f8fddf29c1f9d6adaa1c98b4593089886089bedc4e1e5
|
|
7
|
+
data.tar.gz: 9c70fcfee207fd897113f62beb55c08c1cff19212daa65b8590f65a2af4a4221d00162529df154c50b38b3578f48c96adf431fea03c1dda4ed59228ebc57c680
|
|
@@ -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
|
data/lib/coradoc/core_model.rb
CHANGED
|
@@ -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"
|
data/lib/coradoc/errors.rb
CHANGED
|
@@ -360,7 +360,7 @@ module Coradoc
|
|
|
360
360
|
private
|
|
361
361
|
|
|
362
362
|
def build_message
|
|
363
|
-
msg = "Format '#{requested_format}' is not
|
|
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
|
data/lib/coradoc/pipeline.rb
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
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
|
-
|
|
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)
|
data/lib/coradoc/version.rb
CHANGED
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.
|
|
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
|