Sync with latest Maruku.
This commit is contained in:
parent
5246bada80
commit
0ac586ee25
7 changed files with 27 additions and 23 deletions
|
@ -206,10 +206,13 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
|
|||
elsif after.kind_of? MDElement
|
||||
after.al = e.ial
|
||||
else
|
||||
maruku_error "I don't know who you are referring to:"+
|
||||
" {#{e.ial.to_md}}", src, con
|
||||
maruku_error "It is not clear to me what element this IAL {:#{e.ial.to_md}} \n"+
|
||||
"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
|
||||
maruku_recover "Ignoring IAL: {#{e.ial.to_md}}", src, con
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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 :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 :xml_instr; read_xml_instruction(src, output)
|
||||
when :metadata;
|
||||
|
@ -452,7 +452,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
|||
end
|
||||
|
||||
|
||||
def read_ref_definition(src)
|
||||
def read_ref_definition(src, out)
|
||||
line = src.shift_line
|
||||
|
||||
# if link is incomplete, shift next line
|
||||
|
@ -465,7 +465,8 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
|||
|
||||
match = LinkRegex.match(line)
|
||||
if not match
|
||||
error "Link does not respect format: '#{line}'"
|
||||
maruku_error "Link does not respect format: '#{line}'"
|
||||
return
|
||||
end
|
||||
|
||||
id = match[1]; url = match[2]; title = match[3];
|
||||
|
@ -487,7 +488,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
|||
end
|
||||
# puts hash.inspect
|
||||
|
||||
return md_ref_def(id, url, meta={:title=>title})
|
||||
out.push md_ref_def(id, url, meta={:title=>title})
|
||||
end
|
||||
|
||||
def read_table(src)
|
||||
|
|
|
@ -278,7 +278,7 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
|
|||
end
|
||||
|
||||
def extension_meta(src, con, break_on_chars)
|
||||
if m = src.read_regexp(/(\w+):/)
|
||||
if m = src.read_regexp(/([^\s\:]+):/)
|
||||
name = m[1]
|
||||
al = read_attribute_list(src, con, break_on_chars)
|
||||
# puts "#{name}=#{al.inspect}"
|
||||
|
|
|
@ -110,7 +110,7 @@ module MaRuKu; module Strings
|
|||
# This regex is taken from BlueCloth sources
|
||||
# Link defs are in the form: ^[id]: \n? url "optional title"
|
||||
LinkRegex = %r{
|
||||
^[ ]*\[([^\]]+)\]: # id = $1
|
||||
^[ ]{0,3}\[([^\[\]]+)\]: # id = $1
|
||||
[ ]*
|
||||
<?(\S+)>? # url = $2
|
||||
[ ]*
|
||||
|
@ -122,7 +122,7 @@ module MaRuKu; module Strings
|
|||
)? # title is optional
|
||||
}x
|
||||
|
||||
IncompleteLink = %r{^\s*\[(.+)\]:\s*$}
|
||||
IncompleteLink = %r{^[ ]{0,3}\[([^\[\]]+)\]:\s*$}
|
||||
|
||||
HeaderWithId = /^(.*)\{\#([\w_-]+)\}\s*$/
|
||||
|
||||
|
|
|
@ -762,7 +762,8 @@ of the form `#ff00ff`.
|
|||
i += num_columns
|
||||
end
|
||||
|
||||
table = create_html_element 'table'
|
||||
table = create_html_element 'table',
|
||||
[:summary, :width, :frame, :rules, :border, :cellspacing, :cellpadding]
|
||||
thead = Element.new 'thead'
|
||||
tr = Element.new 'tr'
|
||||
array_to_html(head).each do |x| tr<<x end
|
||||
|
|
|
@ -127,7 +127,6 @@ will produce:
|
|||
\\usepackage{hyperref}
|
||||
\\usepackage{xspace}
|
||||
\\usepackage[usenames,dvipsnames]{color}
|
||||
\\usepackage[margin=1in]{geometry}
|
||||
\\hypersetup{colorlinks=true,urlcolor=blue}
|
||||
|
||||
#{user_preamble}
|
||||
|
@ -550,13 +549,13 @@ Otherwise, a standard `verbatim` environment is used.
|
|||
end
|
||||
|
||||
# puts a space after commands if needed
|
||||
e.each_index do |i|
|
||||
if e[i] =~ /\\\w+\s*$/ # command
|
||||
if (s=e[i+1]) && s[0] == ?\ # space
|
||||
e[i] = e[i] + "\\ "
|
||||
end
|
||||
end
|
||||
end
|
||||
# e.each_index do |i|
|
||||
# if e[i] =~ /\\\w+\s*$/ # command
|
||||
# if (s=e[i+1]) && s[0] == ?\ # space
|
||||
# e[i] = e[i] + "\\ "
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
e.join(join_char)
|
||||
end
|
||||
|
|
|
@ -42,12 +42,12 @@ module MaRuKu; module Out; module Latex
|
|||
@doc.latex_require_package p
|
||||
end
|
||||
|
||||
if replace =~ /^\\/
|
||||
replace = replace + " "
|
||||
end
|
||||
# if replace =~ /^\\/
|
||||
# replace = replace + " "
|
||||
# end
|
||||
|
||||
if replace
|
||||
return replace
|
||||
return replace + "{}"
|
||||
else
|
||||
tell_user "Cannot translate entity #{entity_name.inspect} to LaTeX."
|
||||
return entity_name
|
||||
|
|
Loading…
Reference in a new issue