metanorma-standoc 3.1.7 → 3.1.8
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/metanorma/standoc/isolated_converter.rb +20 -19
- data/lib/metanorma/standoc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f9dbe3941901bd06b1d493edd4fd500dc586fb067d74acabdb57827ffd1185c
|
4
|
+
data.tar.gz: beb8a1972200318ed816475c263785333fdbfcc0657250602dfc4612cc935796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08a120c27f5e2bdfb9f86e8b459bd859f7de1b3d2188fa9050ffacd4dc4cd56dc77ac410856cd7a559f73340be5d1e6655c56aab83032fc869060b37c9df91ae'
|
7
|
+
data.tar.gz: 21c8fbe6de245752b97baff1a8d186b40de89da53f063e9722882276e200a76a8afb45ad12871e9e084adebc3c774639fc6a2bf7c715a90d3df762413b887285
|
@@ -1,27 +1,28 @@
|
|
1
1
|
module Metanorma
|
2
2
|
module Standoc
|
3
3
|
module IsolatedConverter
|
4
|
-
# Create an isolated Asciidoctor conversion that doesn't interfere with
|
4
|
+
# Create an isolated Asciidoctor conversion that doesn't interfere with
|
5
5
|
# the current converter's instance variables
|
6
6
|
def isolated_asciidoctor_convert(content, options = {})
|
7
7
|
# Track that we're in an isolated conversion (for nested calls)
|
8
|
+
@isolated_conversion_stack ||= []
|
8
9
|
@isolated_conversion_stack << true
|
9
|
-
|
10
|
+
|
10
11
|
begin
|
11
12
|
# Ensure we get a completely fresh Document and conversion context
|
12
13
|
# Each call to Asciidoctor.convert creates a new Document with its own converter
|
13
14
|
# This naturally isolates the conversion from the current instance variables
|
14
|
-
|
15
|
+
|
15
16
|
# Save critical options that should be preserved from the current context
|
16
17
|
preserved_options = extract_preserved_options(options)
|
17
|
-
|
18
|
+
|
18
19
|
# Merge with isolated options to ensure clean state and skip validation
|
19
20
|
isolated_options = preserved_options.merge(options).merge(
|
20
21
|
attributes: (preserved_options[:attributes] || {}).merge(
|
21
|
-
|
22
|
-
)
|
22
|
+
"novalid" => "", # Force no validation for isolated documents
|
23
|
+
),
|
23
24
|
)
|
24
|
-
|
25
|
+
|
25
26
|
# Perform the isolated conversion
|
26
27
|
Asciidoctor.convert(content, isolated_options)
|
27
28
|
ensure
|
@@ -33,20 +34,20 @@ module Metanorma
|
|
33
34
|
private
|
34
35
|
|
35
36
|
# Extract options that should be preserved from the current conversion context
|
36
|
-
def extract_preserved_options(
|
37
|
+
def extract_preserved_options(user_opt)
|
37
38
|
options = {}
|
38
|
-
|
39
|
+
|
39
40
|
# Preserve safe mode to maintain security context
|
40
|
-
options[:safe] =
|
41
|
-
|
41
|
+
options[:safe] = user_opt[:safe] if user_opt.key?(:safe)
|
42
|
+
|
42
43
|
# Preserve local directory context if not explicitly overridden
|
43
|
-
|
44
|
-
|
44
|
+
@localdir && !user_opt.key?(:base_dir) and
|
45
|
+
options[:base_dir] = @localdir
|
46
|
+
|
45
47
|
# Preserve attributes that are safe to share
|
46
|
-
|
48
|
+
user_opt[:attributes].nil? && respond_to?(:safe_shared_attributes) and
|
47
49
|
options[:attributes] = safe_shared_attributes
|
48
|
-
|
49
|
-
|
50
|
+
|
50
51
|
options
|
51
52
|
end
|
52
53
|
|
@@ -55,9 +56,9 @@ module Metanorma
|
|
55
56
|
# Only include read-only or configuration attributes
|
56
57
|
# Avoid any attributes that could cause state pollution
|
57
58
|
{
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
"source-highlighter" => "html-pipeline", # Use simple highlighter
|
60
|
+
"nofooter" => "",
|
61
|
+
"no-header-footer" => "",
|
61
62
|
}
|
62
63
|
end
|
63
64
|
end
|