lib/asciidoctor-epub3/packager.rb in asciidoctor-epub3-1.5.0.alpha.8 vs lib/asciidoctor-epub3/packager.rb in asciidoctor-epub3-1.5.0.alpha.9
- old
+ new
@@ -6,10 +6,11 @@
module Asciidoctor
module Epub3
module GepubBuilderMixin
DATA_DIR = ::File.expand_path(::File.join ::File.dirname(__FILE__), '..', '..', 'data')
SAMPLES_DIR = ::File.join DATA_DIR, 'samples'
+ LF = ?\n
CharEntityRx = ContentConverter::CharEntityRx
XmlElementRx = ContentConverter::XmlElementRx
FromHtmlSpecialCharsMap = ContentConverter::FromHtmlSpecialCharsMap
FromHtmlSpecialCharsRx = ContentConverter::FromHtmlSpecialCharsRx
CsvDelimiterRx = /\s*,\s*/
@@ -325,11 +326,11 @@
<h2>#{doc.attr 'toc-title'}</h2>)]
lines << (nav_level spine, [(doc.attr 'toclevels', 1).to_i, 0].max)
lines << %(</nav>
</body>
</html>)
- lines * EOL
+ lines * LF
end
def nav_level items, depth, state = {}
lines = []
lines << '<ol>'
@@ -351,11 +352,11 @@
lines[-1] = %(#{lines[-1]}</li>)
end
state.delete :content_doc_href if item.context == :document
end
lines << '</ol>'
- lines * EOL
+ lines * LF
end
# NOTE gepub doesn't support building a ncx TOC with depth > 1, so do it ourselves
def add_ncx_doc doc, spine_builder, spine
spine_builder.file 'toc.ncx' => (ncx_doc doc, spine).to_ios
@@ -377,11 +378,11 @@
<navMap>)]
lines << (ncx_level spine, [(doc.attr 'toclevels', 1).to_i, 0].max, state = {})
lines[0] = lines[0].sub '%{depth}', %(<meta name="dtb:depth" content="#{state[:max_depth]}"/>)
lines << %(</navMap>
</ncx>)
- lines * EOL
+ lines * LF
end
def ncx_level items, depth, state = {}
lines = []
state[:max_depth] = (state.fetch :max_depth, 0) + 1
@@ -403,10 +404,10 @@
lines << (ncx_level child_sections, depth - 1, state)
end
lines << %(</navPoint>)
state.delete :content_doc_href if item.context == :document
end
- lines * EOL
+ lines * LF
end
def collect_keywords doc, spine
([doc] + spine).map do |item|
if item.attr? 'keywords'