jekyll-wikilinks 0.0.9 → 0.0.10
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/jekyll-wikilinks/util/link_index.rb +29 -19
- data/lib/jekyll-wikilinks/util/wikilink.rb +14 -7
- data/lib/jekyll-wikilinks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9067c4d2ad9673d39b79195cb9bd4ef955e5cccac52702bfdd731c9d0aade4b7
|
4
|
+
data.tar.gz: 9b5a31b067e375100933d101b9bab94b8a1d19e17327ab0306cea6ea83543b18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3ff8a744de37ca82b01bed3ebeff321c43fa442a923fe9c1a19da6affbc0a54e6bc6f0a9901b86b66b223fe55a7f8277d7594e740d040faa80bfb71cc64e215
|
7
|
+
data.tar.gz: b04df5871d0c527e4d86c3e560205da232b2b1fe48bfe23919c0b400d6888ed373e6b5fffa6a6da687b89620096ef09223e0a691ec1e1dd8c00a533223f124e6
|
@@ -23,46 +23,56 @@ module Jekyll
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def populate(doc, wikilink_blocks, wikilink_inlines)
|
26
|
-
#
|
26
|
+
# #
|
27
|
+
# blocks #
|
28
|
+
# #
|
27
29
|
wikilink_blocks.each do |wlbl|
|
28
30
|
if wlbl.is_valid?
|
31
|
+
#
|
29
32
|
# attributes
|
33
|
+
#
|
30
34
|
target_attr = @index[doc.url].attributes.detect { |atr| atr['type'] == wlbl.link_type }
|
31
|
-
|
35
|
+
# create
|
32
36
|
if target_attr.nil?
|
33
37
|
@index[doc.url].attributes << wlbl.linked_fm_data
|
34
|
-
|
38
|
+
# append
|
35
39
|
else
|
36
|
-
target_attr['urls'] += wlbl.urls
|
40
|
+
target_attr['urls'] += wlbl.urls
|
37
41
|
end
|
42
|
+
## append missing docs
|
43
|
+
@index[doc.url].missing += wlbl.missing_doc_filenames
|
44
|
+
#
|
38
45
|
# attributed
|
46
|
+
#
|
39
47
|
wlbl.linked_docs.each do |linked_doc|
|
40
48
|
target_attr = @index[linked_doc.url].attributed.detect { |atr| atr['type'] == wlbl.link_type }
|
41
|
-
|
49
|
+
# create
|
42
50
|
if target_attr.nil?
|
43
51
|
@index[linked_doc.url].attributed << wlbl.context_fm_data
|
44
|
-
|
52
|
+
# append
|
45
53
|
else
|
46
54
|
target_attr['urls'] << doc.url
|
47
55
|
end
|
48
56
|
end
|
49
57
|
else
|
50
|
-
|
51
|
-
|
52
|
-
|
58
|
+
#
|
59
|
+
# invalid || empty
|
60
|
+
#
|
61
|
+
@index[doc.url].missing += wlbl.missing_doc_filenames
|
53
62
|
end
|
54
63
|
end
|
55
|
-
#
|
64
|
+
# #
|
65
|
+
# inlines #
|
66
|
+
# #
|
56
67
|
wikilink_inlines.each do |wlil|
|
57
|
-
if
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
68
|
+
return if wlil.is_img?
|
69
|
+
if wlil.is_valid?
|
70
|
+
# forelink
|
71
|
+
@index[doc.url].forelinks << wlil.linked_fm_data
|
72
|
+
# backlink
|
73
|
+
@index[wlil.linked_doc.url].backlinks << wlil.context_fm_data
|
74
|
+
else
|
75
|
+
@index[doc.url].missing << wlil.filename
|
66
76
|
end
|
67
77
|
end
|
68
78
|
end
|
@@ -68,7 +68,7 @@ module Jekyll
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def urls
|
71
|
-
# return @filenames.map { |f| @doc_mngr.get_doc_by_fname(f) }
|
71
|
+
# return @filenames.map { |f| @doc_mngr.get_doc_by_fname(f).url }.compact()
|
72
72
|
urls = []
|
73
73
|
@filenames.each do |f|
|
74
74
|
doc = @doc_mngr.get_doc_by_fname(f)
|
@@ -87,9 +87,10 @@ module Jekyll
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def linked_fm_data
|
90
|
+
valid_urls = self.urls.select{ |url| @doc_mngr.get_doc_by_url(url) }
|
90
91
|
return {
|
91
92
|
'type' => @link_type,
|
92
|
-
'urls' =>
|
93
|
+
'urls' => valid_urls,
|
93
94
|
}
|
94
95
|
end
|
95
96
|
|
@@ -106,6 +107,15 @@ module Jekyll
|
|
106
107
|
return docs
|
107
108
|
end
|
108
109
|
|
110
|
+
def missing_doc_filenames
|
111
|
+
missing_doc_fnames = []
|
112
|
+
@filenames.each do |f|
|
113
|
+
doc = @doc_mngr.get_doc_by_fname(f)
|
114
|
+
missing_doc_fnames << f if doc.nil?
|
115
|
+
end
|
116
|
+
return missing_doc_fnames
|
117
|
+
end
|
118
|
+
|
109
119
|
# descriptor methods
|
110
120
|
|
111
121
|
def has_filenames?
|
@@ -119,11 +129,8 @@ module Jekyll
|
|
119
129
|
# validation methods
|
120
130
|
|
121
131
|
def is_valid?
|
122
|
-
|
123
|
-
return false if !has_filenames?
|
124
|
-
@filenames.each do |f|
|
125
|
-
return false if !@doc_mngr.file_exists?(f)
|
126
|
-
end
|
132
|
+
all_filenames_missing = linked_docs.empty?
|
133
|
+
return false if !is_typed? || !has_filenames? || all_filenames_missing
|
127
134
|
return true
|
128
135
|
end
|
129
136
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-wikilinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- manunamz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|