summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2021-05-20 01:50:22 -0600
committerDan Allen <dan.j.allen@gmail.com>2021-05-20 01:50:22 -0600
commit9065ca75e75d7dabc89b1261ba1968c3c79d452b (patch)
tree60a25bccc237b32b94c024986fa8260c37c5e38b /lib
parented36e1338242e9a51fc4e4b3535ea6275447f0ce (diff)
use next to short circuit loop with single conditional
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/parser.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/asciidoctor/parser.rb b/lib/asciidoctor/parser.rb
index 1ac090c9..c23fe9ea 100644
--- a/lib/asciidoctor/parser.rb
+++ b/lib/asciidoctor/parser.rb
@@ -1867,13 +1867,12 @@ class Parser
if explicit
# rebuild implicit author names to reparse
authors.each_with_index do |author, idx|
- unless author
- authors[idx] = [
- author_metadata[%(firstname_#{name_idx = idx + 1})],
- author_metadata[%(middlename_#{name_idx})],
- author_metadata[%(lastname_#{name_idx})]
- ].compact.map {|it| it.tr ' ', '_' }.join ' '
- end
+ next if author
+ authors[idx] = [
+ author_metadata[%(firstname_#{name_idx = idx + 1})],
+ author_metadata[%(middlename_#{name_idx})],
+ author_metadata[%(lastname_#{name_idx})]
+ ].compact.map {|it| it.tr ' ', '_' }.join ' '
end if sparse
# process as names only
author_metadata = process_authors authors, true, false