card-mod-content 0.11.3 → 0.11.4
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/card/content/chunk/link.rb +1 -1
- data/lib/card/content/chunk/reference.rb +10 -22
- data/set/all/chunk.rb +4 -5
- data/set/right/structure.rb +4 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9917d5bafaf177dfb0cf51f5b0e4a03f813ee2d1e06dae87d4544a4bd8c2dbf
|
4
|
+
data.tar.gz: 62bb2508ff022bdf31fb268577c8277e6fbdc88cf5348fe0c31fd0ab68248e9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f80c399e98d4191f749e3fb1eb6fb9c8eb29f37eb7c80f330ba0e05ab67d1406cd2148459b532ba9ec92b65421d7e7cc1451486eca6e5fe522c99825964a1e8
|
7
|
+
data.tar.gz: ef15f9bb7f4b9877e53b5fa1217bf903d2f1e56a97e244ca845e8c637854125f88670b6c115d68898a0227d2778aa961339b84f9ff7663e5b69643165b44ba8a
|
@@ -107,7 +107,7 @@ class Card
|
|
107
107
|
|
108
108
|
def replace_link_text old_name, new_name
|
109
109
|
if @link_text.is_a?(Card::Content)
|
110
|
-
@link_text.find_chunks(
|
110
|
+
@link_text.find_chunks(:Reference).each do |chunk|
|
111
111
|
chunk.replace_reference old_name, new_name
|
112
112
|
end
|
113
113
|
elsif @link_text.present?
|
@@ -9,26 +9,27 @@ class Card
|
|
9
9
|
|
10
10
|
def referee_name
|
11
11
|
return if name.nil?
|
12
|
-
@referee_name ||=
|
13
|
-
@referee_name = @referee_name.
|
12
|
+
@referee_name ||= referee_raw_name
|
13
|
+
@referee_name = @referee_name.absolute_name card.name
|
14
14
|
rescue Card::Error::NotFound
|
15
15
|
# do not break on missing id/codename references.
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
20
|
-
ref_card ? ref_card.name : rendered_name.to_name
|
18
|
+
def referee_raw_name
|
19
|
+
Name[render_obj(name)]
|
21
20
|
end
|
22
21
|
|
23
22
|
def referee_card
|
24
23
|
@referee_card ||= referee_name && Card.fetch(referee_name)
|
25
24
|
end
|
26
25
|
|
26
|
+
private
|
27
|
+
|
27
28
|
def replace_name_reference old_name, new_name
|
28
29
|
@referee_card = nil
|
29
30
|
@referee_name = nil
|
30
|
-
if name.is_a?
|
31
|
-
name.find_chunks(
|
31
|
+
if name.is_a? Content
|
32
|
+
name.find_chunks(:Reference).each do |chunk|
|
32
33
|
chunk.replace_reference old_name, new_name
|
33
34
|
end
|
34
35
|
else
|
@@ -37,22 +38,9 @@ class Card
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def render_obj raw
|
40
|
-
|
41
|
-
format.process_content raw
|
42
|
-
else
|
43
|
-
raw
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
41
|
+
return raw unless format && raw.is_a?(Content)
|
48
42
|
|
49
|
-
|
50
|
-
case rendered_name # FIXME: this should be standard fetch option.
|
51
|
-
when /^\~(\d+)$/ # get by id
|
52
|
-
Card.fetch Regexp.last_match(1).to_i
|
53
|
-
when /^\:(\w+)$/ # get by codename
|
54
|
-
Card.fetch Regexp.last_match(1).to_sym
|
55
|
-
end
|
43
|
+
format.process_content raw
|
56
44
|
end
|
57
45
|
end
|
58
46
|
end
|
data/set/all/chunk.rb
CHANGED
@@ -1,23 +1,22 @@
|
|
1
1
|
|
2
|
-
def chunks content, type, named=false
|
2
|
+
def chunks content, type=nil, named=false
|
3
3
|
content ||= self.content
|
4
|
-
type ||= Card::Content::Chunk
|
5
4
|
all_chunks = Card::Content.new(content, self).find_chunks type
|
6
5
|
named ? all_chunks.select(&:referee_name) : all_chunks
|
7
6
|
end
|
8
7
|
|
9
8
|
def reference_chunks content=nil, named=true
|
10
|
-
chunks content,
|
9
|
+
chunks content, :Reference, named
|
11
10
|
end
|
12
11
|
|
13
12
|
# named=true rejects commented nests
|
14
13
|
def nest_chunks content=nil, named=true
|
15
|
-
chunks content,
|
14
|
+
chunks content, :Nest, named
|
16
15
|
end
|
17
16
|
|
18
17
|
# named=true rejects external links (since the don't refer to a card name)
|
19
18
|
def link_chunks content=nil, named=false
|
20
|
-
chunks content,
|
19
|
+
chunks content, :Link, named
|
21
20
|
end
|
22
21
|
|
23
22
|
def each_item_name_with_options content=nil
|
data/set/right/structure.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-content
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.101.
|
21
|
+
version: 1.101.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.101.
|
28
|
+
version: 1.101.4
|
29
29
|
description: ''
|
30
30
|
email:
|
31
31
|
- info@decko.org
|