Downgrading RedCloth back to 3.0.3 (3.0.4 is said to be buggy)
This commit is contained in:
parent
61776995b6
commit
9ea6e6ae65
|
@ -1,6 +1,5 @@
|
|||
* instiki-ar
|
||||
* instiki-ar:
|
||||
SQL-based backend (ActiveRecord)
|
||||
Upgrade to RedCloth 3.0.4
|
||||
Replaced internal link generator with routing
|
||||
Fixed --daemon option
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ spec = Gem::Specification.new do |s|
|
|||
|
||||
s.has_rdoc = false
|
||||
|
||||
s.add_dependency('RedCloth', '= 3.0.4')
|
||||
s.add_dependency('RedCloth', '= 3.0.3')
|
||||
s.add_dependency('rubyzip', '= 0.5.8')
|
||||
s.add_dependency('rails', '= 0.13.1')
|
||||
s.add_dependency('sqlite3-ruby', '= 1.1.0')
|
||||
|
|
71
rakefile.rb
71
rakefile.rb
|
@ -20,36 +20,12 @@ desc "Generate API documentation, show coding stats"
|
|||
task :doc => [ :appdoc, :stats ]
|
||||
|
||||
|
||||
# Look up tests for recently modified sources.
|
||||
def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
|
||||
FileList[source_pattern].map do |path|
|
||||
if File.mtime(path) > touched_since
|
||||
test = "#{test_path}/#{File.basename(path, '.rb')}_test.rb"
|
||||
test if File.exists?(test)
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
|
||||
desc 'Test recent changes.'
|
||||
Rake::TestTask.new(:recent => [ :clone_structure_to_test ]) do |t|
|
||||
since = TEST_CHANGES_SINCE
|
||||
touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
|
||||
recent_tests('app/models/*.rb', 'test/unit', since) +
|
||||
recent_tests('app/controllers/*.rb', 'test/functional', since)
|
||||
|
||||
t.libs << 'test'
|
||||
t.verbose = true
|
||||
t.test_files = touched.uniq
|
||||
end
|
||||
task :test_recent => [ :clone_structure_to_test ]
|
||||
|
||||
desc "Run the unit tests in test/unit"
|
||||
Rake::TestTask.new("test_units") { |t|
|
||||
t.libs << "test"
|
||||
t.pattern = 'test/unit/**/*_test.rb'
|
||||
t.verbose = true
|
||||
}
|
||||
task :test_units => [ :clone_structure_to_test ]
|
||||
|
||||
desc "Run the functional tests in test/functional"
|
||||
Rake::TestTask.new("test_functional") { |t|
|
||||
|
@ -57,7 +33,6 @@ Rake::TestTask.new("test_functional") { |t|
|
|||
t.pattern = 'test/functional/**/*_test.rb'
|
||||
t.verbose = true
|
||||
}
|
||||
task :test_functional => [ :clone_structure_to_test ]
|
||||
|
||||
desc "Generate documentation for the application"
|
||||
Rake::RDocTask.new("appdoc") { |rdoc|
|
||||
|
@ -118,52 +93,6 @@ task :stats => [ :environment ] do
|
|||
).to_s
|
||||
end
|
||||
|
||||
desc "Recreate the test databases from the development structure"
|
||||
task :clone_structure_to_test => [ :db_structure_dump, :purge_test_database ] do
|
||||
abcs = ActiveRecord::Base.configurations
|
||||
case abcs["test"]["adapter"]
|
||||
when "mysql"
|
||||
ActiveRecord::Base.establish_connection(:test)
|
||||
ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
|
||||
IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table|
|
||||
ActiveRecord::Base.connection.execute(table)
|
||||
end
|
||||
when "postgresql"
|
||||
ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
|
||||
ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
|
||||
ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
|
||||
`psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
|
||||
when "sqlite", "sqlite3"
|
||||
`#{abcs[RAILS_ENV]["adapter"]} #{abcs["test"]["dbfile"]} < db/#{RAILS_ENV}_structure.sql`
|
||||
when "sqlserver"
|
||||
`osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
|
||||
else
|
||||
raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Dump the database structure to a SQL file"
|
||||
task :db_structure_dump => :environment do
|
||||
abcs = ActiveRecord::Base.configurations
|
||||
case abcs[RAILS_ENV]["adapter"]
|
||||
when "mysql"
|
||||
ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
|
||||
File.open("db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
|
||||
when "postgresql"
|
||||
ENV['PGHOST'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["host"]
|
||||
ENV['PGPORT'] = abcs[RAILS_ENV]["port"].to_s if abcs[RAILS_ENV]["port"]
|
||||
ENV['PGPASSWORD'] = abcs[RAILS_ENV]["password"].to_s if abcs[RAILS_ENV]["password"]
|
||||
`pg_dump -U "#{abcs[RAILS_ENV]["username"]}" -s -x -O -f db/#{RAILS_ENV}_structure.sql #{abcs[RAILS_ENV]["database"]}`
|
||||
when "sqlite", "sqlite3"
|
||||
`#{abcs[RAILS_ENV]["adapter"]} #{abcs[RAILS_ENV]["dbfile"]} .schema > db/#{RAILS_ENV}_structure.sql`
|
||||
when "sqlserver"
|
||||
`scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /f db\\#{RAILS_ENV}_structure.sql /q /A /r`
|
||||
`scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /F db\ /q /A /r`
|
||||
else
|
||||
raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Empty the test database"
|
||||
task :purge_test_database => :environment do
|
||||
abcs = ActiveRecord::Base.configurations
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
ENV["RAILS_ENV"] = "test"
|
||||
ENV['RAILS_ENV'] = 'test'
|
||||
|
||||
# Expand the path to environment so that Ruby does not load it multiple times
|
||||
# File.expand_path can be removed if Ruby 1.9 is in use.
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../config/environment')
|
||||
require 'application'
|
||||
|
||||
require 'test/unit'
|
||||
|
|
52
vendor/RedCloth-3.0.3/RedCloth.gemspec
vendored
Normal file
52
vendor/RedCloth-3.0.3/RedCloth.gemspec
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
require 'rubygems'
|
||||
spec = Gem::Specification.new do |s|
|
||||
|
||||
## Basic Information
|
||||
|
||||
s.name = 'RedCloth'
|
||||
s.version = "3.0.3"
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.summary = <<-TXT
|
||||
RedCloth is a module for using Textile and Markdown in Ruby. Textile and Markdown are text formats.
|
||||
A very simple text format. Another stab at making readable text that can be converted to HTML.
|
||||
TXT
|
||||
s.description = <<-TXT
|
||||
No need to use verbose HTML to build your docs, your blogs, your pages. Textile gives you readable text while you're writing and beautiful text for your readers. And if you need to break out into HTML, Textile will allow you to do so.
|
||||
|
||||
Textile also handles some subtleties of formatting which will enhance your document's readability:
|
||||
|
||||
* Single- and double-quotes around words or phrases are converted to curly quotations, much easier on
|
||||
the eye. "Observe!"
|
||||
|
||||
* Double hyphens are replaced with an em-dash. Observe -- very nice!
|
||||
|
||||
* Single hyphens are replaced with en-dashes. Observe - so cute!
|
||||
|
||||
* Triplets of periods become an ellipsis. Observe...
|
||||
|
||||
* The letter 'x' becomes a dimension sign when used alone. Observe: 2 x 2.
|
||||
|
||||
* Conversion of ==(TM)== to (TM), ==(R)== to (R), ==(C)== to (C).
|
||||
|
||||
For more on Textile's language, hop over to "A Textile Reference":http://hobix.com/textile/. For more
|
||||
on Markdown, see "Daring Fireball's page":http://daringfireball.net/projects/markdown/.
|
||||
TXT
|
||||
|
||||
## Include tests, libs, docs
|
||||
|
||||
s.files = ['bin/**/*', 'tests/**/*', 'lib/**/*', 'docs/**/*', 'run-tests.rb'].collect do |dirglob|
|
||||
Dir.glob(dirglob)
|
||||
end.flatten.delete_if {|item| item.include?("CVS")}
|
||||
|
||||
## Load-time details
|
||||
|
||||
s.require_path = 'lib'
|
||||
s.autorequire = 'redcloth'
|
||||
|
||||
## Author and project details
|
||||
|
||||
s.author = "Why the Lucky Stiff"
|
||||
s.email = "why@ruby-lang.org"
|
||||
s.rubyforge_project = "redcloth"
|
||||
s.homepage = "http://www.whytheluckystiff.net/ruby/redcloth/"
|
||||
end
|
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/ruby18
|
||||
#!/usr/local/bin/ruby18
|
||||
require 'redcloth'
|
||||
puts RedCloth.new( ARGF.read ).to_html
|
|
@ -1,15 +1,4 @@
|
|||
--- %YAML:1.0
|
||||
- version: 3.0.4
|
||||
date: 2005-02-18
|
||||
changes:
|
||||
- The caps class doesn't swallow spaces.
|
||||
- Horizontal rules required to be on an empty line.
|
||||
- Hard breaks don't screw with Markdown headers any longer.
|
||||
- Fixed error triggered by complex lists.
|
||||
- Inline markups need to be butted up against enclosing text, no spaces.
|
||||
- Fixed problem with intermingled single and double quotes.
|
||||
- Brought back lite_mode.
|
||||
|
||||
- version: 3.0.3
|
||||
date: 2005-02-06
|
||||
changes:
|
|
@ -4,7 +4,9 @@ p=. !redcloth3-title.png!
|
|||
|
||||
h4. Get RedCloth 3
|
||||
|
||||
p(example1). *Stable version:* "3.0.3":http://rubyforge.org/frs/download.php/2896/RedCloth-3.0.3.tar.gz
|
||||
p(example1). *Stable version:* "2.0.11":http://rubyforge.org/frs/download.php/698/redcloth-2.0.11.tar.gz
|
||||
|
||||
p(example1). *Unstable version:* "3.0.2":http://rubyforge.org/frs/download.php/2852/RedCloth-3.0.2.tar.gz
|
||||
|
||||
Take a complete tour of Textile at "A Textile Reference":http://hobix.com/textile/.
|
||||
|
||||
|
@ -89,7 +91,7 @@ To install RedCloth via RubyGems:
|
|||
gem install RedCloth
|
||||
</pre>
|
||||
|
||||
Or "download RedCloth":http://rubyforge.org/frs/download.php/2896/RedCloth-3.0.3.tar.gz and simply run the install.rb like so:
|
||||
Or "download RedCloth":http://rubyforge.org/frs/download.php/2852/RedCloth-3.0.2.tar.gz and simply run the install.rb like so:
|
||||
|
||||
<pre>
|
||||
ruby install.rb config
|
|
@ -24,9 +24,9 @@
|
|||
if it's found in a @pre@ or @code@ block.
|
||||
- !!example "I am <b>very</b> serious.\n\n<pre>\n I am <b>very</b> serious.\n</pre>"
|
||||
- h4. Line Breaks
|
||||
- Line breaks are ignored.
|
||||
- Line breaks are converted to HTML breaks.
|
||||
- !!example "I spoke.\nAnd none replied."
|
||||
- Line breaks can be converted to HTML breaks by setting @hard_breaks@.
|
||||
- Line breaks can be disabled in RedCloth by turning on @fold_lines@.
|
||||
- h4. Entities
|
||||
- Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye.
|
||||
- !!example '"Observe!"'
|
||||
|
@ -78,9 +78,9 @@
|
|||
- Pluses around a passage indicate its insertion.
|
||||
- !!example "You are a +pleasant+ child."
|
||||
- To superscript a phrase, surround with carets.
|
||||
- !!example "a^2^ + b^2^ = c^2^"
|
||||
- !!example "a ^2^ + b ^2^ = c ^2^"
|
||||
- To subscript, surround with tildes.
|
||||
- !!example "log~2~x"
|
||||
- !!example "log ~2~ x"
|
||||
- h4. HTML-Specific
|
||||
- Lastly, if you find yourself needing to customize the style of a passage, use percent symbols
|
||||
to translate the passage as an HTML span.
|
1032
vendor/RedCloth-3.0.3/install.rb
vendored
Normal file
1032
vendor/RedCloth-3.0.3/install.rb
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -166,7 +166,7 @@
|
|||
|
||||
class RedCloth < String
|
||||
|
||||
VERSION = '3.0.4'
|
||||
VERSION = '3.0.3'
|
||||
DEFAULT_RULES = [:textile, :markdown]
|
||||
|
||||
#
|
||||
|
@ -193,18 +193,6 @@ class RedCloth < String
|
|||
#
|
||||
attr_accessor :hard_breaks
|
||||
|
||||
# Accessor for toggling lite mode.
|
||||
#
|
||||
# In lite mode, block-level rules are ignored. This means
|
||||
# that tables, paragraphs, lists, and such aren't available.
|
||||
# Only the inline markup for bold, italics, entities and so on.
|
||||
#
|
||||
# r = RedCloth.new( "And then? She *fell*!", [:lite_mode] )
|
||||
# r.to_html
|
||||
# #=> "And then? She <strong>fell</strong>!"
|
||||
#
|
||||
attr_accessor :lite_mode
|
||||
|
||||
#
|
||||
# Accessor for toggling span caps.
|
||||
#
|
||||
|
@ -231,7 +219,7 @@ class RedCloth < String
|
|||
# inline_textile_image:: Textile inline images
|
||||
# inline_textile_link:: Textile inline links
|
||||
# inline_textile_span:: Textile inline spans
|
||||
# glyphs_textile:: Textile entities (such as em-dashes and smart quotes)
|
||||
# inline_textile_glyphs:: Textile entities (such as em-dashes and smart quotes)
|
||||
#
|
||||
# == Markdown
|
||||
#
|
||||
|
@ -272,7 +260,7 @@ class RedCloth < String
|
|||
@shelf = []
|
||||
textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists,
|
||||
:block_textile_prefix, :inline_textile_image, :inline_textile_link,
|
||||
:inline_textile_code, :inline_textile_span, :glyphs_textile]
|
||||
:inline_textile_code, :inline_textile_glyphs, :inline_textile_span]
|
||||
markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,
|
||||
:block_markdown_bq, :block_markdown_lists,
|
||||
:inline_markdown_reflink, :inline_markdown_link]
|
||||
|
@ -290,16 +278,14 @@ class RedCloth < String
|
|||
# standard clean up
|
||||
incoming_entities text
|
||||
clean_white_space text
|
||||
no_textile text
|
||||
|
||||
# start processor
|
||||
@pre_list = []
|
||||
rip_offtags text
|
||||
no_textile text
|
||||
hard_break text
|
||||
unless @lite_mode
|
||||
refs text
|
||||
blocks text
|
||||
end
|
||||
hard_break text
|
||||
refs text
|
||||
blocks text
|
||||
inline text
|
||||
smooth_offtags text
|
||||
|
||||
|
@ -347,8 +333,6 @@ class RedCloth < String
|
|||
C = "(?:#{C_CLAS}?#{C_STYL}?#{C_LNGE}?|#{C_STYL}?#{C_LNGE}?#{C_CLAS}?|#{C_LNGE}?#{C_STYL}?#{C_CLAS}?)"
|
||||
# PUNCT = Regexp::quote( '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' )
|
||||
PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' )
|
||||
PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' )
|
||||
PUNCT_Q = Regexp::quote( '*-_+^~%' )
|
||||
HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)'
|
||||
|
||||
# Text markup tags, don't conflict with block tags
|
||||
|
@ -358,6 +342,41 @@ class RedCloth < String
|
|||
'br', 'map', 'q', 'sub', 'sup', 'span', 'bdo'
|
||||
]
|
||||
|
||||
# Elements to handle
|
||||
GLYPHS = [
|
||||
# [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1’\2' ], # single closing
|
||||
[ /([^\s\[{(>])\'/, '\1’' ], # single closing
|
||||
[ /\'(?=\s|s\b|[#{PUNCT}])/, '’' ], # single closing
|
||||
[ /\'/, '‘' ], # single opening
|
||||
# [ /([^\s\[{(])?"(\s|:|$)/, '\1”\2' ], # double closing
|
||||
[ /([^\s\[{(>])"/, '\1”' ], # double closing
|
||||
[ /"(?=\s|[#{PUNCT}])/, '”' ], # double closing
|
||||
[ /"/, '“' ], # double opening
|
||||
[ /\b( )?\.{3}/, '\1…' ], # ellipsis
|
||||
[ /\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/, '<acronym title="\2">\1</acronym>' ], # 3+ uppercase acronym
|
||||
[ /(^|[^"][>\s])([A-Z][A-Z0-9 ]{2,})([^<a-z0-9]|$)/, '\1<span class="caps">\2</span>\3', :no_span_caps ], # 3+ uppercase caps
|
||||
[ /(\.\s)?\s?--\s?/, '\1—' ], # em dash
|
||||
[ /\s->\s/, ' → ' ], # right arrow
|
||||
[ /\s-\s/, ' – ' ], # en dash
|
||||
[ /(\d+) ?x ?(\d+)/, '\1×\2' ], # dimension sign
|
||||
[ /\b ?[(\[]TM[\])]/i, '™' ], # trademark
|
||||
[ /\b ?[(\[]R[\])]/i, '®' ], # registered
|
||||
[ /\b ?[(\[]C[\])]/i, '©' ] # copyright
|
||||
]
|
||||
|
||||
H_ALGN_VALS = {
|
||||
'<' => 'left',
|
||||
'=' => 'center',
|
||||
'>' => 'right',
|
||||
'<>' => 'justify'
|
||||
}
|
||||
|
||||
V_ALGN_VALS = {
|
||||
'^' => 'top',
|
||||
'-' => 'middle',
|
||||
'~' => 'bottom'
|
||||
}
|
||||
|
||||
QTAGS = [
|
||||
['**', 'b'],
|
||||
['*', 'strong'],
|
||||
|
@ -379,56 +398,19 @@ class RedCloth < String
|
|||
(#{rcq})
|
||||
(#{C})
|
||||
(?::(\S+?))?
|
||||
(\S.*?\S|\S)
|
||||
(.+?)
|
||||
#{rcq}
|
||||
(?=\W)/x
|
||||
else
|
||||
/(#{rcq})
|
||||
(#{C})
|
||||
(?::(\S+))?
|
||||
(\S.*?\S|\S)
|
||||
(?::(\S+?))?
|
||||
(.+?)
|
||||
#{rcq}/xm
|
||||
end
|
||||
[rc, ht, re, rtype]
|
||||
end
|
||||
|
||||
# Elements to handle
|
||||
GLYPHS = [
|
||||
# [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1’\2' ], # single closing
|
||||
[ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1’' ], # single closing
|
||||
[ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '’' ], # single closing
|
||||
[ /\'/, '‘' ], # single opening
|
||||
[ /</, '<' ], # less-than
|
||||
[ />/, '>' ], # greater-than
|
||||
# [ /([^\s\[{(])?"(\s|:|$)/, '\1”\2' ], # double closing
|
||||
[ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1”' ], # double closing
|
||||
[ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '”' ], # double closing
|
||||
[ /"/, '“' ], # double opening
|
||||
[ /\b( )?\.{3}/, '\1…' ], # ellipsis
|
||||
[ /\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/, '<acronym title="\2">\1</acronym>' ], # 3+ uppercase acronym
|
||||
[ /(^|[^"][>\s])([A-Z][A-Z0-9 ]+[A-Z0-9])([^<A-Za-z0-9]|$)/, '\1<span class="caps">\2</span>\3', :no_span_caps ], # 3+ uppercase caps
|
||||
[ /(\.\s)?\s?--\s?/, '\1—' ], # em dash
|
||||
[ /\s->\s/, ' → ' ], # right arrow
|
||||
[ /\s-\s/, ' – ' ], # en dash
|
||||
[ /(\d+) ?x ?(\d+)/, '\1×\2' ], # dimension sign
|
||||
[ /\b ?[(\[]TM[\])]/i, '™' ], # trademark
|
||||
[ /\b ?[(\[]R[\])]/i, '®' ], # registered
|
||||
[ /\b ?[(\[]C[\])]/i, '©' ] # copyright
|
||||
]
|
||||
|
||||
H_ALGN_VALS = {
|
||||
'<' => 'left',
|
||||
'=' => 'center',
|
||||
'>' => 'right',
|
||||
'<>' => 'justify'
|
||||
}
|
||||
|
||||
V_ALGN_VALS = {
|
||||
'^' => 'top',
|
||||
'-' => 'middle',
|
||||
'~' => 'bottom'
|
||||
}
|
||||
|
||||
#
|
||||
# Flexible HTML escaping
|
||||
#
|
||||
|
@ -548,7 +530,7 @@ class RedCloth < String
|
|||
depth.pop
|
||||
end
|
||||
end
|
||||
if depth.last and depth.last.length == tl.length
|
||||
if depth.last.length == tl.length
|
||||
lines[line_id - 1] << '</li>'
|
||||
end
|
||||
end
|
||||
|
@ -595,7 +577,7 @@ class RedCloth < String
|
|||
end
|
||||
|
||||
def hard_break( text )
|
||||
text.gsub!( /(.)\n(?!\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks
|
||||
text.gsub!( /(.)\n(?! *[#*\s|]|$)/, "\\1<br />" ) if hard_breaks
|
||||
end
|
||||
|
||||
BLOCKS_GROUP_RE = /\n{2,}(?! )/m
|
||||
|
@ -723,9 +705,9 @@ class RedCloth < String
|
|||
end
|
||||
end
|
||||
|
||||
MARKDOWN_RULE_RE = /^(#{
|
||||
MARKDOWN_RULE_RE = /^#{
|
||||
['*', '-', '_'].collect { |ch| '( ?' + Regexp::quote( ch ) + ' ?){3,}' }.join( '|' )
|
||||
})$/
|
||||
}$/
|
||||
|
||||
def block_markdown_rule( text )
|
||||
text.gsub!( MARKDOWN_RULE_RE ) do |blk|
|
||||
|
@ -737,6 +719,9 @@ class RedCloth < String
|
|||
def block_markdown_lists( text )
|
||||
end
|
||||
|
||||
def inline_markdown_link( text )
|
||||
end
|
||||
|
||||
def inline_textile_span( text )
|
||||
QTAGS.each do |qtag_rc, ht, qtag_re, rtype|
|
||||
text.gsub!( qtag_re ) do |m|
|
||||
|
@ -918,12 +903,12 @@ class RedCloth < String
|
|||
|
||||
def shelve( val )
|
||||
@shelf << val
|
||||
" :redsh##{ @shelf.length }:"
|
||||
" <#{ @shelf.length }>"
|
||||
end
|
||||
|
||||
def retrieve( text )
|
||||
@shelf.each_with_index do |r, i|
|
||||
text.gsub!( " :redsh##{ i + 1 }:", r )
|
||||
text.gsub!( " <#{ i + 1 }>", r )
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -980,7 +965,7 @@ class RedCloth < String
|
|||
HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
|
||||
ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\w[^\n]*?>|$)/m
|
||||
|
||||
def glyphs_textile( text, level = 0 )
|
||||
def inline_textile_glyphs( text, level = 0 )
|
||||
if text !~ HASTAG_MATCH
|
||||
pgl text
|
||||
footnote_ref text
|
||||
|
@ -996,11 +981,11 @@ class RedCloth < String
|
|||
codepre = 0 if codepre < 0
|
||||
end
|
||||
elsif codepre.zero?
|
||||
glyphs_textile( line, level + 1 )
|
||||
inline_textile_glyphs( line, level + 1 )
|
||||
else
|
||||
htmlesc( line, :NoQuotes )
|
||||
end
|
||||
# p [level, codepre, line]
|
||||
## p [level, codepre, orig_line, line]
|
||||
|
||||
line
|
||||
end
|
||||
|
@ -1048,10 +1033,8 @@ class RedCloth < String
|
|||
end
|
||||
|
||||
def inline( text )
|
||||
[/^inline_/, /^glyphs_/].each do |meth_re|
|
||||
@rules.each do |rule_name|
|
||||
method( rule_name ).call( text ) if rule_name.to_s.match( meth_re )
|
||||
end
|
||||
@rules.each do |rule_name|
|
||||
method( rule_name ).call( text ) if rule_name.to_s.match /^inline_/
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1114,7 +1097,7 @@ class RedCloth < String
|
|||
q2 = ( q != '' ? q : '\s' )
|
||||
if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i
|
||||
attrv = $1
|
||||
next if prop == 'src' and attrv =~ %r{^(?!http)\w+:}
|
||||
next if prop == 'src' and attrv !~ /^http/
|
||||
pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\""
|
||||
break
|
||||
end
|
|
@ -5,9 +5,7 @@ require 'yaml'
|
|||
Dir["tests/*.yml"].each do |testfile|
|
||||
YAML::load_documents( File.open( testfile ) ) do |doc|
|
||||
if doc['in'] and doc['out']
|
||||
opts = []
|
||||
opts << :hard_breaks if testfile =~ /hard_breaks/
|
||||
red = RedCloth.new( doc['in'], opts )
|
||||
red = RedCloth.new( doc['in'] )
|
||||
html = if testfile =~ /markdown/
|
||||
red.to_html( :markdown )
|
||||
else
|
|
@ -39,28 +39,28 @@ out: |-
|
|||
<td>11/18/04</td>
|
||||
<td>11/18/04</td>
|
||||
<td>070</td>
|
||||
<td><span class="caps">XML</span> spec complete</td>
|
||||
<td>XML spec complete</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="/i/g.gif" alt="" /></td>
|
||||
<td>11/29/04</td>
|
||||
<td>11/29/04</td>
|
||||
<td>011</td>
|
||||
<td><span class="caps">XML</span> spec complete (KH is on schedule)</td>
|
||||
<td>XML spec complete (KH is on schedule)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="/i/g.gif" alt="" /></td>
|
||||
<td>11/29/04</td>
|
||||
<td>11/29/04</td>
|
||||
<td>051</td>
|
||||
<td><span class="caps">XML</span> spec complete (KH is on schedule)</td>
|
||||
<td>XML spec complete (KH is on schedule)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="/i/g.gif" alt="" /></td>
|
||||
<td>11/29/04</td>
|
||||
<td>11/29/04</td>
|
||||
<td>081</td>
|
||||
<td><span class="caps">XML</span> spec complete (KH is on schedule)</td>
|
||||
<td>XML spec complete (KH is on schedule)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="/i/g.gif" alt="" /></td>
|
|
@ -71,12 +71,6 @@ out: <p><strong>a phrase</strong></p>
|
|||
in: '**a phrase**'
|
||||
out: <p><b>a phrase</b></p>
|
||||
---
|
||||
in: '*(a)* a'
|
||||
out: <p><strong>(a)</strong> a</p>
|
||||
---
|
||||
in: '*(a)* *'
|
||||
out: <p><strong>(a)</strong> *</p>
|
||||
---
|
||||
in: Nabokov's ??Pnin??
|
||||
out: <p>Nabokov’s <cite>Pnin</cite></p>
|
||||
---
|
||||
|
@ -401,6 +395,3 @@ out: |-
|
|||
<li>We must act</li>
|
||||
</ul>
|
||||
|
||||
---
|
||||
in: '"test":http://foo.com/b---ar'
|
||||
out: <p><a href="http://foo.com/b---ar">test</a></p>
|
1376
vendor/RedCloth-3.0.4/setup.rb
vendored
1376
vendor/RedCloth-3.0.4/setup.rb
vendored
File diff suppressed because it is too large
Load diff
26
vendor/RedCloth-3.0.4/tests/hard_breaks.yml
vendored
26
vendor/RedCloth-3.0.4/tests/hard_breaks.yml
vendored
|
@ -1,26 +0,0 @@
|
|||
---
|
||||
in: |
|
||||
|This|is|a|row|
|
||||
{background:#ddd}. |This|is|grey|row|
|
||||
|This|is|another|row|
|
||||
out: |-
|
||||
<table>
|
||||
<tr>
|
||||
<td>This</td>
|
||||
<td>is</td>
|
||||
<td>a</td>
|
||||
<td>row</td>
|
||||
</tr>
|
||||
<tr style="background:#ddd;">
|
||||
<td>This</td>
|
||||
<td>is</td>
|
||||
<td>grey</td>
|
||||
<td>row</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>This</td>
|
||||
<td>is</td>
|
||||
<td>another</td>
|
||||
<td>row</td>
|
||||
</tr>
|
||||
</table>
|
Loading…
Reference in a new issue