Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/checks/anchors.rb18
-rw-r--r--lib/gitlab/symlinks_converter.rb13
2 files changed, 15 insertions, 16 deletions
diff --git a/lib/checks/anchors.rb b/lib/checks/anchors.rb
index f7dc5d52..79ecbd08 100644
--- a/lib/checks/anchors.rb
+++ b/lib/checks/anchors.rb
@@ -7,15 +7,15 @@ Nanoc::Check.define(:internal_anchors) do
next unless link.to_anchor?
next if link.anchor_name == 'markdown-toc'
- if link.destination_anchor_not_found?
- add_issue <<~ERROR
- Broken anchor detected!
- - source file `#{link.source_file}`
- - destination `#{link.destination_file}`
- - link `#{link.href}`
- - anchor `##{link.anchor_name}`
- ERROR
- end
+ next unless link.destination_anchor_not_found?
+
+ add_issue <<~ERROR
+ Broken anchor detected!
+ - source file `#{link.source_file}`
+ - destination `#{link.destination_file}`
+ - link `#{link.href}`
+ - anchor `##{link.anchor_name}`
+ ERROR
end
end
add_issue "#{issues.count} offenses found!" if issues.count.positive?
diff --git a/lib/gitlab/symlinks_converter.rb b/lib/gitlab/symlinks_converter.rb
index ade5f0f4..48b6a732 100644
--- a/lib/gitlab/symlinks_converter.rb
+++ b/lib/gitlab/symlinks_converter.rb
@@ -20,15 +20,14 @@ module Gitlab
id = item.identifier
next unless id.to_s.start_with?('/ee/')
+ next unless EXTENSIONS.include?(id.ext)
- if EXTENSIONS.include?(id.ext)
- file_path = File.join(config.fetch(:content_dir), id.to_s)
- real_path = Pathname.new(file_path).realpath.to_s
- symlink = File.join(config.output_dir, id.to_s)
+ file_path = File.join(config.fetch(:content_dir), id.to_s)
+ real_path = Pathname.new(file_path).realpath.to_s
+ symlink = File.join(config.output_dir, id.to_s)
- # Replace a file with a symlink
- File.delete(symlink) && File.symlink(real_path, symlink) if File.exist?(symlink)
- end
+ # Replace a file with a symlink
+ File.delete(symlink) && File.symlink(real_path, symlink) if File.exist?(symlink)
end
end