lib/trac-wiki/parser.rb in trac-wiki-0.3.40 vs lib/trac-wiki/parser.rb in trac-wiki-0.3.41
- old
+ new
@@ -769,20 +769,23 @@
@tree.tag(:div, { class: "merge #{merge_class}" }, who)
end
def do_wikimedia_table(text)
end_paragraph
- start_tag('div', class: 'table-div') if div_around_table?
+ if div_around_table?
+ start_tag('div', class: 'table-div', 'data-line' => @line_no, 'data-lines' => text.count("\n"))
+ end
start_tag(:table)
start_tag(:tr)
offset = 0
text.split("\n").each do |line|
offset += line.length + 1
if line == '|-'
end_to_tag :tr
start_tag(:tr)
elsif line =~ /^([!\|])(.*)/
end_to_tag :td
+ end_to_tag :th
fst, rest = $1, $2
start_tag($1 == '|' ? :td : :th)
parse_inline(rest.strip, offset)
else
parse_inline(' ' +line.strip, offset)