summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Volz <dev@textmulch.de>2020-02-18 21:08:41 +0100
committerRainer Volz <dev@textmulch.de>2020-02-18 21:08:41 +0100
commitdbc49ec1a67c359d60190d8b9c235b4a0d307d9b (patch)
tree40155c7d6a449784a4baee20c932cf22537596a5
parentc53acd1a75b74626b67a6362ad194b5ec2bae7cf (diff)
Fixed RuboCop offenses
-rw-r--r--lib/asciidoctor-epub3/converter.rb9
-rw-r--r--spec/converter_spec.rb2
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/asciidoctor-epub3/converter.rb b/lib/asciidoctor-epub3/converter.rb
index 9f83ceb..0221ac3 100644
--- a/lib/asciidoctor-epub3/converter.rb
+++ b/lib/asciidoctor-epub3/converter.rb
@@ -1179,7 +1179,6 @@ body > svg {
nil
end
-
def get_frontmatter_files doc, workdir
if doc.attr? 'epub3-frontmatterdir'
fmdir = doc.attr 'epub3-frontmatterdir'
@@ -1189,8 +1188,8 @@ body > svg {
warn %(Directory specified by 'epub3-frontmattderdir' doesn't exist! Ignoring ...)
return []
end
- fms = Dir.entries(fm_path).delete_if {|x| !x.match fmglob}.sort.map {|y| File.join(fm_path,y)}
- if fms && fms.length > 0
+ fms = Dir.entries(fm_path).delete_if {|x| !x.match fmglob }.sort.map {|y| File.join fm_path, y }
+ if fms && !fms.empty?
fms
else
warn %(Directory specified by 'epub3-frontmattderdir' contains no suitable files! Ignoring ...)
@@ -1207,10 +1206,10 @@ body > svg {
workdir = doc.attr 'docdir'
workdir = '.' if workdir.nil_or_empty?
- get_frontmatter_files(doc, workdir).each do | front_matter |
+ get_frontmatter_files(doc, workdir).each do |front_matter|
front_matter_content = ::File.read front_matter
- front_matter_file = File.basename(front_matter, '.html')
+ front_matter_file = File.basename front_matter, '.html'
item = @book.add_item "#{front_matter_file}.xhtml", content: (postprocess_xhtml front_matter_content)
item.add_property 'svg' if SvgImgSniffRx =~ front_matter_content
diff --git a/spec/converter_spec.rb b/spec/converter_spec.rb
index 3563c4b..ceb6bae 100644
--- a/spec/converter_spec.rb
+++ b/spec/converter_spec.rb
@@ -54,7 +54,7 @@ describe Asciidoctor::Epub3::Converter do
end
it 'adds multiple front matter page with images' do
- book, = to_epub 'front-matter-multi/book.adoc', attributes: {'epub3-frontmatterdir' => 'fm'}
+ book, = to_epub 'front-matter-multi/book.adoc', attributes: { 'epub3-frontmatterdir' => 'fm' }
front_matter = book.item_by_href 'front-matter.1.xhtml'
expect(front_matter).not_to be_nil
expect(front_matter.content).to include 'Matter. Front Matter.'