Sync with latest Maruku.

This commit is contained in:
Jacques Distler 2007-02-04 19:36:33 -06:00
parent 5246bada80
commit 0ac586ee25
7 changed files with 27 additions and 23 deletions

View file

@ -206,10 +206,13 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
elsif after.kind_of? MDElement elsif after.kind_of? MDElement
after.al = e.ial after.al = e.ial
else else
maruku_error "I don't know who you are referring to:"+ maruku_error "It is not clear to me what element this IAL {:#{e.ial.to_md}} \n"+
" {#{e.ial.to_md}}", src, con "is referring to. The element before is a #{before.class.to_s}, \n"+
"the element after is a #{after.class.to_s}.\n"+
"\n before: #{before.inspect}"+
"\n after: #{after.inspect}",
src, con
# xxx dire se c'è empty vicino # xxx dire se c'è empty vicino
maruku_recover "Ignoring IAL: {#{e.ial.to_md}}", src, con
end end
end end
end end

View file

@ -102,7 +102,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
when :raw_html; e = read_raw_html(src); output << e if e when :raw_html; e = read_raw_html(src); output << e if e
when :footnote_text; output.push read_footnote_text(src) when :footnote_text; output.push read_footnote_text(src)
when :ref_definition; output.push read_ref_definition(src) when :ref_definition; read_ref_definition(src, output)
when :abbreviation; output.push read_abbreviation(src) when :abbreviation; output.push read_abbreviation(src)
when :xml_instr; read_xml_instruction(src, output) when :xml_instr; read_xml_instruction(src, output)
when :metadata; when :metadata;
@ -452,7 +452,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
end end
def read_ref_definition(src) def read_ref_definition(src, out)
line = src.shift_line line = src.shift_line
# if link is incomplete, shift next line # if link is incomplete, shift next line
@ -465,7 +465,8 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
match = LinkRegex.match(line) match = LinkRegex.match(line)
if not match if not match
error "Link does not respect format: '#{line}'" maruku_error "Link does not respect format: '#{line}'"
return
end end
id = match[1]; url = match[2]; title = match[3]; id = match[1]; url = match[2]; title = match[3];
@ -487,7 +488,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
end end
# puts hash.inspect # puts hash.inspect
return md_ref_def(id, url, meta={:title=>title}) out.push md_ref_def(id, url, meta={:title=>title})
end end
def read_table(src) def read_table(src)

View file

@ -278,7 +278,7 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
end end
def extension_meta(src, con, break_on_chars) def extension_meta(src, con, break_on_chars)
if m = src.read_regexp(/(\w+):/) if m = src.read_regexp(/([^\s\:]+):/)
name = m[1] name = m[1]
al = read_attribute_list(src, con, break_on_chars) al = read_attribute_list(src, con, break_on_chars)
# puts "#{name}=#{al.inspect}" # puts "#{name}=#{al.inspect}"

View file

@ -110,7 +110,7 @@ module MaRuKu; module Strings
# This regex is taken from BlueCloth sources # This regex is taken from BlueCloth sources
# Link defs are in the form: ^[id]: \n? url "optional title" # Link defs are in the form: ^[id]: \n? url "optional title"
LinkRegex = %r{ LinkRegex = %r{
^[ ]*\[([^\]]+)\]: # id = $1 ^[ ]{0,3}\[([^\[\]]+)\]: # id = $1
[ ]* [ ]*
<?(\S+)>? # url = $2 <?(\S+)>? # url = $2
[ ]* [ ]*
@ -122,7 +122,7 @@ module MaRuKu; module Strings
)? # title is optional )? # title is optional
}x }x
IncompleteLink = %r{^\s*\[(.+)\]:\s*$} IncompleteLink = %r{^[ ]{0,3}\[([^\[\]]+)\]:\s*$}
HeaderWithId = /^(.*)\{\#([\w_-]+)\}\s*$/ HeaderWithId = /^(.*)\{\#([\w_-]+)\}\s*$/

View file

@ -762,7 +762,8 @@ of the form `#ff00ff`.
i += num_columns i += num_columns
end end
table = create_html_element 'table' table = create_html_element 'table',
[:summary, :width, :frame, :rules, :border, :cellspacing, :cellpadding]
thead = Element.new 'thead' thead = Element.new 'thead'
tr = Element.new 'tr' tr = Element.new 'tr'
array_to_html(head).each do |x| tr<<x end array_to_html(head).each do |x| tr<<x end

View file

@ -127,7 +127,6 @@ will produce:
\\usepackage{hyperref} \\usepackage{hyperref}
\\usepackage{xspace} \\usepackage{xspace}
\\usepackage[usenames,dvipsnames]{color} \\usepackage[usenames,dvipsnames]{color}
\\usepackage[margin=1in]{geometry}
\\hypersetup{colorlinks=true,urlcolor=blue} \\hypersetup{colorlinks=true,urlcolor=blue}
#{user_preamble} #{user_preamble}
@ -550,13 +549,13 @@ Otherwise, a standard `verbatim` environment is used.
end end
# puts a space after commands if needed # puts a space after commands if needed
e.each_index do |i| # e.each_index do |i|
if e[i] =~ /\\\w+\s*$/ # command # if e[i] =~ /\\\w+\s*$/ # command
if (s=e[i+1]) && s[0] == ?\ # space # if (s=e[i+1]) && s[0] == ?\ # space
e[i] = e[i] + "\\ " # e[i] = e[i] + "\\ "
end # end
end # end
end # end
e.join(join_char) e.join(join_char)
end end

View file

@ -42,12 +42,12 @@ module MaRuKu; module Out; module Latex
@doc.latex_require_package p @doc.latex_require_package p
end end
if replace =~ /^\\/ # if replace =~ /^\\/
replace = replace + " " # replace = replace + " "
end # end
if replace if replace
return replace return replace + "{}"
else else
tell_user "Cannot translate entity #{entity_name.inspect} to LaTeX." tell_user "Cannot translate entity #{entity_name.inspect} to LaTeX."
return entity_name return entity_name