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
path: root/Rules
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-11-10 02:00:26 +0300
committerConnor Shea <connor.james.shea@gmail.com>2016-11-10 02:00:26 +0300
commit810ddc9fcdab13f31e3783dc8e789f95fd559d0a (patch)
tree7e4db10eee83a13e1c90acad75ab6bcd67ccdebb /Rules
parent8e56bab9577d1e0b13f83ff0527b5b579b12fdca (diff)
Remove rescue statement. It's unnecessary now.
Diffstat (limited to 'Rules')
-rw-r--r--Rules26
1 files changed, 10 insertions, 16 deletions
diff --git a/Rules b/Rules
index 92925805..28d204f8 100644
--- a/Rules
+++ b/Rules
@@ -3,23 +3,17 @@
preprocess do
@items.each do |item|
if item.identifier.to_s.end_with?(".md") && !item.binary?
- begin
- # If the page is a redirect, make it a redirect.
- if item.raw_content =~ /^This document was moved to \[.*\]\(.*\)/m
- # Capture the intended page so the redirect page can redirect to it.
- item[:redirect] = item.raw_content.match(/^This document was moved to \[.*\]\((.*)\)/m)[1]
- # Correct the URL.
- item[:redirect] = item[:redirect].gsub!(/\.md/, '.html')
- end
-
- title = item.raw_content.match(/^[#] .*$/).to_s
- title.gsub!('# ', '')
- item[:title] = title unless title.empty?
- # Encoding errors happen on some files for some reason, so we
- # rescue them.
- rescue Encoding::CompatibilityError
- puts "(warning) Encoding error: #{item.identifier}"
+ # If the page is a redirect, make it a redirect.
+ if item.raw_content =~ /^This document was moved to \[.*\]\(.*\)/m
+ # Capture the intended page so the redirect page can redirect to it.
+ item[:redirect] = item.raw_content.match(/^This document was moved to \[.*\]\((.*)\)/m)[1]
+ # Correct the URL.
+ item[:redirect] = item[:redirect].gsub!(/\.md/, '.html')
end
+
+ title = item.raw_content.match(/^[#] .*$/).to_s
+ title.gsub!('# ', '')
+ item[:title] = title unless title.empty?
end
end
end