card-mod-content 0.13.4 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/card/content/chunk/link.rb +2 -6
- data/lib/card/content/chunk/nest.rb +1 -1
- data/lib/card/content/chunk/query_reference.rb +1 -1
- data/lib/card/content/chunk/reference.rb +12 -7
- data/set/abstract/01_code_file.rb +1 -0
- data/set/abstract/lock.rb +1 -1
- data/set/all/templating.rb +23 -27
- data/set/right/default.rb +1 -1
- data/set/right/structure.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 787c9c826bc3774c5768367aa580523fa4c9761bd5666f1e5f0f20bd63e232a1
|
4
|
+
data.tar.gz: 1502d97db6bf3f12eff75e092d709bfa182739cf26bb1e8407e60c1b835e0beb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dbc01b4028df133a64ecaaa11f623f39478fb0de84717c9935bd678f1a4ba21aee46dd50f2602481a976a74f8965a77a0bdddeec58f2c585e9645b56d5226ec
|
7
|
+
data.tar.gz: 3dbee3c56ee6c25477c2aa5f1d6d43f1030f8dff43c081b0621707f42b85145348532fb5fa6fc9313becfbc09a50a7a4232db76c6a0ba3767eae4cff676620e7
|
@@ -32,7 +32,7 @@ class Card
|
|
32
32
|
link_text ? { title: link_text } : {}
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def swap_name old_name, new_name
|
36
36
|
replace_name_reference old_name, new_name
|
37
37
|
replace_link_text old_name, new_name
|
38
38
|
link_text_syntax = "|#{@link_text}" if @link_text.present?
|
@@ -122,11 +122,7 @@ class Card
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def replace_link_text old_name, new_name
|
125
|
-
|
126
|
-
@link_text.find_chunks(:Reference).each do |chunk|
|
127
|
-
chunk.replace_reference old_name, new_name
|
128
|
-
end
|
129
|
-
elsif @link_text.present?
|
125
|
+
replacing_content_object @link_text, old_name, new_name do
|
130
126
|
@link_text = old_name.to_name.sub_in(@link_text, with: new_name)
|
131
127
|
end
|
132
128
|
end
|
@@ -76,7 +76,7 @@ class Card
|
|
76
76
|
# this is not necessarily text, sometimes objects for json
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
79
|
+
def swap_name old_name, new_name
|
80
80
|
replace_name_reference old_name, new_name
|
81
81
|
nest_body = [@name.to_s, @opt_lists].compact * "|"
|
82
82
|
@text = "{{#{nest_body}}}"
|
@@ -27,17 +27,22 @@ class Card
|
|
27
27
|
private
|
28
28
|
|
29
29
|
def replace_name_reference old_name, new_name
|
30
|
-
@referee_card = nil
|
31
|
-
|
32
|
-
if name.is_a? Content
|
33
|
-
name.find_chunks(:Reference).each do |chunk|
|
34
|
-
chunk.replace_reference old_name, new_name
|
35
|
-
end
|
36
|
-
else
|
30
|
+
@referee_card = @referee_name = nil
|
31
|
+
replacing_content_object name, old_name, new_name do
|
37
32
|
@name = name.to_name.swap old_name, new_name
|
38
33
|
end
|
39
34
|
end
|
40
35
|
|
36
|
+
def replacing_content_object obj, old_name, new_name
|
37
|
+
if obj.is_a? Content
|
38
|
+
obj.find_chunks(:Reference).each do |chunk|
|
39
|
+
chunk.swap_name old_name, new_name
|
40
|
+
end
|
41
|
+
elsif obj.present?
|
42
|
+
yield
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
41
46
|
def render_obj raw
|
42
47
|
return raw unless format && raw.is_a?(Content)
|
43
48
|
|
data/set/abstract/lock.rb
CHANGED
data/set/all/templating.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
def is_template?
|
2
2
|
return @is_template unless @is_template.nil?
|
3
3
|
|
4
|
-
@is_template = name.
|
4
|
+
@is_template = name.right_name&.codename&.in? %i[structure default]
|
5
5
|
end
|
6
6
|
|
7
7
|
def is_structure?
|
8
8
|
return @is_structure unless @is_structure.nil?
|
9
9
|
|
10
|
-
@is_structure = name.
|
10
|
+
@is_structure = name.right_name&.codename == :structure
|
11
11
|
end
|
12
12
|
|
13
13
|
def template
|
@@ -24,31 +24,6 @@ def template
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def default_type_id
|
28
|
-
Card.default_type_id
|
29
|
-
end
|
30
|
-
|
31
|
-
def new_card_template
|
32
|
-
default = rule_card :default, skip_modules: true
|
33
|
-
return default unless (structure = dup_structure default&.type_id)
|
34
|
-
|
35
|
-
@virtual = true if compound?
|
36
|
-
self.type_id = structure.type_id if assign_type_to?(structure)
|
37
|
-
structure
|
38
|
-
end
|
39
|
-
|
40
|
-
def dup_structure type_id
|
41
|
-
dup_card = dup
|
42
|
-
dup_card.type_id = type_id || default_type_id
|
43
|
-
dup_card.structure_rule_card
|
44
|
-
end
|
45
|
-
|
46
|
-
def assign_type_to? structure
|
47
|
-
return if type_id == structure.type_id
|
48
|
-
|
49
|
-
structure.assigns_type?
|
50
|
-
end
|
51
|
-
|
52
27
|
def assigns_type?
|
53
28
|
# needed because not all *structure templates govern the type of set members
|
54
29
|
# for example, X+*type+*structure governs all cards of type X,
|
@@ -68,3 +43,24 @@ def structure_rule_card
|
|
68
43
|
|
69
44
|
card.db_content&.strip == "_self" ? nil : card
|
70
45
|
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def new_card_template
|
50
|
+
default = rule_card :default, skip_modules: true
|
51
|
+
return default unless (structure = dup_structure default&.type_id)
|
52
|
+
|
53
|
+
@virtual = true if compound?
|
54
|
+
self.type_id = structure.type_id if assign_type_to?(structure)
|
55
|
+
structure
|
56
|
+
end
|
57
|
+
|
58
|
+
def dup_structure type_id
|
59
|
+
dup_card = dup
|
60
|
+
dup_card.type_id = type_id || Card.default_type_id
|
61
|
+
dup_card.structure_rule_card
|
62
|
+
end
|
63
|
+
|
64
|
+
def assign_type_to? structure
|
65
|
+
type_id == structure.type_id && structure.assigns_type?
|
66
|
+
end
|
data/set/right/default.rb
CHANGED
@@ -23,7 +23,7 @@ format :html do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def visible_cardtype_groups
|
26
|
-
hash = ::
|
26
|
+
hash = All::CardtypeGroups::GROUP.slice("Text", "Data", "Upload")
|
27
27
|
hash["Organize"] = ["List", "Pointer", "Link list", "Nest list"]
|
28
28
|
hash
|
29
29
|
end
|
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.
|
4
|
+
version: 0.14.0
|
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-12-22 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.
|
21
|
+
version: 1.104.0
|
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.
|
28
|
+
version: 1.104.0
|
29
29
|
description: ''
|
30
30
|
email:
|
31
31
|
- info@decko.org
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.2.15
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: card content handling
|