Created
September 1, 2010 12:52
-
-
Save foxweb/560633 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if defined?(Object::RedCloth) and (!RedCloth.instance_methods.include?(:stock_pgl)) | |
# RuTils выполняет перегрузку Textile Glyphs в RedCloth, перенося форматирование спецсимволов на Gilenson. | |
class Object::RedCloth < String #:nodoc: | |
# Этот метод в RedCloth при наличии Гиленсона надо отключать | |
alias_method :stock_htmlesc, :htmlesc | |
def htmlesc(text, mode=0) #:nodoc: | |
RuTils::overrides_enabled? ? text : stock_htmlesc(text, mode) | |
end | |
# А этот метод обрабатывает Textile Glyphs - ту самую типографицу. | |
# Вместо того чтобы влезать в таблицы мы просто заменим Textile Glyphs - и все будут рады. | |
alias_method :stock_pgl, :pgl | |
def pgl(text) #:nodoc: | |
RuTils::overrides_enabled? ? text.replace(RuTils::Gilenson::Formatter.new(text).to_html) : stock_pgl(text) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment