Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2011-08-14 16:58:45 -05:00
commit ecaf67dca9
3 changed files with 20 additions and 9 deletions

View file

@ -482,12 +482,12 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
return return
end end
id = match[1]; url = match[2]; title = match[3]; id = match[1]; url = match[2]; title = match[3] || match[4] || match[5];
id = sanitize_ref_id(id) id = sanitize_ref_id(id)
hash = self.refs[id] = {:url=>url,:title=>title} hash = self.refs[id] = {:url=>url,:title=>title}
stuff=match[4] stuff=match[6]
if stuff if stuff
stuff.split.each do |couple| stuff.split.each do |couple|

View file

@ -120,11 +120,9 @@ module MaRuKu; module Strings
[ ]* [ ]*
<?([^>\s]+)>? # url = $2 <?([^>\s]+)>? # url = $2
[ ]* [ ]*
(?:# Titles are delimited by "quotes" or (parens). (?: # Titles are delimited by "quotes" or (parens).
["('] (?:(?:"([^"]+)")|(?:'([^']+)')|(?:\(([^\(\)]+)\))) # title = $3, $4, or $5
(.+?) # title = $3 \s*(.+)? # stuff = $6
[")'] # Matching ) or "
\s*(.+)? # stuff = $4
)? # title is optional )? # title is optional
}x }x

View file

@ -27,6 +27,8 @@ If all else fails, ask [Google](http://www.google.com)
And now [reference-style link ID with spaces] [Google Images] And now [reference-style link ID with spaces] [Google Images]
And now [reference-style link ID (without spaces)][Google Search]
[google]: http://www.google.com [google]: http://www.google.com
[google2]: http://www.google.com 'Single quotes' [google2]: http://www.google.com 'Single quotes'
@ -36,7 +38,7 @@ And now [reference-style link ID with spaces] [Google Images]
[google4]: http://www.google.com (Parenthesis) [google4]: http://www.google.com (Parenthesis)
[Google Search]: [Google Search]:
http://www.google.com "Google search" http://www.google.com 'Google search'
[Google Images]: [Google Images]:
http://images.google.com (Google images) http://images.google.com (Google images)
@ -73,6 +75,10 @@ md_el(:document,[
"And now ", "And now ",
md_link(["reference-style link ID with spaces"],"google_images") md_link(["reference-style link ID with spaces"],"google_images")
]), ]),
md_par([
"And now ",
md_link(["reference-style link ID (without spaces)"], "google_search")
]),
md_ref_def("google", "http://www.google.com", {:title=>nil}), md_ref_def("google", "http://www.google.com", {:title=>nil}),
md_ref_def("google2", "http://www.google.com", {:title=>"Single quotes"}), md_ref_def("google2", "http://www.google.com", {:title=>"Single quotes"}),
md_ref_def("google3", "http://www.google.com", {:title=>"Double quotes"}), md_ref_def("google3", "http://www.google.com", {:title=>"Double quotes"}),
@ -102,6 +108,8 @@ md_el(:document,[
<p>If all else fails, ask <a href="http://www.google.com">Google</a></p> <p>If all else fails, ask <a href="http://www.google.com">Google</a></p>
<p>And now <a href="http://images.google.com" title="Google images">reference-style link ID with spaces</a></p> <p>And now <a href="http://images.google.com" title="Google images">reference-style link ID with spaces</a></p>
<p>And now <a href="http://www.google.com" title="Google search">reference-style link ID (without spaces)</a></p>
*** Output of to_latex *** *** Output of to_latex ***
Search on \href{http://www.google.com}{Google} Search on \href{http://www.google.com}{Google}
@ -124,6 +132,8 @@ Search on \href{http://www.gogole.com}{http\char58\char47\char47www\char46gogole
If all else fails, ask \href{http://www.google.com}{Google} If all else fails, ask \href{http://www.google.com}{Google}
And now \href{http://images.google.com}{reference-style link ID with spaces} And now \href{http://images.google.com}{reference-style link ID with spaces}
And now \href{http://www.google.com}{reference-style link ID (without spaces)}
*** Output of to_md *** *** Output of to_md ***
Search on Google Search on Google
@ -148,5 +158,8 @@ If all else fails, ask Google
And now And now
reference-style link ID with spaces reference-style link ID with spaces
And now
reference-style link ID (without spaces)
*** Output of to_s *** *** Output of to_s ***
Search on GoogleSearch on GoogleSearch on GoogleSearch on GoogleSearch on Google imagesInline: Google imagesInline with title: Google imagesInline with title: Google imagesSearch on or or ask or you might ask bill@google.com.If all else fails, ask GoogleAnd now reference-style link ID with spaces Search on GoogleSearch on GoogleSearch on GoogleSearch on GoogleSearch on Google imagesInline: Google imagesInline with title: Google imagesInline with title: Google imagesSearch on or or ask or you might ask bill@google.com.If all else fails, ask GoogleAnd now reference-style link ID with spacesAnd now reference-style link ID (without spaces)