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

github.com/git/git-scm.com.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2022-10-05 14:01:07 +0300
committerJeff King <peff@peff.net>2022-10-05 16:28:15 +0300
commitd1c799b1cd92244c80a103e0beccc00c5ce2ade4 (patch)
tree73ff242f22c8ada920f2a7670007d490ef086d9e
parentc5e8c4d0cd77b301c0a45100ea7b9f94a7c64bfa (diff)
run rubocop --autocorrect-all --only Style/SafeNavigation
These were made possible by pulling the xlink assignments to their own line in the previous commit.
-rw-r--r--lib/tasks/book2.rake42
1 files changed, 18 insertions, 24 deletions
diff --git a/lib/tasks/book2.rake b/lib/tasks/book2.rake
index 83d85d26..a0de3930 100644
--- a/lib/tasks/book2.rake
+++ b/lib/tasks/book2.rake
@@ -137,38 +137,32 @@ def genbook(code, &get_content)
html.gsub!(/\/h5>/, "/h4>")
xlink = html.scan(/href="1-.*?\.html\#(.*?)"/)
- if xlink
- xlink.each do |link|
- xref = link.first
- begin
- html.gsub!(/href="1-.*?\.html\##{xref}"/, "href=\"ch00/#{xref}\"")
- rescue StandardError
- nil
- end
+ xlink&.each do |link|
+ xref = link.first
+ begin
+ html.gsub!(/href="1-.*?\.html\##{xref}"/, "href=\"ch00/#{xref}\"")
+ rescue StandardError
+ nil
end
end
xlink = html.scan(/href="\#(.*?)"/)
- if xlink
- xlink.each do |link|
- xref = link.first
- begin
- html.gsub!(/href="\##{xref}"/, "href=\"ch00/#{xref}\"")
- rescue StandardError
- nil
- end
+ xlink&.each do |link|
+ xref = link.first
+ begin
+ html.gsub!(/href="\##{xref}"/, "href=\"ch00/#{xref}\"")
+ rescue StandardError
+ nil
end
end
subsec = html.scan(/<img src="(.*?)"/)
- if subsec
- subsec.each do |sub|
- sub = sub.first
- begin
- html.gsub!(/<img src="#{sub}"/, "<img src=\"/book/en/v2/#{sub}\"")
- rescue StandardError
- nil
- end
+ subsec&.each do |sub|
+ sub = sub.first
+ begin
+ html.gsub!(/<img src="#{sub}"/, "<img src=\"/book/en/v2/#{sub}\"")
+ rescue StandardError
+ nil
end
end