Compare commits
149 Commits
Author | SHA1 | Date |
---|---|---|
Jacques Distler | 47e76794cd | |
Jacques Distler | 40fd643680 | |
Jacques Distler | def8e9ae0f | |
Jacques Distler | b52a66c207 | |
Jacques Distler | 4a3d7e0b78 | |
Jacques Distler | 57d52b0d15 | |
Jacques Distler | 1ce128348c | |
Jacques Distler | 987140ed83 | |
Jacques Distler | 072e2e1e92 | |
Jacques Distler | b48a56028a | |
Jacques Distler | 8cf98a4711 | |
Jacques Distler | 66b8f3454d | |
Jacques Distler | f331becb64 | |
Jacques Distler | 2d9cc8bf4d | |
Jacques Distler | f1e47a7ec5 | |
Jacques Distler | e749ee1e4b | |
Jacques Distler | c102e10315 | |
Jacques Distler | 22a27c8391 | |
Jacques Distler | 7e4c7c447e | |
Jacques Distler | f6d350302c | |
Jacques Distler | 88dd41e75f | |
Jacques Distler | e4b00f0bff | |
Jacques Distler | 0f4a76d895 | |
Jacques Distler | 4b09e0322f | |
Jacques Distler | 07aca55e6e | |
Jacques Distler | b6c0ffa0d5 | |
Jacques Distler | ddcf022264 | |
Jacques Distler | d30bd11ff7 | |
Jacques Distler | 1f8a4fe282 | |
Jacques Distler | eff8c87d39 | |
Jacques Distler | 60a595de17 | |
Jacques Distler | c603aca852 | |
Jacques Distler | 8c74de6670 | |
Jacques Distler | ee05118e8f | |
Jacques Distler | c7b46cbde3 | |
Jacques Distler | 7bf832e8c7 | |
Jacques Distler | f5c892c717 | |
Jacques Distler | 364de9dbab | |
Jacques Distler | 1efa08dcc7 | |
Jacques Distler | ddf1846fe1 | |
Jacques Distler | 04ca7e8a38 | |
Jacques Distler | f9e60828c7 | |
Jacques Distler | 9e25ada5c8 | |
Jacques Distler | 66f62bac1f | |
Jacques Distler | e00b2a0ac0 | |
Jacques Distler | 2801421969 | |
Jacques Distler | b1d1f74b7d | |
Jacques Distler | a088201062 | |
Jacques Distler | c5a2e325c0 | |
Jacques Distler | 26ed59485a | |
Jacques Distler | 2d303d54a0 | |
Jacques Distler | 453693a868 | |
Jacques Distler | 27ad6ff2a8 | |
Jacques Distler | e26c12229e | |
Jacques Distler | 903c4b6bdd | |
Jacques Distler | 09b2d24a18 | |
Jacques Distler | e387d095ec | |
Jacques Distler | 2d21eabee8 | |
Jacques Distler | 6f18c90a50 | |
Jacques Distler | 03fc0324db | |
Jacques Distler | 6b86177620 | |
Jacques Distler | 3a54d7ee72 | |
Jacques Distler | 477bd91567 | |
Jacques Distler | 1df2483663 | |
Jacques Distler | f463a3b1c8 | |
Jacques Distler | a739a52f54 | |
Jacques Distler | 1e352e28a1 | |
Jacques Distler | 85cada931d | |
Jacques Distler | 4b2448b09a | |
Jacques Distler | c1826775d2 | |
Jacques Distler | 3c650f2cf6 | |
Jacques Distler | ecaf67dca9 | |
Jacques Distler | f7bce2c773 | |
Jacques Distler | 89f6b69245 | |
Jacques Distler | 5c51f930b0 | |
Jacques Distler | ce97abe6ac | |
Jacques Distler | 070f689f9c | |
Jacques Distler | 5fd725e3a8 | |
Jacques Distler | 13a522525c | |
Jacques Distler | 6005297cfe | |
Jacques Distler | 46da1f3aaf | |
Jacques Distler | a72d35bd4e | |
Jacques Distler | 201c25ce83 | |
Jacques Distler | c9312367c9 | |
Jacques Distler | 47996ea1d3 | |
Jacques Distler | f23e1487df | |
Jacques Distler | 14592f57f9 | |
Jacques Distler | 7d2275d0a1 | |
Jacques Distler | 52da76ff38 | |
Jacques Distler | 8d7f33f99b | |
Jacques Distler | 2967b207b2 | |
Jacques Distler | dfad5a3a37 | |
Jacques Distler | 8b008f8418 | |
Jacques Distler | fc8be60634 | |
Jacques Distler | 9e909d5be3 | |
Jacques Distler | 088b535d52 | |
Jacques Distler | ec443685a6 | |
Jacques Distler | 97148dc205 | |
Jacques Distler | cbf13ad57a | |
Jacques Distler | ec31e46e92 | |
Jacques Distler | 79a966f71f | |
Jacques Distler | 92e4aaafaf | |
Jacques Distler | 0ae83c3560 | |
Jacques Distler | 1464e29f4f | |
Jacques Distler | fcd8900cb7 | |
Jacques Distler | 9090dba2b2 | |
Jacques Distler | ade1c1d113 | |
Jacques Distler | 1f98b7dcf9 | |
Jacques Distler | 0df40cb4cb | |
Jacques Distler | 95d2fe540f | |
Jacques Distler | c9ad2c0c6e | |
Jacques Distler | ca661ddb42 | |
Jacques Distler | 7e5dbe5854 | |
Jacques Distler | c2dfe7e621 | |
Jacques Distler | 7290e90631 | |
Jacques Distler | 823f8b79c9 | |
Jacques Distler | c010e6b7a4 | |
Jacques Distler | 63fd1dbbb9 | |
Jacques Distler | 844ce0ed40 | |
Jacques Distler | f9628a3f19 | |
Jacques Distler | 3843fa608d | |
Jacques Distler | 363d72524b | |
Jacques Distler | 1bef71bbf1 | |
Jacques Distler | 122783886f | |
Jacques Distler | a12a778c5a | |
Jacques Distler | c61eb7ae1e | |
Jacques Distler | 7d3f9db8f0 | |
Jacques Distler | 230d2998b4 | |
Jacques Distler | 27a99e0146 | |
Jacques Distler | e98c8bda63 | |
Jacques Distler | d8d0f2fdd6 | |
Jacques Distler | 2cd2b09648 | |
Jacques Distler | fccb1e2b01 | |
Jacques Distler | 5918d4c26e | |
Jacques Distler | f914a40fa9 | |
Jacques Distler | 8d7381bb54 | |
Jacques Distler | cd674bbb36 | |
Jacques Distler | 88291ee4a2 | |
Jacques Distler | 4be1a58a24 | |
Jacques Distler | 06287a4ef5 | |
Jacques Distler | cca857ed3a | |
Jacques Distler | 982ab38f43 | |
Jacques Distler | ad12997c1d | |
Jacques Distler | 97434e097a | |
Jacques Distler | bb17fbbe02 | |
Jacques Distler | 06f4f2cc98 | |
Jacques Distler | bf69cceb25 | |
Jacques Distler | 10aa983337 | |
Jacques Distler | 1663d9f5c8 |
46
CHANGELOG
46
CHANGELOG
|
@ -1,10 +1,54 @@
|
|||
N.B.: You *must* run
|
||||
|
||||
ruby bundle
|
||||
rake upgrade_instiki
|
||||
ruby bundle exec rake upgrade_instiki
|
||||
|
||||
after installing the new software, to enjoy the benefits of this new version.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
* 0.19.3
|
||||
|
||||
New Features:
|
||||
* Source view for Revisions
|
||||
* Rails updated to 2.3.14 (Security)
|
||||
* itextomml updated to 1.4.6
|
||||
* Replace REXML with Nokogiri in Maruku and
|
||||
in xhtml_safe_sanitize().
|
||||
(Huge speedup in rendering long pages)
|
||||
* MathJax updated to 1.1a final
|
||||
|
||||
Bugs Fixed:
|
||||
* Bundler upgraded to 1.0.18
|
||||
* Fix null search bug
|
||||
* Better text/html serialization (thank you, Nokogiri)
|
||||
* Fix Maruku footnote backlink (reported by Shamaoke)
|
||||
* Fix Maruku link bug
|
||||
* Fix Maruku image title bug
|
||||
* Fix Maruku hrule, email address and header bugs
|
||||
* Fix Maruku bold-in-italics bug
|
||||
* Fix Maruku empty list-item bug
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
* 0.19.2
|
||||
|
||||
New Features:
|
||||
* MathJax rendering for non-MathML capable browsers.
|
||||
* RedCloth (Textile) upgraded to 4.x (now handled
|
||||
by Bundler).
|
||||
* Bundler upgraded to 1.0.7
|
||||
* Rails updated to 2.3.11
|
||||
|
||||
Bugs Fixed:
|
||||
* Redirects and categories of included pages should
|
||||
not be inherited. (Suggestion of Andrew Stacey).
|
||||
* Bug in Maruku equation handling (reported by Andrew Stacey).
|
||||
* SVG-Edit updates and bug-fixes.
|
||||
* Bug in editing S5 slideshows.
|
||||
* Unvendor Rack
|
||||
* Fix Maruku list-parsing bug (reported by Shamaoke)
|
||||
* Validate Web address (Reported by Richard Marquez).
|
||||
* Fix a well-formedness bug
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
* 0.19.1
|
||||
|
||||
|
|
5
Gemfile
5
Gemfile
|
@ -1,9 +1,12 @@
|
|||
source "http://rubygems.org"
|
||||
gem "sqlite3-ruby", :require => "sqlite3"
|
||||
gem "itextomml", ">=1.4.5"
|
||||
gem "itextomml", ">=1.4.7"
|
||||
gem "rack", ">=1.1.0"
|
||||
gem "mongrel", ">=1.2.0.pre2"
|
||||
gem "rubyzip"
|
||||
gem "RedCloth", ">=4.0.0"
|
||||
gem "erubis"
|
||||
gem "nokogiri"
|
||||
gem "rake"
|
||||
gem "rdoc"
|
||||
gem "json"
|
||||
|
|
2
README
2
README
|
@ -15,7 +15,7 @@ Instiki on BeOS, Amiga OS, OS2, Zeta OS and support for various exotic Platforms
|
|||
|
||||
== 3 easy Steps to get the Instiki experience
|
||||
|
||||
Step 1. Get Ruby and Instiki, run "ruby bundle"
|
||||
Step 1. Get Instiki and run "ruby bundle"
|
||||
Step 2. Run "instiki"
|
||||
Step 3. Chuckle... "There's no step three!" (TM)
|
||||
|
||||
|
|
14
UPGRADING
14
UPGRADING
|
@ -5,9 +5,17 @@ See the upgrading instructions
|
|||
|
||||
http://golem.ph.utexas.edu/wiki/instiki/show/Upgrading
|
||||
|
||||
for detailed instructions. At a minimum, you need to backup your database.
|
||||
for detailed instructions.
|
||||
|
||||
At a minimum, you need to backup your database.
|
||||
After installing the new software and restoring your database, you need to run
|
||||
|
||||
rake upgrade_instiki
|
||||
ruby bundle
|
||||
ruby bundle exec rake upgrade_instiki
|
||||
|
||||
from the commandline, to complete the upgrade.
|
||||
from the commandline, to complete the upgrade. Doing a
|
||||
|
||||
|
||||
ruby bundle update
|
||||
|
||||
will update the installed gems (used by Instiki) to the latest versions.
|
|
@ -41,11 +41,9 @@ class ApplicationController < ActionController::Base
|
|||
s.scan( %r(\w{#{n},#{n}}) ).collect {|a| (a.hex * 2/3).to_s(16).rjust(n,'0')}.join
|
||||
end
|
||||
|
||||
def check_authorization
|
||||
if in_a_web? and authorization_needed? and not authorized?
|
||||
redirect_to :controller => 'wiki', :action => 'login', :web => @web_name
|
||||
return false
|
||||
end
|
||||
def check_authorization
|
||||
redirect_to(:controller => 'wiki', :action => 'login',
|
||||
:web => @web_name) if in_a_web? and authorization_needed? and not authorized?
|
||||
end
|
||||
|
||||
def connect_to_model
|
||||
|
@ -55,10 +53,8 @@ class ApplicationController < ActionController::Base
|
|||
@author = cookies['author'] || 'AnonymousCoward'
|
||||
if @web_name
|
||||
@web = @wiki.webs[@web_name]
|
||||
if @web.nil?
|
||||
render(:status => 404, :text => "Unknown web '#{@web_name}'", :layout => 'error')
|
||||
return false
|
||||
end
|
||||
render(:status => 404, :text => "Unknown web '#{@web_name}'",
|
||||
:layout => 'error') if @web.nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -252,7 +248,6 @@ class ApplicationController < ActionController::Base
|
|||
layout = false if %w(tex tex_list).include?(action_name)
|
||||
headers['Allow'] = 'POST'
|
||||
render(:status => 405, :text => 'You must use an HTTP POST', :layout => layout)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
@ -282,9 +277,9 @@ module Instiki
|
|||
module VERSION #:nodoc:
|
||||
MAJOR = 0
|
||||
MINOR = 19
|
||||
TINY = 1
|
||||
TINY = 3
|
||||
SUFFIX = '(MML+)'
|
||||
PRERELEASE = false
|
||||
PRERELEASE = false
|
||||
if PRERELEASE
|
||||
STRING = [MAJOR, MINOR].join('.') + PRERELEASE + SUFFIX
|
||||
else
|
||||
|
|
|
@ -8,11 +8,11 @@ module CacheSweepingHelper
|
|||
end
|
||||
|
||||
def expire_cached_summary_pages(web)
|
||||
categories = WikiReference.all(:conditions => "link_type = 'C'")
|
||||
categories = WikiReference.list_categories(web)
|
||||
%w(recently_revised list).each do |action|
|
||||
expire_action :controller => 'wiki', :web => web.address, :action => action
|
||||
categories.each do |category|
|
||||
expire_action :controller => 'wiki', :web => web.address, :action => action, :category => category.referenced_name
|
||||
expire_action :controller => 'wiki', :web => web.address, :action => action, :category => category
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,12 +26,14 @@ module CacheSweepingHelper
|
|||
end
|
||||
|
||||
def expire_cached_revisions(page)
|
||||
page.revisions.count.times do |i|
|
||||
page.rev_ids.count.times do |i|
|
||||
revno = i+1
|
||||
expire_action :controller => 'wiki', :web => page.web.address,
|
||||
:action => 'revision', :id => page.name, :rev => revno
|
||||
expire_action :controller => 'wiki', :web => page.web.address,
|
||||
:action => 'revision', :id => page.name, :rev => revno, :mode => 'diff'
|
||||
expire_action :controller => 'wiki', :web => page.web.address,
|
||||
:action => 'source', :id => page.name, :rev => revno
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ class FileController < ApplicationController
|
|||
new_file = @web.wiki_files.create(params['file'])
|
||||
if new_file.valid?
|
||||
flash[:info] = "File '#{@file_name}' successfully uploaded"
|
||||
WikiReference.pages_that_link_to_file(@web, @file_name).each do |page|
|
||||
RevisionSweeper.expire_page(@web, page)
|
||||
end
|
||||
redirect_to(params['referring_page'])
|
||||
else
|
||||
# pass the file with errors back into the form
|
||||
|
@ -88,23 +91,23 @@ class FileController < ApplicationController
|
|||
protected
|
||||
|
||||
def check_authorized
|
||||
if authorized? or @web.published?
|
||||
return true
|
||||
else
|
||||
unless authorized? or @web.published?
|
||||
@hide_navigation = true
|
||||
render(:status => 403, :text => 'This web is private', :layout => true)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def check_allow_uploads
|
||||
render(:status => 404, :text => "Web #{params['web'].inspect} not found", :layout => 'error') and return false unless @web
|
||||
if @web.allow_uploads? and authorized?
|
||||
return true
|
||||
if @web
|
||||
if @web.allow_uploads? and authorized?
|
||||
return true
|
||||
else
|
||||
@hide_navigation = true
|
||||
render(:status => 403, :text => 'File uploads are blocked by the webmaster', :layout => true)
|
||||
return false
|
||||
end
|
||||
else
|
||||
@hide_navigation = true
|
||||
render(:status => 403, :text => 'File uploads are blocked by the webmaster', :layout => true)
|
||||
return false
|
||||
render(:status => 404, :text => "Web #{params['web'].inspect} not found", :layout => 'error')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -18,18 +18,30 @@ class RevisionSweeper < ActionController::Caching::Sweeper
|
|||
expire_caches(record.page)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def after_create(record)
|
||||
if record.is_a?(Page)
|
||||
WikiReference.pages_that_reference(record.web, record.name).each do |page_name|
|
||||
expire_cached_page(record.web, page_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def after_delete(record)
|
||||
if record.is_a?(Page)
|
||||
expire_caches(record)
|
||||
end
|
||||
end
|
||||
|
||||
def self.expire_page(web, page_name)
|
||||
new.expire_cached_page(web, page_name)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def expire_caches(page)
|
||||
expire_cached_summary_pages(page.web)
|
||||
pages_to_expire = ([page.name] + WikiReference.pages_that_reference(page.web, page.name) +
|
||||
pages_to_expire = ([page.name] +
|
||||
WikiReference.pages_redirected_to(page.web, page.name) +
|
||||
WikiReference.pages_that_include(page.web, page.name)).uniq
|
||||
pages_to_expire.each { |page_name| expire_cached_page(page.web, page_name) }
|
||||
|
|
|
@ -9,7 +9,7 @@ class WebSweeper < ActionController::Caching::Sweeper
|
|||
def after_save(record)
|
||||
if record.is_a?(Web)
|
||||
web = record
|
||||
web.pages.each { |page| expire_cached_page(web, page.name) }
|
||||
web.pages.find_each { |page| expire_cached_page(web, page.name) }
|
||||
expire_cached_summary_pages(web)
|
||||
elsif record.is_a?(WikiFile)
|
||||
record.web.pages_that_link_to_file(record.file_name).each do |page|
|
||||
|
|
|
@ -69,7 +69,7 @@ class WikiController < ApplicationController
|
|||
|
||||
def export_html
|
||||
export_pages_as_zip(html_ext) do |page|
|
||||
renderer = PageRenderer.new(page.revisions.last)
|
||||
renderer = PageRenderer.new(page.current_revision)
|
||||
rendered_page = <<-EOL
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
@ -211,7 +211,7 @@ EOL
|
|||
|
||||
|
||||
def search
|
||||
@query = params['query'].purify
|
||||
@query = params['query'] ? params['query'].purify : ''
|
||||
@title_results = @web.select { |page| page.name =~ /#{@query}/i }.sort
|
||||
@results = @web.select { |page| page.content =~ /#{@query}/i }.sort
|
||||
all_pages_found = (@results + @title_results).uniq
|
||||
|
@ -262,7 +262,7 @@ EOL
|
|||
redirect_home
|
||||
end
|
||||
@link_mode ||= :show
|
||||
@renderer = PageRenderer.new(@page.revisions.last)
|
||||
@renderer = PageRenderer.new(@page.current_revision)
|
||||
# to template
|
||||
end
|
||||
|
||||
|
@ -276,7 +276,7 @@ EOL
|
|||
@page ||= wiki.read_page(@web_name, @page_name)
|
||||
@link_mode ||= :publish
|
||||
if @page
|
||||
@renderer = PageRenderer.new(@page.revisions.last)
|
||||
@renderer = PageRenderer.new(@page.current_revision)
|
||||
else
|
||||
real_page = WikiReference.page_that_redirects_for(@web, @page_name)
|
||||
if real_page
|
||||
|
@ -348,7 +348,7 @@ EOL
|
|||
def show
|
||||
if @page
|
||||
begin
|
||||
@renderer = PageRenderer.new(@page.revisions.last)
|
||||
@renderer = PageRenderer.new(@page.current_revision)
|
||||
@show_diff = (params[:mode] == 'diff')
|
||||
render :action => 'page'
|
||||
# TODO this rescue should differentiate between errors due to rendering and errors in
|
||||
|
@ -383,8 +383,8 @@ EOL
|
|||
if @page
|
||||
@revisions_by_day = Hash.new { |h, day| h[day] = [] }
|
||||
@revision_numbers = Hash.new { |h, id| h[id] = [] }
|
||||
revision_number = @page.revisions.size
|
||||
@page.revisions.reverse.each do |rev|
|
||||
revision_number = @page.rev_ids.size
|
||||
@page.rev_ids.reverse.each do |rev|
|
||||
day = Date.new(rev.revised_at.year, rev.revised_at.month, rev.revised_at.day)
|
||||
@revisions_by_day[day] << rev
|
||||
@revision_numbers[rev.id] = revision_number
|
||||
|
@ -401,7 +401,7 @@ EOL
|
|||
end
|
||||
|
||||
def source
|
||||
#to template
|
||||
@revision = @page.revisions[params['rev'].to_i - 1] if params['rev']
|
||||
end
|
||||
|
||||
def tex
|
||||
|
@ -415,7 +415,7 @@ EOL
|
|||
|
||||
def s5
|
||||
if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup)
|
||||
my_rendered = PageRenderer.new(@page.revisions.last)
|
||||
my_rendered = PageRenderer.new(@page.current_revision)
|
||||
@s5_content = my_rendered.display_s5
|
||||
@s5_theme = my_rendered.s5_theme
|
||||
else
|
||||
|
@ -478,7 +478,7 @@ EOL
|
|||
"<meta http-equiv=\"Refresh\" content=\"0;URL=HomePage.#{html_ext}\" /></head></html>"
|
||||
end
|
||||
dir = Rails.root.join('public')
|
||||
Dir["#{dir}/**/*"].each do |f|
|
||||
Dir["#{dir}/{images,javascripts,s5,stylesheets}/**/*"].each do |f|
|
||||
zip_out.add "public#{f.sub(dir.to_s,'')}", f
|
||||
end
|
||||
end
|
||||
|
@ -506,7 +506,7 @@ EOL
|
|||
if params['rev']
|
||||
@revision_number = params['rev'].to_i
|
||||
else
|
||||
@revision_number = @page.revisions.size
|
||||
@revision_number = @page.rev_ids.size
|
||||
end
|
||||
@revision = @page.revisions[@revision_number - 1]
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ require 'instiki_stringsupport'
|
|||
|
||||
# Create a hyperlink to a particular revision of a Wiki page
|
||||
def link_to_revision(page, revision_number, text = nil, mode = nil, html_options = {})
|
||||
revision_number == page.revisions.size ?
|
||||
revision_number == page.rev_ids.size ?
|
||||
link_to(
|
||||
text || page.plain_name,
|
||||
{:web => @web.address, :action => 'show', :id => page.name,
|
||||
|
@ -96,7 +96,7 @@ require 'instiki_stringsupport'
|
|||
|
||||
# Performs HTML escaping on text, but keeps linefeeds intact (by replacing them with <br/>)
|
||||
def escape_preserving_linefeeds(text)
|
||||
h(text).gsub(/\n/, '<br/>').as_utf8
|
||||
h(text).gsub(/\n/, '<br/>').as_utf8.html_safe
|
||||
end
|
||||
|
||||
def format_date(date, include_time = true)
|
||||
|
@ -109,7 +109,7 @@ require 'instiki_stringsupport'
|
|||
end
|
||||
|
||||
def rendered_content(page)
|
||||
PageRenderer.new(page.revisions.last).display_content
|
||||
PageRenderer.new(page.current_revision).display_content
|
||||
end
|
||||
|
||||
def truncate(text, *args)
|
||||
|
|
|
@ -6,7 +6,7 @@ module WikiHelper
|
|||
menu << back_for_revision if @revision_number > 1
|
||||
menu << current_revision
|
||||
menu << see_or_hide_changes_for_revision if @revision_number > 1
|
||||
menu << history if @page.revisions.size > 1
|
||||
menu << history if @page.rev_ids.size > 1
|
||||
menu << rollback
|
||||
menu
|
||||
end
|
||||
|
@ -15,11 +15,11 @@ module WikiHelper
|
|||
menu = []
|
||||
menu << edit_page
|
||||
menu << edit_web if @page.name == "HomePage"
|
||||
if @page.revisions.size > 1
|
||||
if @page.rev_ids.size > 1
|
||||
menu << back_for_page
|
||||
menu << see_or_hide_changes_for_page
|
||||
end
|
||||
menu << history if @page.revisions.size > 1
|
||||
menu << history if @page.rev_ids.size > 1
|
||||
menu
|
||||
end
|
||||
|
||||
|
@ -40,11 +40,11 @@ module WikiHelper
|
|||
end
|
||||
|
||||
def forward
|
||||
if @revision_number < @page.revisions.size - 1
|
||||
if @revision_number < @page.rev_ids.size - 1
|
||||
link_to('Forward in time',
|
||||
{:web => @web.address, :action => 'revision', :id => @page.name, :rev => @revision_number + 1},
|
||||
{:class => 'navlink', :accesskey => 'F', :id => 'to_next_revision', :rel => 'nofollow'}) +
|
||||
" <span class='revisions'>(#{@revision.page.revisions.size - @revision_number} more)</span> ".html_safe
|
||||
" <span class='revisions'>(#{@revision.page.rev_ids.size - @revision_number} more)</span> ".html_safe
|
||||
else
|
||||
link_to('Forward in time', {:web => @web.address, :action => 'show', :id => @page.name},
|
||||
{:class => 'navlink', :accesskey => 'F', :id => 'to_next_revision', :rel => 'nofollow'}) +
|
||||
|
@ -62,9 +62,9 @@ module WikiHelper
|
|||
def back_for_page
|
||||
link_to('Back in time',
|
||||
{:web => @web.address, :action => 'revision', :id => @page.name,
|
||||
:rev => @page.revisions.size - 1},
|
||||
:rev => @page.rev_ids.size - 1},
|
||||
{:class => 'navlink', :accesskey => 'B', :id => 'to_previous_revision', :rel => 'nofollow'}) +
|
||||
" <span class='revisions'>(#{@page.revisions.size - 1} #{@page.revisions.size - 1 == 1 ? 'revision' : 'revisions'})</span>".html_safe
|
||||
" <span class='revisions'>(#{@page.rev_ids.size - 1} #{@page.rev_ids.size - 1 == 1 ? 'revision' : 'revisions'})</span>".html_safe
|
||||
end
|
||||
|
||||
def current_revision
|
||||
|
|
|
@ -18,7 +18,7 @@ class Itex
|
|||
begin
|
||||
require 'nokogiri'
|
||||
def self.xmlparse(text)
|
||||
Nokogiri::XML(text) { |config| config.options = Nokogiri::XML::ParseOptions::STRICT }
|
||||
Nokogiri::XML(text) { |config| config.strict }
|
||||
end
|
||||
rescue LoadError
|
||||
require 'rexml/document'
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class Page < ActiveRecord::Base
|
||||
belongs_to :web
|
||||
has_many :revisions, :order => 'id', :dependent => :destroy
|
||||
#In many cases, we don't need to instantiate the full revisions (with all that textual data)
|
||||
has_many :rev_ids, :order => 'id', :class_name => 'Revision', :select => 'id, revised_at, page_id, author, ip'
|
||||
has_many :wiki_references, :order => 'referenced_name'
|
||||
has_one :current_revision, :class_name => 'Revision', :order => 'id DESC'
|
||||
|
||||
|
@ -9,7 +11,7 @@ class Page < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def revise(content, name, time, author, renderer)
|
||||
revisions_size = new_record? ? 0 : revisions.size
|
||||
revisions_size = new_record? ? 0 : rev_ids.size
|
||||
if (revisions_size > 0) and content == current_revision.content and name == self.name
|
||||
raise Instiki::ValidationError.new(
|
||||
"You have tried to save page '#{name}' without changing its content")
|
||||
|
@ -46,11 +48,11 @@ class Page < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def revisions?
|
||||
revisions.size > 1
|
||||
rev_ids.size > 1
|
||||
end
|
||||
|
||||
def previous_revision(revision)
|
||||
revision_index = revisions.each_with_index do |rev, index|
|
||||
revision_index = rev_ids.each_with_index do |rev, index|
|
||||
if rev.id == revision.id
|
||||
break index
|
||||
else
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'instiki_stringsupport'
|
||||
|
||||
class Web < ActiveRecord::Base
|
||||
## Associations
|
||||
|
||||
|
@ -15,8 +17,7 @@ class Web < ActiveRecord::Base
|
|||
|
||||
## Validations
|
||||
|
||||
validates_uniqueness_of :address
|
||||
|
||||
validates_uniqueness_of :address, :message => 'already exists'
|
||||
validates_length_of :color, :in => 3..6
|
||||
|
||||
## Methods
|
||||
|
@ -203,6 +204,10 @@ class Web < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def validate_address
|
||||
if ['create_system', 'create_web', 'delete_web', 'delete_files', 'web_list', ''].include?(address)
|
||||
self.errors.add(:address, 'is not a valid address')
|
||||
raise Instiki::ValidationError.new("\"#{address.purify.escapeHTML}\" #{errors.on(:address)}")
|
||||
end
|
||||
unless address == CGI.escape(address)
|
||||
self.errors.add(:address, 'should contain only valid URI characters')
|
||||
raise Instiki::ValidationError.new("#{self.class.human_attribute_name('address')} #{errors.on(:address)}")
|
||||
|
|
|
@ -12,10 +12,9 @@ class WikiFile < ActiveRecord::Base
|
|||
first(:conditions => ['file_name = ?', file_name])
|
||||
end
|
||||
|
||||
SANE_FILE_NAME = /^[a-zA-Z0-9\-_\. ]*$/
|
||||
def validate
|
||||
if file_name
|
||||
if file_name !~ SANE_FILE_NAME
|
||||
if ! WikiFile.is_valid?(file_name)
|
||||
errors.add("file_name", "is invalid. Only latin characters, digits, dots, underscores, " +
|
||||
"dashes and spaces are accepted")
|
||||
elsif file_name == '.' or file_name == '..'
|
||||
|
@ -58,7 +57,10 @@ class WikiFile < ActiveRecord::Base
|
|||
require 'fileutils'
|
||||
FileUtils.rm_f(content_path) if File.exists?(content_path)
|
||||
end
|
||||
|
||||
|
||||
|
||||
SANE_FILE_NAME = /^[a-zA-Z0-9\-_\. ]*$/
|
||||
def self.is_valid?(name)
|
||||
name =~ SANE_FILE_NAME
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ class WikiReference < ActiveRecord::Base
|
|||
query = 'SELECT name FROM pages JOIN wiki_references ' +
|
||||
'ON pages.id = wiki_references.page_id ' +
|
||||
'WHERE wiki_references.referenced_name = ? ' +
|
||||
"AND wiki_references.link_type in ('#{FILE}') " +
|
||||
"AND wiki_references.link_type in ('#{FILE}','#{WANTED_FILE}') " +
|
||||
"AND pages.web_id = '#{web.id}'"
|
||||
names = connection.select_all(sanitize_sql([query, file_name])).map { |row| row['name'] }
|
||||
end
|
||||
|
|
|
@ -28,12 +28,30 @@
|
|||
<%= Rails.root.join('public', 'stylesheets', 'instiki.css').read if @inline_style %>
|
||||
<%= Rails.root.join('public', 'stylesheets', 'syntax.css').read if @inline_style %>
|
||||
</style>
|
||||
<%= "<style type='text/css'>#{@style_additions}</style>" if @style_additions %>
|
||||
<%= "<style type='text/css'>#{@style_additions}</style>".html_safe if @style_additions %>
|
||||
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
|
||||
<%= @web && @web.additional_style ? @web.additional_style.html_safe : '' %>
|
||||
/*]]>*/--></style>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= csrf_meta_tag %>
|
||||
<%- if @web -%>
|
||||
<%- if @web.markup == :markdownMML -%>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
MathML: { useMathMLspacing: true },
|
||||
"HTML-CSS": { scale: 90 }
|
||||
});
|
||||
if (window._onload_fired_) MathJax.Hub.Startup.onload();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
if (!(Prototype.Browser.Gecko || navigator.userAgent.match(/MathPlayer/))) {
|
||||
var s = document.createElement('script');
|
||||
s.src = "<%= compute_public_path('MathJax.js', 'MathJax').split('?')[0] %>?config=MML_HTMLorMML";
|
||||
document.querySelector('head').appendChild(s);
|
||||
window.addEventListener("load", function(){window._onload_fired_ = true} , false);
|
||||
};
|
||||
</script>
|
||||
<%- end -%>
|
||||
<%= auto_discovery_link_tag(:atom, {:controller => 'wiki', :web => @web.address, :action => 'atom_with_headlines'},
|
||||
:title => 'Atom with headlines') %>
|
||||
<%= auto_discovery_link_tag(:atom, {:controller => 'wiki', :web => @web.address, :action => 'atom_with_content'},
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
\usepackage{color}
|
||||
\usepackage{ucs}
|
||||
\usepackage[utf8x]{inputenc}
|
||||
\usepackage{xparse}
|
||||
\usepackage{hyperref}
|
||||
|
||||
%----Macros----------
|
||||
|
@ -146,6 +147,15 @@
|
|||
{\ooalign{\box\tw@ \cr \box\z@}}}
|
||||
\makeatother
|
||||
|
||||
% \mathraisebox{voffset}[height][depth]{something}
|
||||
\makeatletter
|
||||
\NewDocumentCommand\mathraisebox{moom}{%
|
||||
\IfNoValueTF{#2}{\def\@temp##1##2{\raisebox{#1}{$\m@th##1##2$}}}{%
|
||||
\IfNoValueTF{#3}{\def\@temp##1##2{\raisebox{#1}[#2]{$\m@th##1##2$}}%
|
||||
}{\def\@temp##1##2{\raisebox{#1}[#2][#3]{$\m@th##1##2$}}}}%
|
||||
\mathpalette\@temp{#4}}
|
||||
\makeatletter
|
||||
|
||||
% udots (taken from yhmath)
|
||||
\makeatletter
|
||||
\def\udots{\mathinner{\mkern2mu\raise\p@\hbox{.}
|
||||
|
@ -155,6 +165,8 @@
|
|||
|
||||
%% Fix array
|
||||
\newcommand{\itexarray}[1]{\begin{matrix}#1\end{matrix}}
|
||||
%% \itexnum is a noop
|
||||
\newcommand{\itexnum}[1]{#1}
|
||||
|
||||
%% Renaming existing commands
|
||||
\newcommand{\underoverset}[3]{\underset{#1}{\overset{#2}{#3}}}
|
||||
|
|
|
@ -69,9 +69,11 @@ function cleanAuthorName() {
|
|||
}
|
||||
|
||||
document.forms["editForm"].elements["content"].focus();
|
||||
<%- if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup) and !@page.categories.include?('S5-slideshow') -%>
|
||||
<%- if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup) -%>
|
||||
setupSVGedit('<%= compute_public_path("editor/svg-editor.html", "svg-edit").split(/\?/)[0] %>');
|
||||
<%- unless @page.categories.include?('S5-slideshow') -%>
|
||||
addS5button('<%= @page.name.escapeHTML %>');
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
//--><!]]>
|
||||
</script>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<%- for rev in @revisions_by_day[day] -%>
|
||||
<li>
|
||||
<%= link_to_revision(rev.page, @revision_numbers[rev.id],
|
||||
text= (rev.page.revisions.size == @revision_numbers[rev.id] ?
|
||||
text= (rev.page.rev_ids.size == @revision_numbers[rev.id] ?
|
||||
"Current" :
|
||||
"Revision #{@revision_numbers[rev.id]}" )
|
||||
) %>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div id="revision">
|
||||
<%- if @show_diff -%>
|
||||
<p class="show_diff">
|
||||
Showing changes from revision #<%= @page.revisions.size - 1 %> to #<%= @page.revisions.size %>:
|
||||
Showing changes from revision #<%= @page.rev_ids.size - 1 %> to #<%= @page.rev_ids.size %>:
|
||||
<ins class="diffins">Added</ins> | <del class="diffdel">Removed</del> | <del class="diffmod">Chan</del><ins class="diffmod">ged</ins>
|
||||
</p>
|
||||
<%= @renderer.display_diff %>
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
<%- for page in @pages_by_day[day] -%>
|
||||
<li>
|
||||
<%= link_to_existing_page page %>
|
||||
<%- if page.revisions.size > 1 %>
|
||||
<%- if page.rev_ids.size > 1 %>
|
||||
<span class="views">
|
||||
( <%= link_to_revision(page, page.revisions.size, text='diff',
|
||||
( <%= link_to_revision(page, page.rev_ids.size, text='diff',
|
||||
mode='diff') %> | <%= link_to_history(page, text='history') %> )
|
||||
</span>
|
||||
<%- end -%>
|
||||
|
|
|
@ -22,5 +22,10 @@
|
|||
|
||||
<div class="navigation navfoot">
|
||||
<%= raw navigation_menu_for_revision.join(' | ') %>
|
||||
<span class="views">
|
||||
| View:
|
||||
<%= link_to 'Source', {:web => @web.address, :action => 'source', :id => @page.name, :rev => @revision_number},
|
||||
{:id => 'view_source', :rel => 'nofollow' } %>
|
||||
</span>
|
||||
<%= render :partial => 'inbound_links' %>
|
||||
</div>
|
||||
|
|
|
@ -21,6 +21,23 @@
|
|||
|
||||
<!-- S5 JS -->
|
||||
<%= javascript_include_tag 'prototype' %>
|
||||
<%- if @web.markup == :markdownMML -%>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
MathML: { useMathMLspacing: true },
|
||||
"HTML-CSS": { scale: 90 }
|
||||
});
|
||||
if (window._onload_fired_) MathJax.Hub.Startup.onload();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
if (!(Prototype.Browser.Gecko || navigator.userAgent.match(/MathPlayer/))) {
|
||||
var s = document.createElement('script');
|
||||
s.src = "<%= compute_public_path('MathJax.js', 'MathJax').split('?')[0] %>?config=MML_HTMLorMML";
|
||||
document.querySelector('head').appendChild(s);
|
||||
window.addEventListener("load", function(){window._onload_fired_ = true} , false);
|
||||
};
|
||||
</script>
|
||||
<%- end -%>
|
||||
<%= javascript_include_tag "/s5/ui/core/slides.js" %>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<%- end -%>
|
||||
|
||||
<%- if (@results + @title_results).empty? -%>
|
||||
<h2>No pages contain "<%= h @query %>" </h2>
|
||||
<h2>No pages contain "<%= h(@query).html_safe %>" </h2>
|
||||
<p>
|
||||
Perhaps you should try expanding your query. Remember that Instiki searches for entire
|
||||
phrases, so if you search for "all that jazz" it will not match pages that contain these
|
||||
|
@ -36,6 +36,6 @@
|
|||
"[a-z]*Leet?RegExpSkill(s|z)"
|
||||
</p>
|
||||
<p>
|
||||
<b>Create a new page, named:</b> "<span class='newWikiWord'><%= link_to h(@query), :web => @web.address, :action => 'new', :id => @query %></span>"
|
||||
<b>Create a new page, named:</b> "<span class='newWikiWord'><%= link_to h(@query).html_safe, :web => @web.address, :action => 'new', :id => @query %></span>"
|
||||
</p>
|
||||
<%- end -%>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<%= Rails.root.join('public', 'stylesheets', 'instiki.css').read if @inline_style %>
|
||||
</style>
|
||||
<%= stylesheet_link_tag 'instiki', :media => 'all' unless @inline_style %>
|
||||
<%= "<style type='text/css'>#{@style_additions}</style>" if @style_additions %>
|
||||
<%= "<style type='text/css'>#{@style_additions}</style>".html_safe if @style_additions %>
|
||||
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
|
||||
<%= @web ? @web.additional_style : '' %>
|
||||
/*]]>*/--></style>
|
||||
|
@ -57,7 +57,7 @@ window.onload = function (){
|
|||
<body>
|
||||
|
||||
<div id="Container">
|
||||
<textarea id='content' readonly=' readonly' rows='24' cols='60' ><%= h(@page.content.purify) %></textarea>
|
||||
<textarea id='content' readonly=' readonly' rows='24' cols='60' ><%= (@revision ? @revision.content : @page.content).purify %></textarea>
|
||||
</div> <!-- Container -->
|
||||
|
||||
</body>
|
||||
|
|
|
@ -32,6 +32,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
connect_to_web map, ':web/revision/diff/:id/:rev', :controller => 'wiki', :action => 'revision', :mode => 'diff',
|
||||
:requirements => { :rev => /\d+/, :id => id_regexp}
|
||||
connect_to_web map, ':web/revision/:id/:rev', :controller => 'wiki', :action => 'revision', :requirements => { :rev => /\d+/, :id => id_regexp}
|
||||
connect_to_web map, ':web/source/:id/:rev', :controller => 'wiki', :action => 'source', :requirements => { :rev => /\d+/, :id => id_regexp}
|
||||
connect_to_web map, ':web/list/:category', :controller => 'wiki', :action => 'list', :requirements => { :category => /.*/}, :category => nil
|
||||
connect_to_web map, ':web/recently_revised/:category', :controller => 'wiki', :action => 'recently_revised', :requirements => { :category => /.*/}, :category => nil
|
||||
connect_to_web map, ':web/:action/:id', :controller => 'wiki', :requirements => {:id => id_regexp}
|
||||
|
|
|
@ -45,14 +45,16 @@ module Chunk
|
|||
|
||||
# Find all the chunks of the given type in content
|
||||
# Each time the pattern is matched, create a new
|
||||
# chunk for it, and replace the occurance of the chunk
|
||||
# chunk for it, and replace the occurrence of the chunk
|
||||
# in this content with its mask.
|
||||
def self.apply_to(content)
|
||||
content.gsub!( self.pattern ) do |match|
|
||||
text = content.to_str
|
||||
text.gsub!( self.pattern ) do |match|
|
||||
new_chunk = self.new($~, content)
|
||||
content.add_chunk(new_chunk)
|
||||
new_chunk.mask
|
||||
end
|
||||
end
|
||||
content.replace text
|
||||
end
|
||||
|
||||
# should contain only [a-z0-9]
|
||||
|
@ -61,7 +63,7 @@ module Chunk
|
|||
end
|
||||
|
||||
def unmask
|
||||
@content.sub!(mask){|s| s.replace @unmask_text}
|
||||
@content.replace @content.sub(mask){|s| s.replace @unmask_text}
|
||||
end
|
||||
|
||||
def rendered?
|
||||
|
@ -73,7 +75,7 @@ module Chunk
|
|||
end
|
||||
|
||||
def revert
|
||||
@content.sub!(mask){|s| s.replace @text}
|
||||
@content.replace @content.sub(mask){|s| s.replace @text}
|
||||
# unregister
|
||||
@content.delete_chunk(self)
|
||||
end
|
||||
|
|
|
@ -6,6 +6,7 @@ require 'maruku'
|
|||
require 'maruku/ext/math'
|
||||
require_dependency 'rdocsupport'
|
||||
require 'redcloth'
|
||||
require 'oldredcloth'
|
||||
|
||||
# The markup engines are Chunks that call the one of RedCloth
|
||||
# or RDoc to convert text. This markup occurs when the chunk is required
|
||||
|
@ -40,16 +41,16 @@ module Engines
|
|||
|
||||
class Markdown < AbstractEngine
|
||||
def mask
|
||||
@content.as_utf8
|
||||
text = @content.as_utf8.to_str.delete("\r").to_utf8
|
||||
# If the request is for S5, call Maruku accordingly (without math)
|
||||
if @content.options[:mode] == :s5
|
||||
my_content = Maruku.new(@content.delete("\r").to_utf8,
|
||||
my_content = Maruku.new(text,
|
||||
{:math_enabled => false, :content_only => true,
|
||||
:author => @content.options[:engine_opts][:author],
|
||||
:title => @content.options[:engine_opts][:title]})
|
||||
@content.options[:renderer].s5_theme = my_content.s5_theme
|
||||
else
|
||||
html = Maruku.new(@content.delete("\r").to_utf8, {:math_enabled => false}).to_html
|
||||
html = Maruku.new(text, {:math_enabled => false}).to_html
|
||||
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
||||
end
|
||||
|
||||
|
@ -58,10 +59,10 @@ module Engines
|
|||
|
||||
class MarkdownMML < AbstractEngine
|
||||
def mask
|
||||
@content.as_utf8
|
||||
text = @content.as_utf8.to_str.delete("\r").to_utf8
|
||||
# If the request is for S5, call Maruku accordingly
|
||||
if @content.options[:mode] == :s5
|
||||
my_content = Maruku.new(@content.delete("\r").to_utf8,
|
||||
my_content = Maruku.new(text,
|
||||
{:math_enabled => true,
|
||||
:math_numbered => ['\\[','\\begin{equation}'],
|
||||
:content_only => true,
|
||||
|
@ -70,9 +71,11 @@ module Engines
|
|||
@content.options[:renderer].s5_theme = my_content.s5_theme
|
||||
my_content.to_s5
|
||||
else
|
||||
html = Maruku.new(@content.delete("\r").to_utf8,
|
||||
(t = Time.now; nil)
|
||||
html = Maruku.new(text,
|
||||
{:math_enabled => true,
|
||||
:math_numbered => ['\\[','\\begin{equation}']}).to_html
|
||||
(ApplicationController.logger.info("Maruku took " + (Time.now-t).to_s + " seconds."); nil)
|
||||
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
||||
end
|
||||
end
|
||||
|
@ -80,10 +83,10 @@ module Engines
|
|||
|
||||
class MarkdownPNG < AbstractEngine
|
||||
def mask
|
||||
@content.as_utf8
|
||||
text = @content.as_utf8.to_str.delete("\r").to_utf8
|
||||
# If the request is for S5, call Maruku accordingly
|
||||
if @content.options[:mode] == :s5
|
||||
my_content = Maruku.new(@content.delete("\r").to_utf8,
|
||||
my_content = Maruku.new(text,
|
||||
{:math_enabled => true,
|
||||
:math_numbered => ['\\[','\\begin{equation}'],
|
||||
:html_math_output_mathml => false,
|
||||
|
@ -97,7 +100,7 @@ module Engines
|
|||
@content.options[:renderer].s5_theme = my_content.s5_theme
|
||||
my_content.to_s5
|
||||
else
|
||||
html = Maruku.new(@content.delete("\r").to_utf8,
|
||||
html = Maruku.new(text,
|
||||
{:math_enabled => true,
|
||||
:math_numbered => ['\\[','\\begin{equation}'],
|
||||
:html_math_output_mathml => false,
|
||||
|
@ -113,7 +116,7 @@ module Engines
|
|||
class Mixed < AbstractEngine
|
||||
def mask
|
||||
@content.as_utf8
|
||||
redcloth = RedCloth.new(@content, @content.options[:engine_opts])
|
||||
redcloth = OldRedCloth.new(@content.to_str, @content.options[:engine_opts])
|
||||
redcloth.filter_html = false
|
||||
redcloth.no_span_caps = false
|
||||
html = redcloth.to_html
|
||||
|
@ -122,8 +125,7 @@ module Engines
|
|||
|
||||
class RDoc < AbstractEngine
|
||||
def mask
|
||||
@content.as_utf8
|
||||
html = RDocSupport::RDocFormatter.new(@content).to_html
|
||||
html = RDocSupport::RDocFormatter.new(@content.as_utf8.to_str).to_html
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ class Include < WikiChunk::WikiReference
|
|||
else
|
||||
raise "Unsupported rendering mode #{@mode.inspect}"
|
||||
end
|
||||
@content.merge_chunks(included_content)
|
||||
# redirects and categories of included pages should not be inherited
|
||||
@content.merge_chunks(included_content.delete_chunks!([Redirect, Category]))
|
||||
clear_include_list
|
||||
return included_content.pre_rendered
|
||||
else
|
||||
|
|
|
@ -18,7 +18,7 @@ module Literal
|
|||
# A literal chunk that protects 'code' and 'pre' tags from wiki rendering.
|
||||
class Pre < AbstractLiteral
|
||||
PRE_BLOCKS = "a|pre|code|math"
|
||||
PRE_PATTERN = Regexp.new('<('+PRE_BLOCKS+')\b[^>]*?>.*?</\1>', Regexp::MULTILINE)
|
||||
PRE_PATTERN = Regexp.new('<('+PRE_BLOCKS+')\b[^>]*?(>.*?</\1>|/>)', Regexp::MULTILINE)
|
||||
def self.pattern() PRE_PATTERN end
|
||||
end
|
||||
|
||||
|
@ -30,9 +30,9 @@ module Literal
|
|||
|
||||
# A literal chunk that protects equations from wiki rendering.
|
||||
class Math < AbstractLiteral
|
||||
MATH_START = '(\${1,2}|' + Regexp.escape('\[') + '|\\begin\{equation\})'
|
||||
MATH_END = '(\${1,2}|' + Regexp.escape('\]') + '|\\end\{equation\})'
|
||||
MATH_PATTERN = Regexp.new(MATH_START + '([^$]|\\\$)+?' + MATH_END, Regexp::MULTILINE)
|
||||
MATH_START = "(?:\\\\\\[|\\${1,2}|\\\\begin\\{equation\\})"
|
||||
MATH_END = "(?:\\\\\\]|\\${1,2}|\\\\end\\{equation\\})"
|
||||
MATH_PATTERN = Regexp.new( '(' + MATH_START + "(?:\\\\\\$|(?!\\$|\\\\\\]|\\\\end\\{equation\\}).)+?" + MATH_END + ')', Regexp::MULTILINE)
|
||||
def self.pattern() MATH_PATTERN end
|
||||
end
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ module WikiChunk
|
|||
end
|
||||
|
||||
def self.apply_to(content)
|
||||
content.as_utf8.gsub!( self.pattern ) do |matched_text|
|
||||
text = content.as_utf8.to_str
|
||||
text.gsub!( self.pattern ) do |matched_text|
|
||||
chunk = self.new($~, content)
|
||||
if chunk.textile_url?
|
||||
# do not substitute
|
||||
|
@ -44,6 +45,7 @@ module WikiChunk
|
|||
chunk.mask
|
||||
end
|
||||
end
|
||||
content.replace text
|
||||
end
|
||||
|
||||
def textile_url?
|
||||
|
|
|
@ -2329,24 +2329,16 @@ end
|
|||
when /\Aquot\z/ni then '"'
|
||||
when /\Aapos\z/ni then "'"
|
||||
when /\A#0*(\d+)\z/n then
|
||||
if Integer($1) < 256
|
||||
Integer($1).chr
|
||||
if Integer($1) < 1114111
|
||||
[Integer($1)].pack("U")
|
||||
else
|
||||
if Integer($1) < 1114111
|
||||
[Integer($1)].pack("U")
|
||||
else
|
||||
"&##{$1};"
|
||||
end
|
||||
"&##{$1};"
|
||||
end
|
||||
when /\A#x([0-9a-f]+)\z/ni then
|
||||
if $1.hex < 256
|
||||
if $1.hex < 1114111
|
||||
[$1.hex].pack("U")
|
||||
else
|
||||
if $1.hex < 1114111
|
||||
[$1.hex].pack("U")
|
||||
else
|
||||
"&#x#{$1};"
|
||||
end
|
||||
"&#x#{$1};"
|
||||
end
|
||||
else
|
||||
"&#{match};"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -39,7 +39,7 @@ class RDocMarkup < SM::SimpleMarkup
|
|||
end
|
||||
|
||||
def convert(text, handler)
|
||||
super.sub(/^<p>\n/, '').sub(/<\/p>$/, '')
|
||||
super.sub(/^\n{0,1}<p>\n{0,1}/, '').sub(/\n{0,1}<\/p>\n{0,1}$/, '')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
1113
lib/redcloth.rb
1113
lib/redcloth.rb
File diff suppressed because it is too large
Load Diff
|
@ -9,6 +9,7 @@ module Sanitizer
|
|||
require 'node'
|
||||
require 'instiki_stringsupport'
|
||||
require 'set'
|
||||
require 'nokogiri'
|
||||
|
||||
acceptable_elements = Set.new %w[a abbr acronym address area article aside
|
||||
audio b big blockquote br button canvas caption center cite code
|
||||
|
@ -47,7 +48,7 @@ module Sanitizer
|
|||
frame height linethickness lspace mathbackground mathcolor mathvariant
|
||||
maxsize minsize notation open other rowalign
|
||||
rowlines rowspacing rowspan rspace scriptlevel selection separator
|
||||
separators stretchy width xlink:href xlink:show xlink:type xmlns
|
||||
separators stretchy width voffset xlink:href xlink:show xlink:type xmlns
|
||||
xmlns:xlink]
|
||||
|
||||
svg_attributes = Set.new %w[accent-height accumulate additive alphabetic
|
||||
|
@ -227,9 +228,9 @@ module Sanitizer
|
|||
# (REXML trees are always utf-8 encoded.)
|
||||
def safe_xhtml_sanitize(html, options = {})
|
||||
sanitized = xhtml_sanitize(html.purify)
|
||||
doc = REXML::Document.new("<div xmlns='http://www.w3.org/1999/xhtml'>#{sanitized}</div>")
|
||||
sanitized = doc.to_s.gsub(/\A<div xmlns='http:\/\/www.w3.org\/1999\/xhtml'>(.*)<\/div>\Z/m, '\1')
|
||||
rescue REXML::ParseException
|
||||
doc = Nokogiri::XML::Document.parse("<div xmlns='http://www.w3.org/1999/xhtml'>#{sanitized}</div>", nil, (options[:encoding] || 'UTF-8'), 0)
|
||||
sanitized = doc.root.children.to_xml(:indent => (options[:indent] || 2), :save_with => 2 )
|
||||
rescue Nokogiri::XML::SyntaxError
|
||||
sanitized = sanitized.escapeHTML
|
||||
end
|
||||
|
||||
|
|
|
@ -31,4 +31,4 @@ class InstikiUpgrade
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -64,6 +64,7 @@ class UrlGenerator < AbstractUrlGenerator
|
|||
private
|
||||
|
||||
def file_link(mode, name, text, web_address, known_file, description)
|
||||
return bad_filename(name) unless WikiFile.is_valid?(name)
|
||||
case mode
|
||||
when :export
|
||||
if known_file
|
||||
|
@ -116,6 +117,7 @@ class UrlGenerator < AbstractUrlGenerator
|
|||
end
|
||||
|
||||
def pic_link(mode, name, text, web_address, known_pic)
|
||||
return bad_filename(name) unless WikiFile.is_valid?(name)
|
||||
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
||||
:id => name, :only_path => true
|
||||
case mode
|
||||
|
@ -141,6 +143,7 @@ class UrlGenerator < AbstractUrlGenerator
|
|||
end
|
||||
|
||||
def media_link(mode, name, text, web_address, known_media, media_type)
|
||||
return bad_filename(name) unless WikiFile.is_valid?(name)
|
||||
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
|
||||
:id => name, :only_path => true
|
||||
case mode
|
||||
|
@ -177,6 +180,10 @@ class UrlGenerator < AbstractUrlGenerator
|
|||
|
||||
private
|
||||
|
||||
def bad_filename(name)
|
||||
"<span class='badWikiWord'>[[invalid filename: #{name}]]</span>"
|
||||
end
|
||||
|
||||
def wikilink_for(mode, name, text, web_address)
|
||||
web = Web.find_by_address(web_address)
|
||||
action = web.published? && (web != @web || [:publish, :s5].include?(mode) ) ? 'published' : 'show'
|
||||
|
|
|
@ -8,6 +8,7 @@ require_dependency 'chunks/literal'
|
|||
require 'chunks/nowiki'
|
||||
require 'sanitizer'
|
||||
require 'instiki_stringsupport'
|
||||
require 'set'
|
||||
|
||||
|
||||
# Wiki content is just a string that can process itself with a chain of
|
||||
|
@ -53,10 +54,10 @@ module ChunkManager
|
|||
def init_chunk_manager
|
||||
@chunks_by_type = Hash.new
|
||||
Chunk::Abstract::derivatives.each{|chunk_type|
|
||||
@chunks_by_type[chunk_type] = Array.new
|
||||
@chunks_by_type[chunk_type] = Set.new
|
||||
}
|
||||
@chunks_by_id = Hash.new
|
||||
@chunks = []
|
||||
@chunks = Set.new
|
||||
@chunk_id = 0
|
||||
end
|
||||
|
||||
|
@ -185,6 +186,16 @@ class WikiContent < ActiveSupport::SafeBuffer
|
|||
end
|
||||
end
|
||||
|
||||
def delete_chunks!(types)
|
||||
types.each do |t|
|
||||
@chunks_by_type[t].each do |c|
|
||||
@pre_rendered.sub!(c.mask, '') if @pre_rendered
|
||||
@chunks.delete(c)
|
||||
end
|
||||
end
|
||||
self
|
||||
end
|
||||
|
||||
def pre_render!
|
||||
unless @pre_rendered
|
||||
@chunks_by_type[Include].each{|chunk| chunk.unmask }
|
||||
|
@ -198,7 +209,8 @@ class WikiContent < ActiveSupport::SafeBuffer
|
|||
@options[:engine].apply_to(self)
|
||||
as_utf8
|
||||
# unmask in one go. $~[1] is the chunk id
|
||||
gsub!(MASK_RE[ACTIVE_CHUNKS]) do
|
||||
text = self.to_str
|
||||
text.gsub!(MASK_RE[ACTIVE_CHUNKS]) do
|
||||
chunk = @chunks_by_id[$~[1].to_i]
|
||||
if chunk.nil?
|
||||
# if we match a chunkmask that existed in the original content string
|
||||
|
@ -208,7 +220,7 @@ class WikiContent < ActiveSupport::SafeBuffer
|
|||
chunk.unmask_text
|
||||
end
|
||||
end
|
||||
self.replace xhtml_sanitize(self)
|
||||
self.replace xhtml_sanitize(text)
|
||||
self.html_safe
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
This is release branch v1.1 of MathJax.
|
|
@ -0,0 +1,52 @@
|
|||
# MathJax
|
||||
|
||||
## Beautiful math in all browsers
|
||||
|
||||
MathJax is an open-source JavaScript display engine for LaTeX and MathML
|
||||
that works in all modern browsers. It was designed with the goal of
|
||||
consolidating the recent advances in web technologies into a single,
|
||||
definitive, math-on-the-web platform supporting the major browsers and
|
||||
operating systems. It requires no setup on the part of the user (no
|
||||
plugins to download or software to install), so the page author can write
|
||||
web documents that include mathematics and be confident that users will be
|
||||
able to view it naturally and easily. Simply include MathJax and some
|
||||
mathematics in a web page, and MathJax does the rest.
|
||||
|
||||
Some of the main features of MathJax include:
|
||||
|
||||
- High-quality display of LaTeX and MathML math notation in HTML pages
|
||||
|
||||
- Supported in most browsers with no plug-ins, extra fonts, or special
|
||||
setup for the reader
|
||||
|
||||
- Easy for authors, flexible for publishers, extensible for developers
|
||||
|
||||
- Supports math accessibility, cut-and-paste interoperability and other
|
||||
advanced functionality
|
||||
|
||||
- Powerful API for integration with other web applications
|
||||
|
||||
See <http://www.mathjax.org/> for additional details.
|
||||
|
||||
|
||||
## Installation and Usage
|
||||
|
||||
The MathJax installation and usage documentation is available in the
|
||||
`docs/html` directory of the MathJax distribution (see
|
||||
`docs/html/index.html` for the starting point). The documents are also
|
||||
available on the MathJax web site on line at <http://www.mathjax.org/resources/docs/>.
|
||||
|
||||
|
||||
## Community
|
||||
|
||||
The main MathJax website is <http://www.mathjax.org>, and it includes
|
||||
announcements and other important information. MathJax is maintained and
|
||||
distributed on GitHub at <http://github.com/mathjax/MathJax>. A user forum
|
||||
for asking questions and getting assistance is hosted at Google, and the
|
||||
bug tracker is hosted at GitHub:
|
||||
|
||||
Bug tracker: <https://github.com/mathjax/MathJax/issues>
|
||||
MathJax-Users Group: <http://groups.google.com/group/mathjax-users>
|
||||
|
||||
Before reporting a bug, please check that it has not already been reported.
|
||||
Also, please use the bug tracker for reporting bugs rather than the help forum.
|
|
@ -0,0 +1,55 @@
|
|||
OVERVIEW:
|
||||
|
||||
MathJax is an open-source JavaScript display engine for LaTeX and
|
||||
MathML that works in all modern browsers. It was designed with the
|
||||
goal of consolidating the recent advances in web technologies into a
|
||||
single, definitive, math-on-the-web platform supporting the major
|
||||
browsers and operating systems. It requires no setup on the part of
|
||||
the user (no plugins to downlaod or software to install), so the page
|
||||
author can write web documents that include mathematics and be
|
||||
confident that users will be able to view it naturally and easily.
|
||||
One simply includes MathJax and some mathematics in a web page, and
|
||||
MathJax does the rest.
|
||||
|
||||
Some of the main features of MathJax include:
|
||||
|
||||
o High-quality display of LaTeX and MathML math notation in HTML pages
|
||||
|
||||
o Supported in most browsers with no plug-ins, extra fonts, or special
|
||||
setup for the reader
|
||||
|
||||
o Easy for authors, flexible for publishers, extensible for developers
|
||||
|
||||
o Supports math accessibility, cut and paste interoperability and other
|
||||
advanced functionality
|
||||
|
||||
o Powerful API for integration with other web applications
|
||||
|
||||
See http://www.mathjax.org/ for additional details.
|
||||
|
||||
|
||||
INSTALLATION AND USAGE:
|
||||
|
||||
The MathJax installation and usage documentation is available on the
|
||||
docs/html directory of the MathJax distribution (see
|
||||
docs/html/index.html for the starting point). The documents are also
|
||||
available on the MathJax web site on line at
|
||||
|
||||
http://www.mathjax.org/docs/
|
||||
|
||||
|
||||
COMMUNITY:
|
||||
|
||||
The main MathJax website is www.mathjax.org, and it includes announcements
|
||||
and other important information. MathJax also has a SourceForge site at
|
||||
http://sourceforge.net/projects/mathjax/ that includes the download site
|
||||
for the MathJax distribution, the bug-tracker for reporting bugs, and
|
||||
several user forums for asking questions and getting assistance:
|
||||
|
||||
Bug tracker: http://sourceforge.net/tracker/?group_id=261188&atid=1240827
|
||||
MathJax Help: http://sourceforge.net/projects/mathjax/forums/forum/948701
|
||||
Open Discussion: http://sourceforge.net/projects/mathjax/forums/forum/948700
|
||||
|
||||
Before reporting a bug, please check that it has not already been reported.
|
||||
Also, please use the bug tracker for reporting bugs rather than the help
|
||||
forum.
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/config/MMLorHTML.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
(function(c){var h="1.1.1";var a=MathJax.Hub.CombineConfig("MMLorHTML",{prefer:{MSIE:"MML",Firefox:"MML",Opera:"HTML",other:"HTML"}});var e={Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4};var b=(c.Browser.version==="0.0"||c.Browser.versionAtLeast(e[c.Browser]||0));var g=false;if(!c.Browser.isIE9){try{new ActiveXObject("MathPlayer.Factory.1");g=true}catch(f){}}var d=(c.Browser.isFirefox&&c.Browser.versionAtLeast("1.5"))||(c.Browser.isMSIE&&g)||(c.Browser.isOpera&&c.Browser.versionAtLeast("9.52"));c.Register.StartupHook("End Config",function(){var i=(a.prefer&&typeof(a.prefer)==="object"?a.prefer[MathJax.Hub.Browser]||a.prefer.other||"HTML":a.prefer);if(b||d){if(d&&(i==="MML"||!b)){if(MathJax.OutputJax.NativeMML){MathJax.OutputJax.NativeMML.Register("jax/mml")}else{c.config.jax.unshift("output/NativeMML")}c.Startup.signal.Post("NativeMML output selected")}else{if(MathJax.OutputJax["HTML-CSS"]){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}else{c.config.jax.unshift("output/HTML-CSS")}c.Startup.signal.Post("HTML-CSS output selected")}}else{c.PreProcess.disabled=true;c.prepareScripts.disabled=true;MathJax.Message.Set("Your browser does not support MathJax",null,4000);c.Startup.signal.Post("MathJax not supported")}})})(MathJax.Hub);MathJax.Ajax.loadComplete("[MathJax]/config/MMLorHTML.js");
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,606 @@
|
|||
/*************************************************************
|
||||
*
|
||||
* MathJax/config/default.js
|
||||
*
|
||||
* This configuration file is loaded when you load MathJax
|
||||
* via <script src="MathJax.js?config=default"></script>
|
||||
*
|
||||
* Use it to customize the MathJax settings. See comments below.
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2009-2011 Design Science, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This file lists most, but not all, of the options that can be set for
|
||||
* MathJax and its various components. Some additional options are
|
||||
* available, however, and are listed in the various links at:
|
||||
*
|
||||
* http://www.mathjax.org/resources/docs/?configuration.html#configuration-options-by-component
|
||||
*
|
||||
* You can add these to the configuration object below if you
|
||||
* want to change them from their default values.
|
||||
*/
|
||||
|
||||
MathJax.Hub.Config({
|
||||
|
||||
//
|
||||
// A comma-separated list of configuration files to load
|
||||
// when MathJax starts up. E.g., to define local macros, etc.
|
||||
// The default directory is the MathJax/config directory.
|
||||
//
|
||||
// Example: config: ["local/local.js"],
|
||||
// Example: config: ["local/local.js","MMLtoHTML.js"],
|
||||
//
|
||||
config: [],
|
||||
|
||||
//
|
||||
// A comma-separated list of CSS stylesheet files to be loaded
|
||||
// when MathJax starts up. The default directory is the
|
||||
// MathJax/config directory.
|
||||
//
|
||||
// Example: styleSheets: ["MathJax.css"],
|
||||
//
|
||||
styleSheets: [],
|
||||
|
||||
//
|
||||
// Styles to be defined dynamically at startup time.
|
||||
//
|
||||
// Example:
|
||||
// styles: {
|
||||
// ".MathJax .merror": {
|
||||
// color: "blue",
|
||||
// "background-color": "green"
|
||||
// }
|
||||
// },
|
||||
//
|
||||
styles: {},
|
||||
|
||||
//
|
||||
// A comma-separated list of input and output jax to initialize at startup.
|
||||
// Their main code is loaded only when they are actually used, so it is not
|
||||
// inefficient to include jax that may not actually be used on the page. These
|
||||
// are found in the MathJax/jax directory.
|
||||
//
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
|
||||
//
|
||||
// A comma-separated list of extensions to load at startup. The default
|
||||
// directory is MathJax/extensions.
|
||||
//
|
||||
// Example: extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
|
||||
//
|
||||
extensions: ["tex2jax.js"],
|
||||
|
||||
//
|
||||
// Patterns to remove from before and after math script tags. If you are not
|
||||
// using one of the preprocessors (e.g., tex2jax), you need to insert something
|
||||
// extra into your HTML file in order to avoid a bug in Internet Explorer. IE
|
||||
// removes spaces from the DOM that it thinks are redundent, and since a SCRIPT
|
||||
// tag usually doesn't add content to the page, if there is a space before and after
|
||||
// a MathJax SCRIPT tag, IE will remove the first space. When MathJax inserts
|
||||
// the typeset mathematics, this means there will be no space before it and the
|
||||
// preceeding text. In order to avoid this, you should include some "guard characters"
|
||||
// before or after the math SCRIPT tag; define the patterns you want to use below.
|
||||
// Note that these are used as regular expressions, so you will need to quote
|
||||
// special characters. Furthermore, since they are javascript strings, you must
|
||||
// quote javascript special characters as well. So to obtain a backslash, you must
|
||||
// use \\ (doubled for javascript). For example, "\\[" is the pattern \[ in the
|
||||
// regular expression. That means that if you want an actual backslash in your
|
||||
// guard characters, you need to use "\\\\" in order to get \\ in the regular
|
||||
// expression, and \ in the actual text. If both preJax and postJax are defined,
|
||||
// both must be present in order to be removed.
|
||||
//
|
||||
// See also the preRemoveClass comments below.
|
||||
//
|
||||
// Example:
|
||||
// preJax: "\\\\\\\\", // makes a double backslash the preJax text
|
||||
// or
|
||||
// preJax: "\\[\\[", // jax scripts must be enclosed in double brackets
|
||||
// postJax: "\\]\\]",
|
||||
//
|
||||
preJax: null,
|
||||
postJax: null,
|
||||
|
||||
//
|
||||
// The CSS class for a math preview to be removed preceeding a MathJax
|
||||
// SCRIPT tag. If the tag just before the MathJax SCRIPT tag is of this
|
||||
// class, its contents are removed when MathJax processes the SCRIPT
|
||||
// tag. This allows you to include a math preview in a form that will
|
||||
// be displayed prior to MathJax performing its typesetting. It also
|
||||
// avoids the Internet Explorer space-removal bug, and can be used in
|
||||
// place of preJax and postJax if that is more convenient.
|
||||
//
|
||||
// For example
|
||||
//
|
||||
// <span class="MathJax_Preview">[math]</span><script type="math/tex">...</script>
|
||||
//
|
||||
// would display "[math]" in place of the math until MathJax is able to typeset it.
|
||||
//
|
||||
preRemoveClass: "MathJax_Preview",
|
||||
|
||||
//
|
||||
// This value controls whether the "Processing Math: nn%" message are displayed
|
||||
// in the lower left-hand corner. Set to "false" to prevent those messages (though
|
||||
// file loading and other messages will still be shown).
|
||||
//
|
||||
showProcessingMessages: true,
|
||||
|
||||
//
|
||||
// This value controls the verbosity of the messages in the lower left-hand corner.
|
||||
// Set it to "none" to eliminate all messages, or set it to "simple" to show
|
||||
// "Loading..." and "Processing..." rather than showing the full file name and the
|
||||
// percentage of the mathematics processed.
|
||||
//
|
||||
messageStyle: "normal",
|
||||
|
||||
//
|
||||
// These two parameters control the alignment and shifting of displayed equations.
|
||||
// The first can be "left", "center", or "right", and determines the alignment of
|
||||
// displayed equations. When the alignment is not "center", the second determines
|
||||
// an indentation from the left or right side for the displayed equations.
|
||||
//
|
||||
displayAlign: "center",
|
||||
displayIndent: "0em",
|
||||
|
||||
//
|
||||
// Normally MathJax will perform its starup commands (loading of
|
||||
// configuration, styles, jax, and so on) as soon as it can. If you
|
||||
// expect to be doing additional configuration on the page, however, you
|
||||
// may want to have it wait until the page's onload hander is called. If so,
|
||||
// set this to "onload".
|
||||
//
|
||||
delayStartupUntil: "none",
|
||||
|
||||
//
|
||||
// Normally MathJax will typeset the mathematics on the page as soon as
|
||||
// the page is loaded. If you want to delay that process, in which case
|
||||
// you will need to call MathJax.Hub.Typeset() yourself by hand, set
|
||||
// this value to true.
|
||||
//
|
||||
skipStartupTypeset: false,
|
||||
|
||||
//
|
||||
// A list of element ID's that are the ones to process for mathematics
|
||||
// when any of the Hub typesetting calls (Typeset, Process, Update, etc)
|
||||
// are called with no element specified. This lets you restrict the
|
||||
// processing to particular containers rather than scanning the entire
|
||||
// document for mathematics. If none are supplied, the entire document
|
||||
// is processed.
|
||||
//
|
||||
elements: [],
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the tex2jax preprocessor (when you have included
|
||||
// "tex2jax.js" in the extensions list above).
|
||||
//
|
||||
tex2jax: {
|
||||
|
||||
//
|
||||
// The delimiters that surround in-line math expressions. The first in each
|
||||
// pair is the initial delimiter and the second is the terminal delimiter.
|
||||
// Comment out any that you don't want, but be sure there is no extra
|
||||
// comma at the end of the last item in the list -- some browsers won't
|
||||
// be able to handle that.
|
||||
//
|
||||
inlineMath: [
|
||||
// ['$','$'], // uncomment this for standard TeX math delimiters
|
||||
['\\(','\\)']
|
||||
],
|
||||
|
||||
//
|
||||
// The delimiters that surround displayed math expressions. The first in each
|
||||
// pair is the initial delimiter and the second is the terminal delimiter.
|
||||
// Comment out any that you don't want, but be sure there is no extra
|
||||
// comma at the end of the last item in the list -- some browsers won't
|
||||
// be able to handle that.
|
||||
//
|
||||
displayMath: [
|
||||
['$$','$$'],
|
||||
['\\[','\\]']
|
||||
],
|
||||
|
||||
//
|
||||
// This array lists the names of the tags whose contents should not be
|
||||
// processed by tex2jax (other than to look for ignore/process classes
|
||||
// as listed below). You can add to (or remove from) this list to prevent
|
||||
// MathJax from processing mathematics in specific contexts.
|
||||
//
|
||||
skipTags: ["script","noscript","style","textarea","pre","code"],
|
||||
|
||||
//
|
||||
// This is the class name used to mark elements whose contents should
|
||||
// not be processed by tex2jax (other than to look for the
|
||||
// processClass pattern below). Note that this is a regular
|
||||
// expression, and so you need to be sure to quote any regexp special
|
||||
// characters. The pattern is automatically preceeded by '(^| )(' and
|
||||
// followed by ')( |$)', so your pattern will have to match full words
|
||||
// in the class name. Assigning an element this class name will
|
||||
// prevent `tex2jax` from processing its contents.
|
||||
//
|
||||
ignoreClass: "tex2jax_ignore",
|
||||
|
||||
//
|
||||
// This is the class name used to mark elements whose contents SHOULD
|
||||
// be processed by tex2jax. This is used to turn on processing within
|
||||
// tags that have been marked as ignored or skipped above. Note that
|
||||
// this is a regular expression, and so you need to be sure to quote
|
||||
// any regexp special characters. The pattern is automatically
|
||||
// preceeded by '(^| )(' and followed by ')( |$)', so your pattern
|
||||
// will have to match full words in the class name. Use this to
|
||||
// restart processing within an element that has been marked as
|
||||
// ignored above.
|
||||
//
|
||||
processClass: "tex2jax_process",
|
||||
|
||||
//
|
||||
// Set to "true" to allow \$ to produce a dollar without starting in-line
|
||||
// math mode. If you uncomment the ['$','$'] line above, you should change
|
||||
// this to true so that you can insert plain dollar signs into your documents
|
||||
//
|
||||
processEscapes: false,
|
||||
|
||||
//
|
||||
// Controls whether tex2jax processes LaTeX environments outside of math
|
||||
// mode. Set to "false" to prevent processing of environments except within
|
||||
// math mode.
|
||||
//
|
||||
processEnvironments: true,
|
||||
|
||||
//
|
||||
// Controls whether tex2jax inserts MathJax_Preview spans to make a
|
||||
// preview available, and what preview to use, when it locates in-line
|
||||
// and display mathetics on the page. The default is "TeX", which
|
||||
// means use the TeX code as the preview (until it is processed by
|
||||
// MathJax). Set to "none" to prevent the previews from being
|
||||
// inserted (the math will simply disappear until it is typeset). Set
|
||||
// to an array containing the description of an HTML snippet in order
|
||||
// to use the same preview for all equations on the page (e.g., you
|
||||
// could have it say "[math]" or load an image).
|
||||
//
|
||||
// E.g., preview: ["[math]"],
|
||||
// or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]]
|
||||
//
|
||||
preview: "TeX"
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the mml2jax preprocessor (when you have included
|
||||
// "mml2jax.js" in the extensions list above).
|
||||
//
|
||||
mml2jax: {
|
||||
|
||||
//
|
||||
// Controls whether mml2jax inserts MathJax_Preview spans to make a
|
||||
// preview available, and what preview to use, whrn it locates
|
||||
// mathematics on the page. The default is "alttext", which means use
|
||||
// the <math> tag's alttext attribute as the preview (until it is
|
||||
// processed by MathJax), if the tag has one. Set to "none" to
|
||||
// prevent the previews from being inserted (the math will simply
|
||||
// disappear until it is typeset). Set to an array containing the
|
||||
// description of an HTML snippet in order to use the same preview for
|
||||
// all equations on the page (e.g., you could have it say "[math]" or
|
||||
// load an image).
|
||||
//
|
||||
// E.g., preview: ["[math]"],
|
||||
// or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]]
|
||||
//
|
||||
preview: "alttext"
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the jsMath2jax preprocessor (when you have included
|
||||
// "jsMath2jax.js" in the extensions list above).
|
||||
//
|
||||
jsMath2jax: {
|
||||
|
||||
//
|
||||
// Controls whether jsMath2jax inserts MathJax_Preview spans to make a
|
||||
// preview available, and what preview to use, when it locates
|
||||
// mathematics on the page. The default is "TeX", which means use the
|
||||
// TeX code as the preview (until it is processed by MathJax). Set to
|
||||
// "none" to prevent the previews from being inserted (the math will
|
||||
// simply disappear until it is typeset). Set to an array containing
|
||||
// the description of an HTML snippet in order to use the same preview
|
||||
// for all equations on the page (e.g., you could have it say "[math]"
|
||||
// or load an image).
|
||||
//
|
||||
// E.g., preview: ["[math]"],
|
||||
// or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]]
|
||||
//
|
||||
preview: "TeX"
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the TeX input jax.
|
||||
//
|
||||
TeX: {
|
||||
|
||||
//
|
||||
// This specifies the side on which \tag{} macros will place the tags.
|
||||
// Set to "left" to place on the left-hand side.
|
||||
//
|
||||
TagSide: "right",
|
||||
|
||||
//
|
||||
// This is the amound of indentation (from right or left) for the tags.
|
||||
//
|
||||
TagIndent: ".8em",
|
||||
|
||||
//
|
||||
// This is the width to use for the multline environment
|
||||
//
|
||||
MultLineWidth: "85%",
|
||||
|
||||
//
|
||||
// List of macros to define. These are of the form
|
||||
// name: value
|
||||
// where 'value' is the replacement text for the macro \name.
|
||||
// The 'value' can also be [value,n] where 'value' is the replacement
|
||||
// text and 'n' is the number of parameters for the macro.
|
||||
// Note that backslashes must be doubled in the replacement string.
|
||||
//
|
||||
// E.g.,
|
||||
//
|
||||
// Macros: {
|
||||
// RR: '{\\bf R}',
|
||||
// bold: ['{\\bf #1}', 1]
|
||||
// }
|
||||
//
|
||||
Macros: {}
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the MathML inupt jax.
|
||||
//
|
||||
MathML: {
|
||||
//
|
||||
// This specifies whether to use TeX spacing or MathML spacing when the
|
||||
// HTML-CSS output jax is used.
|
||||
//
|
||||
useMathMLspacing: false
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the HTML-CSS output jax.
|
||||
//
|
||||
"HTML-CSS": {
|
||||
|
||||
//
|
||||
// This controls the global scaling of mathematics as compared to the
|
||||
// surrounding text. Values between 100 and 133 are usually good choices.
|
||||
//
|
||||
scale: 100,
|
||||
|
||||
//
|
||||
// This is a list of the fonts to look for on a user's computer in
|
||||
// preference to using MathJax's web-based fonts. These must
|
||||
// correspond to directories available in the jax/output/HTML-CSS/fonts
|
||||
// directory, where MathJax stores data about the characters available
|
||||
// in the fonts. Set this to ["TeX"], for example, to prevent the
|
||||
// use of the STIX fonts, or set it to an empty list, [], if
|
||||
// you want to force MathJax to use web-based or image fonts.
|
||||
//
|
||||
availableFonts: ["STIX","TeX"],
|
||||
|
||||
//
|
||||
// This is the preferred font to use when more than one of those
|
||||
// listed above is available.
|
||||
//
|
||||
preferredFont: "TeX",
|
||||
|
||||
//
|
||||
// This is the web-based font to use when none of the fonts listed
|
||||
// above are available on the user's computer. Note that currently
|
||||
// only the TeX font is available in a web-based form. Set this to
|
||||
//
|
||||
// webFont: null,
|
||||
//
|
||||
// if you want to prevent the use of web-based fonts.
|
||||
//
|
||||
webFont: "TeX",
|
||||
|
||||
//
|
||||
// This is the font to use for image fallback mode (when none of the
|
||||
// fonts listed above are available and the browser doesn't support
|
||||
// web-fonts via the @font-face CSS directive). Note that currently
|
||||
// only the TeX font is available as an image font. Set this to
|
||||
//
|
||||
// imageFont: null,
|
||||
//
|
||||
// if you want to prevent the use of image fonts (e.g., you have not
|
||||
// installed the image fonts on your server). In this case, only
|
||||
// browsers that support web-based fonts will be able to view your pages
|
||||
// without having the fonts installed on the client computer. The browsers
|
||||
// that support web-based fonts include: IE6 and later, Chrome, Safari3.1
|
||||
// and above, Firefox3.5 and later, and Opera10 and later. Note that
|
||||
// Firefox3.0 is NOT on this list, so without image fonts, FF3.0 users
|
||||
// will be required to to download and install either the STIX fonts or the
|
||||
// MathJax TeX fonts.
|
||||
//
|
||||
imageFont: "TeX",
|
||||
|
||||
//
|
||||
// This is the font-family CSS value used for characters that are not
|
||||
// in the selected font (e.g., for web-based fonts, this is where to
|
||||
// look for characters not included in the MathJax_* fonts). IE will
|
||||
// stop looking after the first font that exists on the system (even
|
||||
// if it doesn't contain the needed character), so order these carefully.
|
||||
//
|
||||
undefinedFamily: "STIXGeneral,'Arial Unicode MS',serif",
|
||||
|
||||
//
|
||||
// This controls whether the MathJax contextual menu will be available
|
||||
// on the mathematics in the page. If true, then right-clicking (on
|
||||
// the PC) or control-clicking (on the Mac) will produce a MathJax
|
||||
// menu that allows you to get the source of the mathematics in
|
||||
// various formats, change the size of the mathematics relative to the
|
||||
// surrounding text, and get information about MathJax.
|
||||
//
|
||||
// Set this to false to disable the menu. When true, the MathMenu
|
||||
// items below configure the actions of the menu.
|
||||
//
|
||||
showMathMenu: true,
|
||||
|
||||
//
|
||||
// This allows you to define or modify the styles used to display
|
||||
// various math elements created by MathJax.
|
||||
//
|
||||
// Example:
|
||||
// styles: {
|
||||
// ".MathJax_Preview": {
|
||||
// "font-size": "80%", // preview uses a smaller font
|
||||
// color: "red" // and is in red
|
||||
// }
|
||||
// }
|
||||
//
|
||||
styles: {},
|
||||
|
||||
//
|
||||
// Configuration for <maction> tooltips
|
||||
// (see also the #MathJax_Tooltip CSS in MathJax/jax/output/HTML-CSS/config.js,
|
||||
// which can be overriden using the styles values above).
|
||||
//
|
||||
tooltip: {
|
||||
delayPost: 600, // milliseconds delay before tooltip is posted after mouseover
|
||||
delayClear: 600, // milliseconds delay before tooltip is cleared after mouseout
|
||||
offsetX: 10, offsetY: 5 // pixels to offset tooltip from mouse position
|
||||
}
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the NativeMML output jax.
|
||||
//
|
||||
NativeMML: {
|
||||
|
||||
//
|
||||
// This controls the global scaling of mathematics as compared to the
|
||||
// surrounding text. Values between 100 and 133 are usually good choices.
|
||||
//
|
||||
scale: 100,
|
||||
|
||||
//
|
||||
// This controls whether the MathJax contextual menu will be available
|
||||
// on the mathematics in the page. If true, then right-clicking (on
|
||||
// the PC) or control-clicking (on the Mac) will produce a MathJax
|
||||
// menu that allows you to get the source of the mathematics in
|
||||
// various formats, change the size of the mathematics relative to the
|
||||
// surrounding text, and get information about MathJax.
|
||||
//
|
||||
// Set this to false to disable the menu. When true, the MathMenu
|
||||
// items below configure the actions of the menu.
|
||||
//
|
||||
// There is a separate setting for MSIE, since the code to handle that
|
||||
// is a bit delicate; if it turns out to have unexpected consequences,
|
||||
// you can turn it off without turing off other browser support.
|
||||
//
|
||||
showMathMenu: true,
|
||||
showMathMenuMSIE: true,
|
||||
|
||||
//
|
||||
// This allows you to define or modify the styles used to display
|
||||
// various math elements created by MathJax.
|
||||
//
|
||||
// Example:
|
||||
// styles: {
|
||||
// ".MathJax_MathML": {
|
||||
// color: "red" // MathML is in red
|
||||
// }
|
||||
// }
|
||||
//
|
||||
styles: {}
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the contextual menus that are available on the
|
||||
// mathematics within the page (provided the showMathMenu value is true above).
|
||||
//
|
||||
MathMenu: {
|
||||
//
|
||||
// This is the hover delay for the display of submenus in the
|
||||
// contextual menu. When the mouse is still over a submenu label for
|
||||
// this long, the menu will appear. (The menu also will appear if you
|
||||
// click on the label.) It is in milliseconds.
|
||||
//
|
||||
delay: 400,
|
||||
|
||||
//
|
||||
// This is the URL for the MathJax Help menu item.
|
||||
//
|
||||
helpURL: "http://www.mathjax.org/help/user/",
|
||||
|
||||
//
|
||||
// These control whether the "Math Renderer", "Font Preferences",
|
||||
// and "Contextual Menu" submenus will be displayed or not.
|
||||
//
|
||||
showRenderer: true,
|
||||
showFontMenu: false,
|
||||
showContext: false,
|
||||
|
||||
//
|
||||
// These are the settings for the Show Source window. The initial
|
||||
// width and height will be reset after the source is shown in an
|
||||
// attempt to make the window fit the output better.
|
||||
//
|
||||
windowSettings: {
|
||||
status: "no", toolbar: "no", locationbar: "no", menubar: "no",
|
||||
directories: "no", personalbar: "no", resizable: "yes", scrollbars: "yes",
|
||||
width: 100, height: 50
|
||||
},
|
||||
|
||||
//
|
||||
// This allows you to change the CSS that controls the menu
|
||||
// appearance. See the extensions/MathMenu.js file for details
|
||||
// of the default settings.
|
||||
//
|
||||
styles: {}
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the MMLorHTML configuration file.
|
||||
// NOTE: if you add MMLorHTML.js to the config array above,
|
||||
// you must REMOVE the output jax from the jax array.
|
||||
//
|
||||
MMLorHTML: {
|
||||
//
|
||||
// The output jax that is to be preferred when both are possible
|
||||
// (set to "MML" for native MathML, "HTML" for MathJax's HTML-CSS output jax).
|
||||
//
|
||||
prefer: {
|
||||
MSIE: "MML",
|
||||
Firefox: "MML",
|
||||
Opera: "HTML",
|
||||
other: "HTML"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MathJax.Ajax.loadComplete("[MathJax]/config/default.js");
|
|
@ -0,0 +1,24 @@
|
|||
MathJax.Hub.Config({
|
||||
config: ["MMLorHTML.js"],
|
||||
jax: ["input/MathML"],
|
||||
extensions: ["mml2jax.js","MathMenu.js","MathZoom.js"],
|
||||
MathML: {
|
||||
useMathMLspacing: true
|
||||
},
|
||||
"HTML-CSS": {
|
||||
preferredFont: "STIX",
|
||||
scale: 90
|
||||
},
|
||||
MMLorHTML: {
|
||||
prefer:
|
||||
{
|
||||
MSIE: "MML",
|
||||
Firefox: "MML",
|
||||
Opera: "HTML",
|
||||
other: "HTML"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MathJax.Hub.Startup.onload();
|
||||
MathJax.Ajax.loadComplete("[MathJax]/config/local/local.js");
|
|
@ -0,0 +1,37 @@
|
|||
/*************************************************************
|
||||
*
|
||||
* MathJax/config/local/local.js
|
||||
*
|
||||
* Include changes and configuration local to your installation
|
||||
* in this file. For example, common macros can be defined here
|
||||
* (see below). To use this file, add "local/local.js" to the
|
||||
* config array in MathJax.js or your MathJax.Hub.Config() call.
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2009 Design Science, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var TEX = MathJax.InputJax.TeX;
|
||||
|
||||
// place macros here. E.g.:
|
||||
// TEX.Macro("R","{\\bf R}");
|
||||
// TEX.Macro("op","\\mathop{\\rm #1}",1); // a macro with 1 parameter
|
||||
|
||||
});
|
||||
|
||||
MathJax.Ajax.loadComplete("[MathJax]/config/local/local.js");
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/FontWarnings.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
(function(d,g){var f="1.1";var b=d.CombineConfig("FontWarnings",{messageStyle:{position:"fixed",bottom:"4em",left:"3em",width:"40em",border:"3px solid #880000","background-color":"#E0E0E0",padding:"1em","font-size":"small","white-space":"normal","border-radius":".75em","-webkit-border-radius":".75em","-moz-border-radius":".75em","-khtml-border-radius":".75em","box-shadow":"4px 4px 10px #AAAAAA","-webkit-box-shadow":"4px 4px 10px #AAAAAA","-moz-box-shadow":"4px 4px 10px #AAAAAA","-khtml-box-shadow":"4px 4px 10px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=3, OffY=3, Color='gray', Positive='true')"},Message:{webFont:[["closeBox"],"MathJax is using web-based fonts to display the mathematics ","on this page. These take time to download, so the page would","render faster if you installed math fonts directly in your ","system's font folder.",["fonts"]],imageFonts:[["closeBox"],"MathJax is using its image fonts rather than local or web-based fonts. ","This will render slower than usual, and the mathematics may not print ","at the full resolution of your printer.",["fonts"],["webfonts"]],noFonts:[["closeBox"],"MathJax is unable to locate a font to use to display ","its mathematics, and image fonts are not available, so it ","is falling back on generic unicode characters in hopes that ","your browser will be able to display them. Some characters ","may not show up properly, or possibly not at all.",["fonts"],["webfonts"]]},HTML:{closeBox:[["div",{style:{position:"absolute",overflow:"hidden",top:".1em",right:".1em",border:"1px outset",width:"1em",height:"1em","text-align":"center",cursor:"pointer","background-color":"#EEEEEE",color:"#606060","border-radius":".5em","-webkit-border-radius":".5em","-moz-border-radius":".5em","-khtml-border-radius":".5em"},onclick:function(){if(c.div&&c.fade===0){if(c.timer){clearTimeout(c.timer)}c.div.style.display="none"}}},[["span",{style:{position:"relative",bottom:".2em"}},["x"]]]]],webfonts:[["p"],"Most modern browsers allow for fonts to be downloaded over the web. ","Updating to a more recent version of your browser (or changing browsers) ","could improve the quality of the mathematics on this page."],fonts:[["p"],"MathJax can use either the ",["a",{href:"http://www.stixfonts.org/",target:"_blank"},"STIX fonts"]," or the ",["a",{href:"http://www.mathjax.org/help/fonts/",target:"_blank"},["MathJax TeX fonts"]],". Download and install either one to improve your MathJax experience."],STIXfonts:[["p"],"This page is designed to use the ",["a",{href:"http://www.stixfonts.org/",target:"_blank"},"STIX fonts"],". Download and install those fonts to improve your MathJax experience."],TeXfonts:[["p"],"This page is designed to use the ",["a",{href:"http://www.mathjax.org/help/fonts/",target:"_blank"},["MathJax TeX fonts"]],". Download and install those fonts to improve your MathJax experience."]},removeAfter:12*1000,fadeoutSteps:10,fadeoutTime:1.5*1000});if(MathJax.Hub.Browser.isIE9&&document.documentMode>=9){delete b.messageStyle.filter}var c={div:null,fade:0};var a=function(k){if(c.div){return}var h=MathJax.OutputJax["HTML-CSS"],l=document.body;if(d.Browser.isMSIE){if(b.messageStyle.position==="fixed"){MathJax.Message.Init();l=document.getElementById("MathJax_MSIE_Frame");b.messageStyle.position="absolute"}}else{delete b.messageStyle.filter}b.messageStyle.maxWidth=(document.body.clientWidth-75)+"px";var j=0;while(j<k.length){if(k[j] instanceof Array&&b.HTML[k[j][0]]){k.splice.apply(k,[j,1].concat(b.HTML[k[j][0]]))}else{j++}}c.div=h.addElement(l,"div",{id:"MathJax_FontWarning",style:b.messageStyle},k);if(b.removeAfter){d.Register.StartupHook("End",function(){c.timer=setTimeout(e,b.removeAfter)})}g.Cookie.Set("fontWarn",{warned:true})};var e=function(){c.fade++;if(c.timer){delete c.timer}if(c.fade<b.fadeoutSteps){var h=1-c.fade/b.fadeoutSteps;c.div.style.opacity=h;c.div.style.filter="alpha(opacity="+Math.floor(100*h)+")";setTimeout(e,b.fadeoutTime/b.fadeoutSteps)}else{c.div.style.display="none"}};if(!g.Cookie.Get("fontWarn").warned){d.Startup.signal.Interest(function(k){if(k.match(/HTML-CSS Jax - /)&&!c.div){var h=MathJax.OutputJax["HTML-CSS"],l=h.config.availableFonts,j;var i=(l&&l.length);if(!i){b.HTML.fonts=[""]}else{if(l.length===1){b.HTML.fonts=b.HTML[l[0]+"fonts"]}}if(h.allowWebFonts){b.HTML.webfonts=[""]}if(k.match(/- Web-Font/)){if(i){j="webFont"}}else{if(k.match(/- using image fonts/)){j="imageFonts"}else{if(k.match(/- no valid font/)){j="noFonts"}}}if(j&&b.Message[j]){a(b.Message[j])}}})}})(MathJax.Hub,MathJax.HTML);MathJax.Ajax.loadComplete("[MathJax]/extensions/FontWarnings.js");
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/HTML.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b="1.1";var c=MathJax.InputJax.TeX;var a=c.Definitions;a.macros.href="HREF_attribute";a.macros["class"]="CLASS_attribute";a.macros.style="STYLE_attribute";a.macros.cssId="ID_attribute";c.Parse.Augment({HREF_attribute:function(f){var e=this.GetArgument(f),d=this.GetArgumentMML(f);this.Push(d.With({href:e}))},CLASS_attribute:function(e){var f=this.GetArgument(e),d=this.GetArgumentMML(e);if(d["class"]!=null){f=d["class"]+" "+f}this.Push(d.With({"class":f}))},STYLE_attribute:function(e){var f=this.GetArgument(e),d=this.GetArgumentMML(e);if(d.style!=null){if(f.charAt(f.length-1)!==";"){f+=";"}f=d.style+" "+f}this.Push(d.With({style:f}))},ID_attribute:function(f){var e=this.GetArgument(f),d=this.GetArgumentMML(f);this.Push(d.With({id:e}))},GetArgumentMML:function(e){var d=this.ParseArg(e);if(d.inferred&&d.data.length==1){d=d.data[0]}else{delete d.inferred}return d}});MathJax.Hub.Startup.signal.Post("TeX HTML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/HTML.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/autobold.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b="1.1";var c=MathJax.InputJax.TeX;var a=c.prefilterMath;c.prefilterMath=function(g,h,e){var f=e.parentNode.insertBefore(document.createElement("span"),e);f.visibility="hidden";f.style.fontFamily="Times, serif";f.appendChild(document.createTextNode("ABCXYZabcxyz"));var d=f.offsetWidth;f.style.fontWeight="bold";if(f.offsetWidth==d){g="\\bf {"+g+"}"}f.parentNode.removeChild(f);return a.call(c,g,h,e)};MathJax.Hub.Startup.signal.Post("TeX autobold Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/autobold.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/boldsymbol.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c="1.1";var a=MathJax.ElementJax.mml;var e=MathJax.InputJax.TeX;var b=e.Definitions;var d={};d[a.VARIANT.NORMAL]=a.VARIANT.BOLD;d[a.VARIANT.ITALIC]=a.VARIANT.BOLDITALIC;d[a.VARIANT.FRAKTUR]=a.VARIANT.BOLDFRAKTUR;d[a.VARIANT.SCRIPT]=a.VARIANT.BOLDSCRIPT;d[a.VARIANT.SANSSERIF]=a.VARIANT.BOLDSANSSERIF;d["-tex-caligraphic"]="-tex-caligraphic-bold";d["-tex-oldstyle"]="-tex-oldstyle-bold";b.macros.boldsymbol="Boldsymbol";e.Parse.Augment({mmlToken:function(g){if(this.stack.env.boldsymbol){var f=g.Get("mathvariant");if(f==null){g.mathvariant=a.VARIANT.BOLD}else{g.mathvariant=(d[f]||f)}}return g},Boldsymbol:function(i){var f=this.stack.env.boldsymbol,g=this.stack.env.font;this.stack.env.boldsymbol=true;this.stack.env.font=null;var h=this.ParseArg(i);this.stack.env.font=g;this.stack.env.boldsymbol=f;this.Push(h)}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.OutputJax["HTML-CSS"];var c=a.FONTDATA.FONTS;var b=a.FONTDATA.VARIANT;if(a.fontInUse==="TeX"){c["MathJax_Caligraphic-bold"]="Caligraphic/Bold/Main.js";b["-tex-caligraphic-bold"]={fonts:["MathJax_Caligraphic-bold","MathJax_Main-bold","MathJax_Main","MathJax_Math","MathJax_Size1"],offsetA:65,variantA:"bold-italic"};b["-tex-oldstyle-bold"]={fonts:["MathJax_Caligraphic-bold","MathJax_Main-bold","MathJax_Main","MathJax_Math","MathJax_Size1"]};if(a.msieCheckGreek&&a.Font.testFont({family:"MathJax_Greek",weight:"bold",style:"italic",testString:a.msieCheckGreek})){b["bold-italic"].offsetG=913;b["bold-italic"].variantG="-Greek-Bold-Italic";b["-Greek-Bold-Italic"]={fonts:["MathJax_Greek-bold-italic"]};c["MathJax_Greek-bold-italic"]="Greek/BoldItalic/Main.js"}if(MathJax.Hub.Browser.isChrome&&!MathJax.Hub.Browser.versionAtLeast("5.0")){b["-tex-caligraphic-bold"].remap={84:[58096,"-WinChrome"]}}}else{if(a.fontInUse==="STIX"){b["-tex-caligraphic-bold"]={fonts:["STIXGeneral-bold-italic","STIXNonUnicode-bold-italic","STIXNonUnicode","STIXGeneral","STIXSizeOneSym"],offsetA:57927,noLowerCase:1};b["-tex-oldstyle-bold"]={fonts:["STIXGeneral-bold","STIXNonUnicode-bold","STIXGeneral","STIXSizeOneSym"],offsetN:57955,remap:{57956:57959,57957:57963,57958:57967,57959:57971,57960:57975,57961:57979,57962:57983,57963:57987,57964:57991}}}}MathJax.Hub.Startup.signal.Post("TeX boldsymbol Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/boldsymbol.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/mathchoice.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c="1.1";var a=MathJax.ElementJax.mml;var d=MathJax.InputJax.TeX;var b=d.Definitions;b.macros.mathchoice="MathChoice";d.Parse.Augment({MathChoice:function(f){var i=this.ParseArg(f),e=this.ParseArg(f),g=this.ParseArg(f),h=this.ParseArg(f);this.Push(a.TeXmathchoice(i,e,g,h))}});a.TeXmathchoice=a.mbase.Subclass({type:"TeXmathchoice",choice:function(){var e=this.getValues("displaystyle","scriptlevel");if(e.scriptlevel>0){return Math.min(3,e.scriptlevel+1)}return(e.displaystyle?0:1)},setTeXclass:function(e){return this.Core().setTeXclass(e)},isSpacelike:function(){return this.Core().isSpacelike()},isEmbellished:function(){return this.Core().isEmbellished()},Core:function(){return this.data[this.choice()]},toHTML:function(e){e=this.HTMLcreateSpan(e);e.bbox=this.Core().toHTML(e).bbox;return e}});MathJax.Hub.Startup.signal.Post("TeX mathchoice Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mathchoice.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/newcommand.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b="1.1";var c=MathJax.InputJax.TeX;var a=c.Definitions;MathJax.Hub.Insert(a,{macros:{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",def:"MacroDef"}});c.Parse.Augment({NewCommand:function(d){var e=this.trimSpaces(this.GetArgument(d)),g=this.trimSpaces(this.GetBrackets(d)),f=this.GetArgument(d);if(g===""){g=null}if(e.charAt(0)==="\\"){e=e.substr(1)}if(!e.match(/^(.|[a-z]+)$/i)){c.Error("Illegal control sequence name for "+d)}if(g!=null&&!g.match(/^[0-9]+$/)){c.Error("Illegal number of parameters specified in "+d)}a.macros[e]=["Macro",f,g]},NewEnvironment:function(e){var f=this.trimSpaces(this.GetArgument(e)),h=this.trimSpaces(this.GetBrackets(e)),g=this.GetArgument(e),d=this.GetArgument(e);if(h===""){h=null}if(h!=null&&!h.match(/^[0-9]+$/)){c.Error("Illegal number of parameters specified in "+e)}a.environment[f]=["BeginEnv","EndEnv",g,d,h]},MacroDef:function(d){var e=this.GetCSname(d),g=this.GetTemplate(d,"\\"+e),f=this.GetArgument(d);if(!(g instanceof Array)){a.macros[e]=["Macro",f,g]}else{a.macros[e]=["MacroWithTemplate",f,g[0],g[1]]}},GetCSname:function(e){var f=this.GetNext();if(f!=="\\"){c.Error("\\ must be followed by a control sequence")}var d=this.trimSpaces(this.GetArgument(e));return d.substr(1)},GetTemplate:function(f,e){var j,g=[],h=0;j=this.GetNext();var d=this.i;while(this.i<this.string.length){j=this.GetNext();if(j==="#"){if(d!==this.i){g[h]=this.string.substr(d,this.i-d)}j=this.string.charAt(++this.i);if(!j.match(/^[1-9]$/)){c.Error("Illegal use of # in template for "+e)}if(parseInt(j)!=++h){c.Error("Parameters for "+e+" must be numbered sequentially")}d=this.i+1}else{if(j==="{"){if(d!==this.i){g[h]=this.string.substr(d,this.i-d)}if(g.length>0){return[h,g]}else{return h}}}this.i++}c.Error("Missing replacement string for definition of "+f)},MacroWithTemplate:function(e,h,j,g){if(j){var d=[];this.GetNext();if(g[0]&&!this.MatchParam(g[0])){c.Error("Use of "+e+" doesn't match its definition")}for(var f=0;f<j;f++){d.push(this.GetParameter(e,g[f+1]))}h=this.SubstituteArgs(d,h)}this.string=this.AddArgs(h,this.string.slice(this.i));this.i=0;if(++this.macroCount>c.config.MAXMACROS){c.Error("MathJax maximum macro substitution count exceeded; is there a recursive macro call?")}},BeginEnv:function(g,j,d,h){if(h){var e=[];for(var f=0;f<h;f++){e.push(this.GetArgument("\\begin{"+name+"}"))}j=this.SubstituteArgs(e,j);d=this.SubstituteArgs(e,d)}g.edef=d;this.string=this.AddArgs(j,this.string.slice(this.i));this.i=0;return g},EndEnv:function(d,e){this.string=this.AddArgs(d.edef,this.string.slice(this.i));this.i=0;return e},GetParameter:function(e,h){if(h==null){return this.GetArgument(e)}var g=this.i,d=0,f=0;while(this.i<this.string.length){if(this.string.charAt(this.i)==="{"){if(this.i===g){f=1}this.GetArgument(e);d=this.i-g}else{if(this.MatchParam(h)){if(f){g++;d-=2}return this.string.substr(g,d)}else{this.i++;d++;f=0}}}c.Error("Runaway argument for "+e+"?")},MatchParam:function(d){if(this.string.substr(this.i,d.length)!==d){return 0}this.i+=d.length;return 1}});c.Environment=function(d){a.environment[d]=["BeginEnv","EndEnv"].concat([].slice.call(arguments,1))};MathJax.Hub.Startup.signal.Post("TeX newcommand Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/newcommand.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/noErrors.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
(function(){var c="1.1";var a=MathJax.Hub.CombineConfig("TeX.noErrors",{multiLine:true,inlineDelimiters:["",""],style:{"font-family":"serif","font-size":"80%","text-align":"left",color:"black",padding:"1px 3px",border:"1px solid"}});var b="\u00A0";MathJax.Extension["TeX/noErrors"]={version:c,config:a};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){MathJax.InputJax.TeX.Augment({formatError:function(f,e,g,d){var i=a.inlineDelimiters;var h=(g||a.multiLine);if(!g){e=i[0]+e+i[1]}if(h){e=e.replace(/ /g,b)}else{e=e.replace(/\n/g," ")}return MathJax.ElementJax.mml.merror(e).With({isError:true,multiLine:h})}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Config",function(){MathJax.Hub.Config({"HTML-CSS":{styles:{".MathJax .merror":MathJax.Hub.Insert({"font-style":null,"background-color":null,"vertical-align":(MathJax.Hub.Browser.isMSIE&&a.multiLine?"-2px":"")},a.style)}}})})})();MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.ElementJax.mml;var b=MathJax.OutputJax["HTML-CSS"];var c=a.math.prototype.toHTML;a.math.Augment({toHTML:function(d,e){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].toHTML(d)}return c.call(this,d,e)}});a.merror.Augment({toHTML:function(j){if(!this.isError){return a.mbase.prototype.toHTML.call(this,j)}j=this.HTMLcreateSpan(j);if(this.multiLine){j.style.display="inline-block"}var l=this.data[0].data[0].data.join("").split(/\n/);for(var g=0,e=l.length;g<e;g++){b.addText(j,l[g]);if(g!==e-1){b.addElement(j,"br")}}var n=b.getHD(j.parentNode),d=b.getW(j.parentNode);if(e>1){var k=(n.h+n.d)/2,h=b.TeX.x_height/2;var f=b.config.styles[".MathJax .merror"]["font-size"];if(f&&f.match(/%/)){h*=parseInt(f)/100}j.parentNode.style.verticalAlign=b.Em(n.d+(h-k));n.h=h+k;n.d=k-h}j.bbox={h:n.h,d:n.d,w:d,lw:0,rw:d};return j}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Hub.Register.StartupHook("NativeMML Jax Ready",function(){var b=MathJax.ElementJax.mml;var a=MathJax.Extension["TeX/noErrors"].config;var c=b.math.prototype.toNativeMML;b.math.Augment({toNativeMML:function(d){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].toNativeMML(d)}return c.call(this,d)}});b.merror.Augment({toNativeMML:function(g){if(!this.isError){return b.mbase.prototype.toNativeMML.call(this,g)}g=g.appendChild(document.createElement("span"));var h=this.data[0].data[0].data.join("").split(/\n/);for(var f=0,e=h.length;f<e;f++){g.appendChild(document.createTextNode(h[f]));if(f!==e-1){g.appendChild(document.createElement("br"))}}if(this.multiLine){g.style.display="inline-block";if(e>1){g.style.verticalAlign="middle"}}for(var j in a.style){if(a.style.hasOwnProperty(j)){var d=j.replace(/-./g,function(i){return i.charAt(1).toUpperCase()});g.style[d]=a.style[j]}}return g}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/noUndefined.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Extension["TeX/noUndefined"]={version:"1.1",config:MathJax.Hub.CombineConfig("TeX.noUndefined",{attributes:{mathcolor:"red"}})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.Extension["TeX/noUndefined"].config;var a=MathJax.ElementJax.mml;MathJax.InputJax.TeX.Parse.Augment({csUndefined:function(c){this.Push(a.mtext(c).With(b.attributes))}});MathJax.Hub.Startup.signal.Post("TeX noUndefined Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noUndefined.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/unicode.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Extension["TeX/unicode"]={version:"1.1",unicode:{},config:MathJax.Hub.CombineConfig("TeX.unicode",{fonts:"STIXGeneral,'Arial Unicode MS'"})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var d=MathJax.InputJax.TeX;var a=MathJax.ElementJax.mml;var c=MathJax.Extension["TeX/unicode"].config.fonts;var b=MathJax.Extension["TeX/unicode"].unicode;d.Definitions.macros.unicode="Unicode";d.Parse.Augment({Unicode:function(f){var j=this.GetBrackets(f),e;if(j){j=j.replace(/ /g,"");if(j.match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)){j=j.split(/,/);e=this.GetBrackets(f)}else{e=j;j=null}}var k=this.trimSpaces(this.GetArgument(f)),i=parseInt(k.match(/^x/)?"0"+k:k);b[i]=[800,200,500,0,500,{isUnknown:true,isUnicode:true,font:c}];if(j){b[i][0]=Math.floor(j[0]*1000);b[i][1]=Math.floor(j[1]*1000)}var g=this.stack.env.font,h={};if(e){h.fontfamily=e;if(g){if(g.match(/bold/)){h.fontweight="bold"}if(g.match(/italic/)){h.fontstyle="italic"}}b[i][5].font=e+","+c}else{if(g){h.mathvariant=g}}this.Push(a.mtext(a.entity("#"+k)).With(h))}})});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.OutputJax["HTML-CSS"];var c=MathJax.Extension["TeX/unicode"].unicode;var b=a.lookupChar;a.Augment({lookupChar:function(e,f){var d=b.call(this,e,f);if(d[f][5]&&d[f][5].isUnknown&&c[f]){d[f]=c[f]}return d}});MathJax.Hub.Startup.signal.Post("TeX unicode Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/unicode.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/TeX/verb.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c="1.1";var a=MathJax.ElementJax.mml;var d=MathJax.InputJax.TeX;var b=d.Definitions;b.macros.verb="Verb";d.Parse.Augment({Verb:function(e){var h=this.GetNext();var g=++this.i;if(h==""){d.Error(e+" requires an argument")}while(this.i<this.string.length&&this.string.charAt(this.i)!=h){this.i++}if(this.i==this.string.length){d.Error("Can't find closing delimiter for "+e)}var f=this.string.slice(g,this.i);this.i++;this.Push(a.mtext(f).With({mathvariant:a.VARIANT.MONOSPACE}))}});MathJax.Hub.Startup.signal.Post("TeX verb Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/verb.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/jsMath2jax.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Extension.jsMath2jax={version:"1.1.1",config:{preview:"TeX"},PreProcess:function(b){if(!this.configured){this.config=MathJax.Hub.CombineConfig("jsMath2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}if(typeof(this.config.previewTeX)!=="undefined"&&!this.config.previewTeX){this.config.preview="none"}this.previewClass=MathJax.Hub.config.preRemoveClass;this.configured=true}if(typeof(b)==="string"){b=document.getElementById(b)}if(!b){b=document.body}var c=b.getElementsByTagName("span"),a;for(a=c.length-1;a>=0;a--){if(String(c[a].className).match(/(^| )math( |$)/)){this.ConvertMath(c[a],"")}}var d=b.getElementsByTagName("div");for(a=d.length-1;a>=0;a--){if(String(d[a].className).match(/(^| )math( |$)/)){this.ConvertMath(d[a],"; mode=display")}}},ConvertMath:function(c,d){if(c.getElementsByTagName("script").length===0){var b=c.parentNode,a=this.createMathTag(d,c.innerHTML);if(c.nextSibling){b.insertBefore(a,c.nextSibling)}else{b.appendChild(a)}if(this.config.preview!=="none"){this.createPreview(c)}b.removeChild(c)}},createPreview:function(a){var b;if(this.config.preview==="TeX"){b=[this.filterTeX(a.innerHTML)]}else{if(this.config.preview instanceof Array){b=this.config.preview}}if(b){b=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},b);a.parentNode.insertBefore(b,a)}},createMathTag:function(c,b){b=b.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");var a=document.createElement("script");a.type="math/tex"+c;MathJax.HTML.setScript(a,b);return a},filterTeX:function(a){return a}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.jsMath2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/jsMath2jax.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/mml2jax.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Extension.mml2jax={version:"1.1.2",config:{preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=document.body}this.ProcessMathArray(e.getElementsByTagName("math"));if(e.getElementsByTagNameNS){this.ProcessMathArray(e.getElementsByTagNameNS(this.MMLnamespace,"math"))}var d=document.getElementsByTagName("html")[0];if(d){for(var c=0,b=d.attributes.length;c<b;c++){var a=d.attributes[c];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(a.nodeName.substr(6)+":math"))}}}},ProcessMathArray:function(b){var a;if(b.length){if(this.MathTagBug){for(a=b.length-1;a>=0;a--){if(b[a].nodeName==="MATH"){this.ProcessMathFlattened(b[a])}else{this.ProcessMath(b[a])}}}else{for(a=b.length-1;a>=0;a--){this.ProcessMath(b[a])}}}},ProcessMath:function(e){var d=e.parentNode;var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.AttributeBug){var b=this.OuterHTML(e);if(this.CleanupHTML){b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");b=b.replace(/ /g," ")}MathJax.HTML.setScript(a,b);d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},ProcessMathFlattened:function(f){var d=f.parentNode;var b=document.createElement("script");b.type="math/mml";d.insertBefore(b,f);var c="",e,a=f;while(f&&f.nodeName!=="/MATH"){e=f;f=f.nextSibling;c+=this.NodeHTML(e);e.parentNode.removeChild(e)}if(f&&f.nodeName==="/MATH"){f.parentNode.removeChild(f)}b.text=c+"</math>";if(this.config.preview!=="none"){this.createPreview(a,b)}},NodeHTML:function(e){var c,b,a;if(e.nodeName==="#text"){c=this.quoteHTML(e.nodeValue)}else{if(e.nodeName==="#comment"){c="<!--"+e.nodeValue+"-->"}else{c="<"+e.nodeName.toLowerCase();for(b=0,a=e.attributes.length;b<a;b++){var d=e.attributes[b];if(d.specified){c+=" "+d.nodeName.toLowerCase().replace(/xmlns:xmlns/,"xmlns")+"=";var f=d.nodeValue;if(f==null&&d.nodeName==="style"&&e.style){f=e.style.cssText}c+='"'+this.quoteHTML(f)+'"'}}c+=">";if(e.outerHTML!=null&&e.outerHTML.match(/(.<\/[A-Z]+>|\/>)$/)){for(b=0,a=e.childNodes.length;b<a;b++){c+=this.OuterHTML(e.childNodes[b])}c+="</"+e.nodeName.toLowerCase()+">"}}}return c},OuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.NodeHTML(d)}if(!this.AttributeBug){return d.outerHTML}var c=this.NodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.OuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},quoteHTML:function(a){if(a==null){a=""}return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},createPreview:function(b,a){var c;if(this.config.preview==="alttext"){var d=b.getAttribute("alttext");if(d!=null){c=[this.filterText(d)]}}else{if(this.config.preview instanceof Array){c=this.config.preview}}if(c){c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c);a.parentNode.insertBefore(c,a)}},filterText:function(a){return a},InitBrowser:function(){var b=MathJax.HTML.Element("span",{id:"<",className:"mathjax",innerHTML:"<math><mi>x</mi><mspace /></math>"});var a=b.outerHTML||"";this.AttributeBug=a!==""&&!(a.match(/id="<"/)&&a.match(/class="mathjax"/)&&a.match(/<\/math>/));this.MathTagBug=b.childNodes.length>1;this.CleanupHTML=MathJax.Hub.Browser.isMSIE}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js");
|
||||
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/toMathML.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function(){var b="1.1.1";var a=MathJax.ElementJax.mml;a.mbase.Augment({toMathML:function(k){var g=(this.inferred&&this.parent.inferRow);if(k==null){k=""}var e=this.type,d=this.MathMLattributes();if(e==="mspace"){return k+"<"+e+d+" />"}var j=[];var h=(this.isToken?"":k+(g?"":" "));for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){j.push(this.data[f].toMathML(h))}else{if(!this.isToken){j.push(h+"<mrow />")}}}if(this.isToken){return k+"<"+e+d+">"+j.join("")+"</"+e+">"}if(g){return j.join("\n")}if(j.length===0||(j.length===1&&j[0]==="")){return k+"<"+e+d+" />"}return k+"<"+e+d+">\n"+j.join("\n")+"\n"+k+"</"+e+">"},MathMLattributes:function(){var j=[],g=this.defaults;var c=this.copyAttributes,l=this.skipAttributes;if(this.type==="math"){j.push('xmlns="http://www.w3.org/1998/Math/MathML"')}if(this.type==="mstyle"){g=a.math.prototype.defaults}for(var d in g){if(!l[d]&&g.hasOwnProperty(d)){var e=(d==="open"||d==="close");if(this[d]!=null&&(e||this[d]!==g[d])){var k=this[d];delete this[d];if(e||this.Get(d)!==k){j.push(d+'="'+this.quoteHTML(k)+'"')}this[d]=k}}}for(var h=0,f=c.length;h<f;h++){if(this[c[h]]!=null){j.push(c[h]+'="'+this.quoteHTML(this[c[h]])+'"')}}if(j.length){return" "+j.join(" ")}else{return""}},copyAttributes:["fontfamily","fontsize","fontweight","fontstyle","color","background","id","class","href","style"],skipAttributes:{texClass:1,useHeight:1,texprimestyle:1},quoteHTML:function(e){e=String(e).split("");for(var f=0,d=e.length;f<d;f++){var h=e[f].charCodeAt(0);if(h<32||h>126){e[f]="&#x"+h.toString(16).toUpperCase()+";"}else{var g={"&":"&","<":"<",">":">",'"':"""}[e[f]];if(g){e[f]=g}}}return e.join("")}});a.msubsup.Augment({toMathML:function(h){var e=this.type;if(this.data[this.sup]==null){e="msub"}if(this.data[this.sub]==null){e="msup"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.munderover.Augment({toMathML:function(h){var e=this.type;if(this.data[this.under]==null){e="mover"}if(this.data[this.over]==null){e="munder"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.TeXAtom.Augment({toMathML:function(c){return c+"<mrow>\n"+this.data[0].toMathML(c+" ")+"\n"+c+"</mrow>"}});a.chars.Augment({toMathML:function(c){return(c||"")+this.quoteHTML(this.toString())}});a.entity.Augment({toMathML:function(c){return(c||"")+"&"+this.data[0]+";<!-- "+this.toString()+" -->"}});a.xml.Augment({toMathML:function(c){return(c||"")+this.toString()}});MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function(){a.TeXmathchoice.Augment({toMathML:function(c){return this.Core().toMathML(c)}})});MathJax.Hub.Startup.signal.Post("toMathML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js");
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/extensions/v1.0-warning.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
(function(b,e){var d="1.1";var a={style:{position:"fixed",bottom:"4em",left:"3em",width:"40em",border:"3px solid #880000","background-color":"#E0E0E0",padding:"1em","font-size":"small","white-space":"normal","border-radius":".75em","-webkit-border-radius":".75em","-moz-border-radius":".75em","-khtml-border-radius":".75em","box-shadow":"4px 4px 10px #AAAAAA","-webkit-box-shadow":"4px 4px 10px #AAAAAA","-moz-box-shadow":"4px 4px 10px #AAAAAA","-khtml-box-shadow":"4px 4px 10px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=3, OffY=3, Color='gray', Positive='true')"}};if(b.Browser.isIE9&&document.documentMode>=9){delete a.style.filter}var c;b.Register.StartupHook("onLoad",function(){var f=document.body;if(b.Browser.isMSIE){MathJax.Message.Init();f=document.getElementById("MathJax_MSIE_frame")||f;a.style.position="absolute"}else{delete a.style.filter}a.style.maxWidth=(document.body.clientWidth-75)+"px";c=e.addElement(f,"div",{id:"MathJax_ConfigWarning",style:a.style},[["div",{style:{position:"absolute",overflow:"hidden",top:".1em",right:".1em",border:"1px outset",width:"1em",height:"1em","text-align":"center",cursor:"pointer","background-color":"#EEEEEE",color:"#606060","border-radius":".5em","-webkit-border-radius":".5em","-moz-border-radius":".5em","-khtml-border-radius":".5em"},onclick:function(){c.style.display="none"}},[["span",{style:{position:"relative",bottom:".2em"}},["x"]]]],"MathJax no longer loads a default configuration file; you must specify such files explicitly. This page seems to use the older default ",["code",{},["config/MathJax.js"]]," file, and so needs to be updated. This is explained further at",["p",{style:{"text-align":"center"}},[["a",{href:"http://www.mathjax.org/help/configuration"},["http://www.mathjax.org/help/configuration"]]]]])})})(MathJax.Hub,MathJax.HTML);MathJax.Ajax.loadComplete("[MathJax]/extensions/v1.0-warning.js");
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* imagedata.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
(function (HTMLCSS) {
|
||||
|
||||
//
|
||||
// Since this is the new font data, reset the
|
||||
// flag and the imgPacked values
|
||||
//
|
||||
HTMLCSS.config.useOldImageData = false;
|
||||
HTMLCSS.imgPacked = (MathJax.isPacked ? "" : "/unpacked");
|
||||
|
||||
//
|
||||
// Load the actual image data file
|
||||
// before loadComplete is called
|
||||
//
|
||||
MathJax.Callback.Queue(
|
||||
["Require",MathJax.Ajax,HTMLCSS.imgDir+HTMLCSS.imgPacked+"/imagedata.js"],
|
||||
["loadComplete",MathJax.Ajax,HTMLCSS.webfontDir+"/imagedata.js"]
|
||||
);
|
||||
|
||||
})(MathJax.OutputJax["HTML-CSS"]);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue