Add draft link support to analyze.rb

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2024-08-08 17:54:25 -07:00
parent bf9b0aedf9
commit 7817c9a4ce

View File

@ -25,8 +25,9 @@ Dir['content/blog/**/*.md'].each do |file|
file = file.chomp
files << file
arr = refs[file] || (refs[file] = [])
File.open(file).read.scan(/< relref "([^"]+)" >/) do |ref|
ref = resolve_path(File.dirname(file), ref[0])
pattern = Regexp.union(/< relref "([^"]+)" >/, /< draftlink "[^"]+" "([^"]+)" >/)
File.open(file).read.scan(pattern) do |ref|
ref = resolve_path(File.dirname(file), ref[0] || ref[1])
arr << ref
files << ref
end