Add mathjax using SSL CDN.

This commit is contained in:
bootstraponline
2012-05-24 17:18:55 -06:00
parent 7b0988cc19
commit ff8b892ebe
5 changed files with 19 additions and 2 deletions
+4
View File
@@ -52,6 +52,10 @@ opts = OptionParser.new do |opts|
opts.on("--ref [REF]", "Specify the repository ref to use (default: master).") do |ref| opts.on("--ref [REF]", "Specify the repository ref to use (default: master).") do |ref|
wiki_options[:ref] = ref wiki_options[:ref] = ref
end end
opts.on("--no-mathjax", "Disables mathjax.") do
options['mathjax'] = false
end
end end
# Read command line options into `options` hash # Read command line options into `options` hash
+2
View File
@@ -138,6 +138,7 @@ module Precious
@page = wiki.preview_page(@name, params[:content], params[:format]) @page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data @content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil @toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@editable = false @editable = false
mustache :page mustache :page
end end
@@ -235,6 +236,7 @@ module Precious
@editable = true @editable = true
@content = page.formatted_data @content = page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil @toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
mustache :page mustache :page
elsif file = wiki.file(name) elsif file = wiki.file(name)
@@ -16,8 +16,8 @@
<script type="text/javascript" src="/javascript/gollum.dialog.js"></script> <script type="text/javascript" src="/javascript/gollum.dialog.js"></script>
<script type="text/javascript" src="/javascript/gollum.placeholder.js"></script> <script type="text/javascript" src="/javascript/gollum.placeholder.js"></script>
<script type="text/javascript" <script type="text/javascript" src="/javascript/editor/gollum.editor.js"></script>
src="/javascript/editor/gollum.editor.js"></script> {{#mathjax}}<script type="text/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>{{/mathjax}}
<title>{{title}}</title> <title>{{title}}</title>
</head> </head>
<body> <body>
+6
View File
@@ -67,12 +67,18 @@ module Precious
def sidebar_format def sidebar_format
has_sidebar && @sidebar.format.to_s has_sidebar && @sidebar.format.to_s
end end
def has_toc def has_toc
!@toc_content.nil? !@toc_content.nil?
end end
def toc_content def toc_content
@toc_content @toc_content
end end
def mathjax
@mathjax
end
end end
end end
end end
+5
View File
@@ -149,6 +149,7 @@ module Gollum
# :page_file_dir - String the directory in which all page files reside # :page_file_dir - String the directory in which all page files reside
# :ref - String the repository ref to retrieve pages from # :ref - String the repository ref to retrieve pages from
# :ws_subs - Array of chars to sub for ws in filenames. # :ws_subs - Array of chars to sub for ws in filenames.
# :mathjax - Set to false to disable mathjax.
# #
# Returns a fresh Gollum::Repo. # Returns a fresh Gollum::Repo.
def initialize(path, options = {}) def initialize(path, options = {})
@@ -173,6 +174,7 @@ module Gollum
@history_sanitization = options[:history_sanitization] || @history_sanitization = options[:history_sanitization] ||
self.class.history_sanitization self.class.history_sanitization
@universal_toc = options.fetch(:universal_toc, false) @universal_toc = options.fetch(:universal_toc, false)
@mathjax = options[:mathjax] || true
end end
# Public: check whether the wiki's git repo exists on the filesystem. # Public: check whether the wiki's git repo exists on the filesystem.
@@ -539,6 +541,9 @@ module Gollum
# Toggles display of universal table of contents # Toggles display of universal table of contents
attr_reader :universal_toc attr_reader :universal_toc
# Toggles mathjax.
attr_reader :mathjax
# Normalize the data. # Normalize the data.
# #
# data - The String data to be normalized. # data - The String data to be normalized.