Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
a14db81b79
|
@ -1,7 +1,7 @@
|
||||||
# Controller responsible for serving files and pictures.
|
# Controller responsible for serving files and pictures.
|
||||||
|
|
||||||
require 'zip/zip'
|
require 'zip/zip'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
class FileController < ApplicationController
|
class FileController < ApplicationController
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'fileutils'
|
||||||
require 'maruku'
|
require 'maruku'
|
||||||
require 'maruku/ext/math'
|
require 'maruku/ext/math'
|
||||||
require 'zip/zip'
|
require 'zip/zip'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
require 'resolv'
|
require 'resolv'
|
||||||
|
|
||||||
class WikiController < ApplicationController
|
class WikiController < ApplicationController
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# The methods added to this helper will be available to all templates in the application.
|
# The methods added to this helper will be available to all templates in the application.
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
# Accepts a container (hash, array, enumerable, your type) and returns a string of option tags. Given a container
|
# Accepts a container (hash, array, enumerable, your type) and returns a string of option tags. Given a container
|
||||||
# where the elements respond to first and last (such as a two-element array), the "lasts" serve as option values and
|
# where the elements respond to first and last (such as a two-element array), the "lasts" serve as option values and
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Allow the metal piece to run in isolation
|
# Allow the metal piece to run in isolation
|
||||||
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
|
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
|
||||||
|
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
class Itex
|
class Itex
|
||||||
def self.call(env)
|
def self.call(env)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'chunks/chunk'
|
require 'chunks/chunk'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
# The category chunk looks for "category: news" on a line by
|
# The category chunk looks for "category: news" on a line by
|
||||||
# itself and parses the terms after the ':' as categories.
|
# itself and parses the terms after the ':' as categories.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
$: << File.dirname(__FILE__) + "../../lib"
|
$: << File.dirname(__FILE__) + "../../lib"
|
||||||
|
|
||||||
require_dependency 'chunks/chunk'
|
require_dependency 'chunks/chunk'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
require 'maruku'
|
require 'maruku'
|
||||||
require 'maruku/ext/math'
|
require 'maruku/ext/math'
|
||||||
require_dependency 'rdocsupport'
|
require_dependency 'rdocsupport'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'chunks/chunk'
|
require 'chunks/chunk'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
# Contains all the methods for finding and replacing wiki related links.
|
# Contains all the methods for finding and replacing wiki related links.
|
||||||
module WikiChunk
|
module WikiChunk
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Sanitizer
|
||||||
|
|
||||||
require 'action_controller/vendor/html-scanner/html/tokenizer'
|
require 'action_controller/vendor/html-scanner/html/tokenizer'
|
||||||
require 'node'
|
require 'node'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
require 'set'
|
require 'set'
|
||||||
|
|
||||||
acceptable_elements = Set.new %w[a abbr acronym address area article aside
|
acceptable_elements = Set.new %w[a abbr acronym address area article aside
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
class AbstractUrlGenerator
|
class AbstractUrlGenerator
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ require_dependency 'chunks/wiki'
|
||||||
require_dependency 'chunks/literal'
|
require_dependency 'chunks/literal'
|
||||||
require 'chunks/nowiki'
|
require 'chunks/nowiki'
|
||||||
require 'sanitizer'
|
require 'sanitizer'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
|
|
||||||
# Wiki content is just a string that can process itself with a chain of
|
# Wiki content is just a string that can process itself with a chain of
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#coding: utf-8
|
#coding: utf-8
|
||||||
# Contains all the methods for finding and replacing wiki words
|
# Contains all the methods for finding and replacing wiki words
|
||||||
|
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
module WikiWords
|
module WikiWords
|
||||||
# In order of appearance: Latin, greek, cyrillic, armenian
|
# In order of appearance: Latin, greek, cyrillic, armenian
|
||||||
|
|
|
@ -10,7 +10,7 @@ require 'wiki_controller'
|
||||||
require 'rexml/document'
|
require 'rexml/document'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
require 'zip/zipfilesystem'
|
require 'zip/zipfilesystem'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
# Raise errors beyond the default web-based presentation
|
# Raise errors beyond the default web-based presentation
|
||||||
class WikiController; def rescue_action(e) logger.error(e); raise e end; end
|
class WikiController; def rescue_action(e) logger.error(e); raise e end; end
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), '/../test_helper'))
|
require File.expand_path(File.join(File.dirname(__FILE__), '/../test_helper'))
|
||||||
require 'sanitizer'
|
require 'sanitizer'
|
||||||
require 'json'
|
require 'json'
|
||||||
require 'stringsupport'
|
require 'instiki_stringsupport'
|
||||||
|
|
||||||
class SanitizerTest < Test::Unit::TestCase
|
class SanitizerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,18 @@ module MaRuKu
|
||||||
module HTML
|
module HTML
|
||||||
def convert_to_mathml_itex2mml(kind, tex)
|
def convert_to_mathml_itex2mml(kind, tex)
|
||||||
return if $already_warned_itex2mml
|
return if $already_warned_itex2mml
|
||||||
|
begin
|
||||||
require 'itextomml'
|
require 'itextomml'
|
||||||
require 'stringsupport'
|
rescue LoadError => e
|
||||||
|
maruku_error "Could not load package 'itex2mml'.\nPlease install it." unless $already_warned_itex2mml
|
||||||
|
$already_warned_itex2mml = true
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
require 'itex_stringsupport'
|
||||||
|
rescue LoadError
|
||||||
|
require 'instiki_stringsupport'
|
||||||
|
end
|
||||||
|
|
||||||
parser = Itex2MML::Parser.new
|
parser = Itex2MML::Parser.new
|
||||||
mathml =
|
mathml =
|
||||||
|
@ -17,11 +27,6 @@ module MaRuKu
|
||||||
end
|
end
|
||||||
|
|
||||||
return Document.new(mathml.to_utf8, :respect_whitespace => :all).root
|
return Document.new(mathml.to_utf8, :respect_whitespace => :all).root
|
||||||
rescue LoadError => e
|
|
||||||
# TODO: Properly scope this global
|
|
||||||
maruku_error "Could not load package 'itex2mml'.\nPlease install it." unless $already_warned_itex2mml
|
|
||||||
$already_warned_itex2mml = true
|
|
||||||
nil
|
|
||||||
rescue REXML::ParseException => e
|
rescue REXML::ParseException => e
|
||||||
maruku_error "Invalid MathML TeX: \n#{tex.gsub(/^/, 'tex>')}\n\n #{e.inspect}"
|
maruku_error "Invalid MathML TeX: \n#{tex.gsub(/^/, 'tex>')}\n\n #{e.inspect}"
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -6,6 +6,11 @@ module MaRuKu; module Out; module HTML
|
||||||
# or return an empty array on error
|
# or return an empty array on error
|
||||||
# return []
|
# return []
|
||||||
# or have a string parsed by REXML:
|
# or have a string parsed by REXML:
|
||||||
|
begin
|
||||||
|
require 'itex_stringsupport'
|
||||||
|
rescue LoadError
|
||||||
|
require 'instiki_stringsupport'
|
||||||
|
end
|
||||||
tex = tex.escapeHTML
|
tex = tex.escapeHTML
|
||||||
mathml = "<code>#{tex}</code>"
|
mathml = "<code>#{tex}</code>"
|
||||||
return Document.new(mathml).root
|
return Document.new(mathml).root
|
||||||
|
|
Loading…
Reference in a new issue