Downgrading RedCloth back to 3.0.3 (3.0.4 is said to be buggy)

This commit is contained in:
Alexey Verkhovsky 2005-09-28 04:12:11 +00:00
parent 61776995b6
commit 9ea6e6ae65
25 changed files with 1162 additions and 1589 deletions

View file

@ -1,6 +1,5 @@
* instiki-ar * instiki-ar:
SQL-based backend (ActiveRecord) SQL-based backend (ActiveRecord)
Upgrade to RedCloth 3.0.4
Replaced internal link generator with routing Replaced internal link generator with routing
Fixed --daemon option Fixed --daemon option

View file

@ -24,7 +24,7 @@ spec = Gem::Specification.new do |s|
s.has_rdoc = false 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('rubyzip', '= 0.5.8')
s.add_dependency('rails', '= 0.13.1') s.add_dependency('rails', '= 0.13.1')
s.add_dependency('sqlite3-ruby', '= 1.1.0') s.add_dependency('sqlite3-ruby', '= 1.1.0')

View file

@ -20,36 +20,12 @@ desc "Generate API documentation, show coding stats"
task :doc => [ :appdoc, :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" desc "Run the unit tests in test/unit"
Rake::TestTask.new("test_units") { |t| Rake::TestTask.new("test_units") { |t|
t.libs << "test" t.libs << "test"
t.pattern = 'test/unit/**/*_test.rb' t.pattern = 'test/unit/**/*_test.rb'
t.verbose = true t.verbose = true
} }
task :test_units => [ :clone_structure_to_test ]
desc "Run the functional tests in test/functional" desc "Run the functional tests in test/functional"
Rake::TestTask.new("test_functional") { |t| Rake::TestTask.new("test_functional") { |t|
@ -57,7 +33,6 @@ Rake::TestTask.new("test_functional") { |t|
t.pattern = 'test/functional/**/*_test.rb' t.pattern = 'test/functional/**/*_test.rb'
t.verbose = true t.verbose = true
} }
task :test_functional => [ :clone_structure_to_test ]
desc "Generate documentation for the application" desc "Generate documentation for the application"
Rake::RDocTask.new("appdoc") { |rdoc| Rake::RDocTask.new("appdoc") { |rdoc|
@ -118,52 +93,6 @@ task :stats => [ :environment ] do
).to_s ).to_s
end 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" desc "Empty the test database"
task :purge_test_database => :environment do task :purge_test_database => :environment do
abcs = ActiveRecord::Base.configurations abcs = ActiveRecord::Base.configurations

View file

@ -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 # 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. # 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 'application'
require 'test/unit' require 'test/unit'

52
vendor/RedCloth-3.0.3/RedCloth.gemspec vendored Normal file
View 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

View file

@ -1,3 +1,3 @@
#!/usr/bin/ruby18 #!/usr/local/bin/ruby18
require 'redcloth' require 'redcloth'
puts RedCloth.new( ARGF.read ).to_html puts RedCloth.new( ARGF.read ).to_html

View file

@ -1,15 +1,4 @@
--- %YAML:1.0 --- %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 - version: 3.0.3
date: 2005-02-06 date: 2005-02-06
changes: changes:

View file

@ -4,7 +4,9 @@ p=. !redcloth3-title.png!
h4. Get RedCloth 3 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/. 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 gem install RedCloth
</pre> </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> <pre>
ruby install.rb config ruby install.rb config

View file

@ -24,9 +24,9 @@
if it's found in a @pre@ or @code@ block. 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>" - !!example "I am <b>very</b> serious.\n\n<pre>\n I am <b>very</b> serious.\n</pre>"
- h4. Line Breaks - h4. Line Breaks
- Line breaks are ignored. - Line breaks are converted to HTML breaks.
- !!example "I spoke.\nAnd none replied." - !!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 - h4. Entities
- Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye. - Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye.
- !!example '"Observe!"' - !!example '"Observe!"'

1032
vendor/RedCloth-3.0.3/install.rb vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -166,7 +166,7 @@
class RedCloth < String class RedCloth < String
VERSION = '3.0.4' VERSION = '3.0.3'
DEFAULT_RULES = [:textile, :markdown] DEFAULT_RULES = [:textile, :markdown]
# #
@ -193,18 +193,6 @@ class RedCloth < String
# #
attr_accessor :hard_breaks 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. # Accessor for toggling span caps.
# #
@ -231,7 +219,7 @@ class RedCloth < String
# inline_textile_image:: Textile inline images # inline_textile_image:: Textile inline images
# inline_textile_link:: Textile inline links # inline_textile_link:: Textile inline links
# inline_textile_span:: Textile inline spans # 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 # == Markdown
# #
@ -272,7 +260,7 @@ class RedCloth < String
@shelf = [] @shelf = []
textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists, textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists,
:block_textile_prefix, :inline_textile_image, :inline_textile_link, :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, markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,
:block_markdown_bq, :block_markdown_lists, :block_markdown_bq, :block_markdown_lists,
:inline_markdown_reflink, :inline_markdown_link] :inline_markdown_reflink, :inline_markdown_link]
@ -290,16 +278,14 @@ class RedCloth < String
# standard clean up # standard clean up
incoming_entities text incoming_entities text
clean_white_space text clean_white_space text
no_textile text
# start processor # start processor
@pre_list = [] @pre_list = []
rip_offtags text rip_offtags text
no_textile text
hard_break text hard_break text
unless @lite_mode
refs text refs text
blocks text blocks text
end
inline text inline text
smooth_offtags 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}?)" 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 = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' ) PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' )
PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' )
PUNCT_Q = Regexp::quote( '*-_+^~%' )
HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)' HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)'
# Text markup tags, don't conflict with block tags # Text markup tags, don't conflict with block tags
@ -358,6 +342,41 @@ class RedCloth < String
'br', 'map', 'q', 'sub', 'sup', 'span', 'bdo' 'br', 'map', 'q', 'sub', 'sup', 'span', 'bdo'
] ]
# Elements to handle
GLYPHS = [
# [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1&#8217;\2' ], # single closing
[ /([^\s\[{(>])\'/, '\1&#8217;' ], # single closing
[ /\'(?=\s|s\b|[#{PUNCT}])/, '&#8217;' ], # single closing
[ /\'/, '&#8216;' ], # single opening
# [ /([^\s\[{(])?"(\s|:|$)/, '\1&#8221;\2' ], # double closing
[ /([^\s\[{(>])"/, '\1&#8221;' ], # double closing
[ /"(?=\s|[#{PUNCT}])/, '&#8221;' ], # double closing
[ /"/, '&#8220;' ], # double opening
[ /\b( )?\.{3}/, '\1&#8230;' ], # 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&#8212;' ], # em dash
[ /\s->\s/, ' &rarr; ' ], # right arrow
[ /\s-\s/, ' &#8211; ' ], # en dash
[ /(\d+) ?x ?(\d+)/, '\1&#215;\2' ], # dimension sign
[ /\b ?[(\[]TM[\])]/i, '&#8482;' ], # trademark
[ /\b ?[(\[]R[\])]/i, '&#174;' ], # registered
[ /\b ?[(\[]C[\])]/i, '&#169;' ] # copyright
]
H_ALGN_VALS = {
'<' => 'left',
'=' => 'center',
'>' => 'right',
'<>' => 'justify'
}
V_ALGN_VALS = {
'^' => 'top',
'-' => 'middle',
'~' => 'bottom'
}
QTAGS = [ QTAGS = [
['**', 'b'], ['**', 'b'],
['*', 'strong'], ['*', 'strong'],
@ -379,56 +398,19 @@ class RedCloth < String
(#{rcq}) (#{rcq})
(#{C}) (#{C})
(?::(\S+?))? (?::(\S+?))?
(\S.*?\S|\S) (.+?)
#{rcq} #{rcq}
(?=\W)/x (?=\W)/x
else else
/(#{rcq}) /(#{rcq})
(#{C}) (#{C})
(?::(\S+))? (?::(\S+?))?
(\S.*?\S|\S) (.+?)
#{rcq}/xm #{rcq}/xm
end end
[rc, ht, re, rtype] [rc, ht, re, rtype]
end end
# Elements to handle
GLYPHS = [
# [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1&#8217;\2' ], # single closing
[ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1&#8217;' ], # single closing
[ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '&#8217;' ], # single closing
[ /\'/, '&#8216;' ], # single opening
[ /</, '&lt;' ], # less-than
[ />/, '&gt;' ], # greater-than
# [ /([^\s\[{(])?"(\s|:|$)/, '\1&#8221;\2' ], # double closing
[ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1&#8221;' ], # double closing
[ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '&#8221;' ], # double closing
[ /"/, '&#8220;' ], # double opening
[ /\b( )?\.{3}/, '\1&#8230;' ], # 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&#8212;' ], # em dash
[ /\s->\s/, ' &rarr; ' ], # right arrow
[ /\s-\s/, ' &#8211; ' ], # en dash
[ /(\d+) ?x ?(\d+)/, '\1&#215;\2' ], # dimension sign
[ /\b ?[(\[]TM[\])]/i, '&#8482;' ], # trademark
[ /\b ?[(\[]R[\])]/i, '&#174;' ], # registered
[ /\b ?[(\[]C[\])]/i, '&#169;' ] # copyright
]
H_ALGN_VALS = {
'<' => 'left',
'=' => 'center',
'>' => 'right',
'<>' => 'justify'
}
V_ALGN_VALS = {
'^' => 'top',
'-' => 'middle',
'~' => 'bottom'
}
# #
# Flexible HTML escaping # Flexible HTML escaping
# #
@ -548,7 +530,7 @@ class RedCloth < String
depth.pop depth.pop
end end
end end
if depth.last and depth.last.length == tl.length if depth.last.length == tl.length
lines[line_id - 1] << '</li>' lines[line_id - 1] << '</li>'
end end
end end
@ -595,7 +577,7 @@ class RedCloth < String
end end
def hard_break( text ) def hard_break( text )
text.gsub!( /(.)\n(?!\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks text.gsub!( /(.)\n(?! *[#*\s|]|$)/, "\\1<br />" ) if hard_breaks
end end
BLOCKS_GROUP_RE = /\n{2,}(?! )/m BLOCKS_GROUP_RE = /\n{2,}(?! )/m
@ -723,9 +705,9 @@ class RedCloth < String
end end
end end
MARKDOWN_RULE_RE = /^(#{ MARKDOWN_RULE_RE = /^#{
['*', '-', '_'].collect { |ch| '( ?' + Regexp::quote( ch ) + ' ?){3,}' }.join( '|' ) ['*', '-', '_'].collect { |ch| '( ?' + Regexp::quote( ch ) + ' ?){3,}' }.join( '|' )
})$/ }$/
def block_markdown_rule( text ) def block_markdown_rule( text )
text.gsub!( MARKDOWN_RULE_RE ) do |blk| text.gsub!( MARKDOWN_RULE_RE ) do |blk|
@ -737,6 +719,9 @@ class RedCloth < String
def block_markdown_lists( text ) def block_markdown_lists( text )
end end
def inline_markdown_link( text )
end
def inline_textile_span( text ) def inline_textile_span( text )
QTAGS.each do |qtag_rc, ht, qtag_re, rtype| QTAGS.each do |qtag_rc, ht, qtag_re, rtype|
text.gsub!( qtag_re ) do |m| text.gsub!( qtag_re ) do |m|
@ -918,12 +903,12 @@ class RedCloth < String
def shelve( val ) def shelve( val )
@shelf << val @shelf << val
" :redsh##{ @shelf.length }:" " <#{ @shelf.length }>"
end end
def retrieve( text ) def retrieve( text )
@shelf.each_with_index do |r, i| @shelf.each_with_index do |r, i|
text.gsub!( " :redsh##{ i + 1 }:", r ) text.gsub!( " <#{ i + 1 }>", r )
end end
end end
@ -980,7 +965,7 @@ class RedCloth < String
HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\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 if text !~ HASTAG_MATCH
pgl text pgl text
footnote_ref text footnote_ref text
@ -996,11 +981,11 @@ class RedCloth < String
codepre = 0 if codepre < 0 codepre = 0 if codepre < 0
end end
elsif codepre.zero? elsif codepre.zero?
glyphs_textile( line, level + 1 ) inline_textile_glyphs( line, level + 1 )
else else
htmlesc( line, :NoQuotes ) htmlesc( line, :NoQuotes )
end end
# p [level, codepre, line] ## p [level, codepre, orig_line, line]
line line
end end
@ -1048,10 +1033,8 @@ class RedCloth < String
end end
def inline( text ) def inline( text )
[/^inline_/, /^glyphs_/].each do |meth_re|
@rules.each do |rule_name| @rules.each do |rule_name|
method( rule_name ).call( text ) if rule_name.to_s.match( meth_re ) method( rule_name ).call( text ) if rule_name.to_s.match /^inline_/
end
end end
end end
@ -1114,7 +1097,7 @@ class RedCloth < String
q2 = ( q != '' ? q : '\s' ) q2 = ( q != '' ? q : '\s' )
if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i
attrv = $1 attrv = $1
next if prop == 'src' and attrv =~ %r{^(?!http)\w+:} next if prop == 'src' and attrv !~ /^http/
pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\"" pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\""
break break
end end

View file

@ -5,9 +5,7 @@ require 'yaml'
Dir["tests/*.yml"].each do |testfile| Dir["tests/*.yml"].each do |testfile|
YAML::load_documents( File.open( testfile ) ) do |doc| YAML::load_documents( File.open( testfile ) ) do |doc|
if doc['in'] and doc['out'] if doc['in'] and doc['out']
opts = [] red = RedCloth.new( doc['in'] )
opts << :hard_breaks if testfile =~ /hard_breaks/
red = RedCloth.new( doc['in'], opts )
html = if testfile =~ /markdown/ html = if testfile =~ /markdown/
red.to_html( :markdown ) red.to_html( :markdown )
else else

View file

@ -39,28 +39,28 @@ out: |-
<td>11/18/04</td> <td>11/18/04</td>
<td>11/18/04</td> <td>11/18/04</td>
<td>070</td> <td>070</td>
<td><span class="caps">XML</span> spec complete</td> <td>XML spec complete</td>
</tr> </tr>
<tr> <tr>
<td><img src="/i/g.gif" alt="" /></td> <td><img src="/i/g.gif" alt="" /></td>
<td>11/29/04</td> <td>11/29/04</td>
<td>11/29/04</td> <td>11/29/04</td>
<td>011</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>
<tr> <tr>
<td><img src="/i/g.gif" alt="" /></td> <td><img src="/i/g.gif" alt="" /></td>
<td>11/29/04</td> <td>11/29/04</td>
<td>11/29/04</td> <td>11/29/04</td>
<td>051</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>
<tr> <tr>
<td><img src="/i/g.gif" alt="" /></td> <td><img src="/i/g.gif" alt="" /></td>
<td>11/29/04</td> <td>11/29/04</td>
<td>11/29/04</td> <td>11/29/04</td>
<td>081</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>
<tr> <tr>
<td><img src="/i/g.gif" alt="" /></td> <td><img src="/i/g.gif" alt="" /></td>

View file

@ -71,12 +71,6 @@ out: <p><strong>a phrase</strong></p>
in: '**a phrase**' in: '**a phrase**'
out: <p><b>a phrase</b></p> 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?? in: Nabokov's ??Pnin??
out: <p>Nabokov&#8217;s <cite>Pnin</cite></p> out: <p>Nabokov&#8217;s <cite>Pnin</cite></p>
--- ---
@ -401,6 +395,3 @@ out: |-
<li>We must act</li> <li>We must act</li>
</ul> </ul>
---
in: '"test":http://foo.com/b---ar'
out: <p><a href="http://foo.com/b---ar">test</a></p>

File diff suppressed because it is too large Load diff

View file

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