Permalink
Browse files

bugfix for MediaWiki::Table

can handle spaces before | now


git-svn-id: svn://78.47.249.61/ruby-mediawiki/trunk@43 ba9c31aa-a806-0410-9a81-9f13d15ee83b
  • Loading branch information...
1 parent 826dc80 commit a7f5b24590ec24fd27743187de9f78abe917ff84 sven committed Jan 18, 2006
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/mediawiki/table.rb
View
10 lib/mediawiki/table.rb
@@ -31,20 +31,20 @@ def self.parse( text )
table, row = [], []
elsif table.nil?
# ignoring line probably not belonging to a table
- elsif line.match( /^\|\}/ )
+ elsif line.match( /^ *\|\}/ )
# end of table
table.push( row ) unless row.empty?
return table
- elsif line.match( /^\|-/ )
+ elsif line.match( /^ *\|-/ )
# new row
table.push( row ) unless row.empty?
row = []
- elsif match = line.match( /^(!|\|)$/ )
+ elsif match = line.match( /^ *(!|\|)$/ )
# cell without text
row.push( "" )
- elsif match = line.match( /^(!|\|)(.+)$/ )
+ elsif match = line.match( /^ *(!|\|)(.+)$/ )
match[2].split( '||', -1 ).each do | column | row.push( column.strip ) end
- elsif match = line.match( /^[^!|][^|]*$/ )
+ elsif match = line.match( /^ *[^!|][^|]*$/ )
# multiline cell
row[-1] += "\n" + line
else

0 comments on commit a7f5b24

Please sign in to comment.