jekyll-wikilinks 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb34f22e418709f097d81cbcd13a0917ab903247145bb0db4846a346c0b86f38
4
- data.tar.gz: 62bff9a52a5e965a542071a0d577ea3a962c3acd604643d0955de449e924de7a
3
+ metadata.gz: 9067c4d2ad9673d39b79195cb9bd4ef955e5cccac52702bfdd731c9d0aade4b7
4
+ data.tar.gz: 9b5a31b067e375100933d101b9bab94b8a1d19e17327ab0306cea6ea83543b18
5
5
  SHA512:
6
- metadata.gz: '087c441fc74aa0da7659bf070eb3c2b079033d8a567002e00603825498afb6ef30d259372e18799506e4fc2b7b3cc3c3501f0a67dd4e559eefd463214ee6a502'
7
- data.tar.gz: 8abe1efd8a9b2eecd13b1d83599c09ee29db9e2e943ed097bf49aa000fd1a6caea2c6cedc1bb05fdce6fb4bfa3d1852b01221420e91f647d8aff61b7bce6ac50
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
- # blocks
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
- ## create
35
+ # create
32
36
  if target_attr.nil?
33
37
  @index[doc.url].attributes << wlbl.linked_fm_data
34
- ## append
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
- ## create
49
+ # create
42
50
  if target_attr.nil?
43
51
  @index[linked_doc.url].attributed << wlbl.context_fm_data
44
- ## append
52
+ # append
45
53
  else
46
54
  target_attr['urls'] << doc.url
47
55
  end
48
56
  end
49
57
  else
50
- wlbl.filenames.each do |fn|
51
- @index[doc.url].missing << fn
52
- end
58
+ #
59
+ # invalid || empty
60
+ #
61
+ @index[doc.url].missing += wlbl.missing_doc_filenames
53
62
  end
54
63
  end
55
- # inlines
64
+ # #
65
+ # inlines #
66
+ # #
56
67
  wikilink_inlines.each do |wlil|
57
- if !wlil.is_img?
58
- if wlil.is_valid?
59
- # forelink
60
- @index[doc.url].forelinks << wlil.linked_fm_data
61
- # backlink
62
- @index[wlil.linked_doc.url].backlinks << wlil.context_fm_data
63
- else
64
- @index[doc.url].missing << wlil.filename
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' => self.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
- return false if !is_typed?
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
@@ -3,7 +3,7 @@
3
3
  module Jekyll
4
4
  module WikiLinks
5
5
 
6
- VERSION = "0.0.9"
6
+ VERSION = "0.0.10"
7
7
 
8
8
  end
9
9
  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.9
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-20 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll