lib/epubmaker/epubv2.rb in review-4.2.0 vs lib/epubmaker/epubv2.rb in review-5.0.0

- old
+ new

@@ -7,18 +7,17 @@ # the GNU LGPL, Lesser General Public License version 2.1. # For details of the GNU LGPL, see the file "COPYING". # require 'epubmaker/epubcommon' -require 'cgi' require 'epubmaker/zip_exporter' module EPUBMaker # EPUBv2 is EPUB version 2 producer. class EPUBv2 < EPUBCommon # Construct object with parameter hash +config+ and message resource hash +res+. - def initialize(producer) + def initialize(producer) # rubocop:disable Lint/UselessMethodDefinition super end # Return opf file content. def opf @@ -35,13 +34,13 @@ def opf_metainfo s = '' %w[title language date type format source description relation coverage subject rights].each do |item| next unless @producer.config[item] if @producer.config[item].is_a?(Array) - s << @producer.config.names_of(item).map { |i| %Q( <dc:#{item}>#{CGI.escapeHTML(i)}</dc:#{item}>\n) }.join + s << @producer.config.names_of(item).map { |i| %Q( <dc:#{item}>#{h(i)}</dc:#{item}>\n) }.join else - s << %Q( <dc:#{item}>#{CGI.escapeHTML(@producer.config.name_of(item).to_s)}</dc:#{item}>\n) + s << %Q( <dc:#{item}>#{h(@producer.config.name_of(item).to_s)}</dc:#{item}>\n) end end # ID if @producer.config['isbn'].nil? @@ -52,18 +51,18 @@ # creator (should be array) %w[aut a-adp a-ann a-arr a-art a-asn a-aqt a-aft a-aui a-ant a-bkp a-clb a-cmm a-dsr a-edt a-ill a-lyr a-mdc a-mus a-nrt a-oth a-pht a-prt a-red a-rev a-spn a-ths a-trc a-trl].each do |role| next unless @producer.config[role] @producer.config.names_of(role).each do |v| - s << %Q( <dc:creator opf:role="#{role.sub('a-', '')}">#{CGI.escapeHTML(v)}</dc:creator>\n) + s << %Q( <dc:creator opf:role="#{role.sub('a-', '')}">#{h(v)}</dc:creator>\n) end end # contributor (should be array) %w[adp ann arr art asn aqt aft aui ant bkp clb cmm dsr edt ill lyr mdc mus nrt oth pht prt red rev spn ths trc trl].each do |role| next unless @producer.config[role] @producer.config.names_of(role).each do |v| - s << %Q( <dc:contributor opf:role="#{role}">#{CGI.escapeHTML(v)}</dc:contributor>\n) + s << %Q( <dc:contributor opf:role="#{role}">#{h(v)}</dc:contributor>\n) if role == 'prt' s << %Q( <dc:publisher>#{v}</dc:publisher>\n) end end end