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

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

View file

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

View file

@ -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*$/