lib/softcover/builders/epub.rb in softcover-1.1.20 vs lib/softcover/builders/epub.rb in softcover-1.1.21
- old
+ new
@@ -270,11 +270,11 @@
# Sometimes in tests the phantomjs_source.html file is missing.
# It shouldn't ever happen, but it does no harm to skip it.
return nil unless File.exist?('phantomjs_source.html')
raw_source = File.read('phantomjs_source.html')
source = strip_attributes(Nokogiri::HTML(raw_source))
- # rm 'phantomjs_source.html'
+ rm 'phantomjs_source.html'
# Remove the first body div, which is the hidden MathJax SVGs.
if (mathjax_svgs = source.at_css('body div'))
mathjax_svgs.remove
else
# There's not actually any math, so return nil.
@@ -352,21 +352,11 @@
# Returns true if a string appears to have LaTeX math.
# We detect math via opening math commands: \(, \[, and \begin{equation}
# This gives a false positive when math is included in verbatim
# environments and nowhere else, but it does little harm (requiring only
# an unnecessary call to page.js).
- # The regex includes both standard (La)TeX and amsmath extensions.
def math?(string)
- math_regex = /(?:\\\(
- |\\\[
- |\\begin{(?:equation
- |align
- |gather
- |flalign
- |multline
- |alignat
- |split))/x
- !!string.match(math_regex)
+ !!string.match(/(?:\\\(|\\\[|\\begin{equation})/)
end
def create_style_files(options)
html_styles = File.join('html', 'stylesheets')
epub_styles = File.join('epub', 'OEBPS', 'styles')
\ No newline at end of file