Rename stringsupport.rb => instiki_stringsupport.rb

This commit is contained in:
Jacques Distler 2010-06-09 11:47:39 -05:00
parent 3aaf3989c7
commit 90ad482ed2
16 changed files with 30 additions and 20 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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.

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,4 @@
require 'stringsupport' require 'instiki_stringsupport'
class AbstractUrlGenerator class AbstractUrlGenerator

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
require 'itextomml' begin
require 'stringsupport' require 'itextomml'
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

View file

@ -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