lib/softcover/mathjax.rb in softcover-1.0.5 vs lib/softcover/mathjax.rb in softcover-1.1.beta1
- old
+ new
@@ -2,25 +2,30 @@
module Mathjax
# Returns the MathJax configuration.
def self.config(options = {})
chapter_number = if options[:chapter_number]
- # Call .inspect.inspect to escape the chapter number
- # code for interpolation.
- options[:chapter_number].inspect.inspect
- elsif options[:chapter_number].nil?
- '#{chapter_number}'
+ if (options[:chapter_number].zero? ||
+ Softcover::Utils.article?)
+ false
+ else
+ # Call .inspect.inspect to escape the chapter
+ # number code for interpolation.
+ options[:chapter_number].inspect.inspect
+ end
+ elsif options[:chapter_number].nil?
+ false
else # chapter_number is false, i.e., it's a single page
false
end
fn = if chapter_number
- "formatNumber: function (n) { return #{chapter_number} + '.' + n }"
+ "formatNumber: function (n) { return #{chapter_number} + '.adfadsfa ' + n }"
else
""
end
- <<-EOS
+ config = <<-EOS
MathJax.Hub.Config({
"HTML-CSS": {
availableFonts: ["TeX"],
},
TeX: {
@@ -38,9 +43,10 @@
showProcessingMessages: false,
messageStyle: "none",
imageFont: null
});
EOS
+ config
end
# Rerturns a version of the MathJax configuration escaped for the server.
# There's an extra interpolation somewhere between here and the server,
# which this method corrects for.