Fixed some Maruku bugs
Email addresses and horizontal rules now work properly.
This commit is contained in:
parent
13a522525c
commit
070f689f9c
|
@ -50,11 +50,6 @@ module MaRuKu; module Strings
|
||||||
return :xml_instr if l =~ %r{^\s*<\?}
|
return :xml_instr if l =~ %r{^\s*<\?}
|
||||||
return :raw_html if l =~ %r{^[ ]?[ ]?[ ]?</?\s*\w+}
|
return :raw_html if l =~ %r{^[ ]?[ ]?[ ]?</?\s*\w+}
|
||||||
return :raw_html if l =~ %r{^[ ]?[ ]?[ ]?<\!\-\-}
|
return :raw_html if l =~ %r{^[ ]?[ ]?[ ]?<\!\-\-}
|
||||||
# Something is wrong with how we parse lists! :-(
|
|
||||||
#return :ulist if l =~ /^[ ]{0,3}([\*\-\+])\s+.*\w+/
|
|
||||||
#return :olist if l =~ /^[ ]{0,3}\d+\..*\w+/
|
|
||||||
return :ulist if l =~ /^[ ]{0,1}([\*\-\+])\s+.*/
|
|
||||||
return :olist if l =~ /^[ ]{0,1}\d+\.\s+.*/
|
|
||||||
return :header1 if l =~ /^(=)+/
|
return :header1 if l =~ /^(=)+/
|
||||||
return :header2 if l =~ /^([-\s])+$/
|
return :header2 if l =~ /^([-\s])+$/
|
||||||
return :header3 if l =~ /^(#)+\s*\S+/
|
return :header3 if l =~ /^(#)+\s*\S+/
|
||||||
|
@ -62,6 +57,11 @@ module MaRuKu; module Strings
|
||||||
return :hrule if l =~ /^(\s*\*\s*){3,1000}$/
|
return :hrule if l =~ /^(\s*\*\s*){3,1000}$/
|
||||||
return :hrule if l =~ /^(\s*-\s*){3,1000}$/ # or hyphens
|
return :hrule if l =~ /^(\s*-\s*){3,1000}$/ # or hyphens
|
||||||
return :hrule if l =~ /^(\s*_\s*){3,1000}$/ # or underscores
|
return :hrule if l =~ /^(\s*_\s*){3,1000}$/ # or underscores
|
||||||
|
# Something is wrong with how we parse lists! :-(
|
||||||
|
#return :ulist if l =~ /^[ ]{0,3}([\*\-\+])\s+.*\w+/
|
||||||
|
#return :olist if l =~ /^[ ]{0,3}\d+\..*\w+/
|
||||||
|
return :ulist if l =~ /^[ ]{0,1}([\*\-\+])\s+.*/
|
||||||
|
return :olist if l =~ /^[ ]{0,1}\d+\.\s+.*/
|
||||||
return :quote if l =~ /^>/
|
return :quote if l =~ /^>/
|
||||||
return :metadata if l =~ /^@/
|
return :metadata if l =~ /^@/
|
||||||
# if @@new_meta_data?
|
# if @@new_meta_data?
|
||||||
|
@ -143,5 +143,5 @@ module MaRuKu; module Strings
|
||||||
TableSeparator = %r{^(\|?#{Sep}\|?)+?\s*$}
|
TableSeparator = %r{^(\|?#{Sep}\|?)+?\s*$}
|
||||||
|
|
||||||
|
|
||||||
EMailAddress = /<([^:]+?@[^:]+?)>/
|
EMailAddress = /<([^:@>]+?@[^:@>]+?)>/
|
||||||
end end
|
end end
|
||||||
|
|
|
@ -733,9 +733,10 @@ of the form `#ff00ff`.
|
||||||
##### Email address
|
##### Email address
|
||||||
|
|
||||||
def obfuscate(s)
|
def obfuscate(s)
|
||||||
res = ''
|
d = Nokogiri::XML::Document.new
|
||||||
|
res = Nokogiri::XML::NodeSet.new(d)
|
||||||
s.each_byte do |char|
|
s.each_byte do |char|
|
||||||
res += "&#%03d;" % char
|
res << Nokogiri::XML::EntityReference.new(d, "#%03d" % char)
|
||||||
end
|
end
|
||||||
res
|
res
|
||||||
end
|
end
|
||||||
|
@ -748,9 +749,9 @@ of the form `#ff00ff`.
|
||||||
#a.attributes.add Attribute.new('href',Text.new(
|
#a.attributes.add Attribute.new('href',Text.new(
|
||||||
#"mailto:"+obfuscate(email),false,nil,true))
|
#"mailto:"+obfuscate(email),false,nil,true))
|
||||||
# Sorry, for the moment it doesn't work
|
# Sorry, for the moment it doesn't work
|
||||||
a.attributes['href'] = "mailto:#{email}"
|
a['href'] = "mailto:#{email}"
|
||||||
|
|
||||||
a << Nokogiri::XML::Text.new(obfuscate(email), d)
|
a << obfuscate(email)
|
||||||
a
|
a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ md_el(:document,[
|
||||||
md_par(["This is an email address: ", md_email("andrea@invalid.it")])
|
md_par(["This is an email address: ", md_email("andrea@invalid.it")])
|
||||||
],{},[])
|
],{},[])
|
||||||
*** Output of to_html ***
|
*** Output of to_html ***
|
||||||
<p>This is an email address: <a href='mailto:andrea@invalid.it'>andrea@invalid.it</a></p>
|
<p>This is an email address: <a href="mailto:andrea@invalid.it">andrea@invalid.it</a></p>
|
||||||
*** Output of to_latex ***
|
*** Output of to_latex ***
|
||||||
This is an email address: \href{mailto:andrea@invalid.it}{andrea\char64invalid\char46it}
|
This is an email address: \href{mailto:andrea@invalid.it}{andrea\char64invalid\char46it}
|
||||||
*** Output of to_md ***
|
*** Output of to_md ***
|
||||||
|
|
|
@ -22,7 +22,7 @@ md_el(:document,[
|
||||||
md_el(:hrule,[],{},[])
|
md_el(:hrule,[],{},[])
|
||||||
],{},[])
|
],{},[])
|
||||||
*** Output of to_html ***
|
*** Output of to_html ***
|
||||||
<hr /><hr /><hr /><hr /><hr />
|
<hr/><hr/><hr/><hr/><hr/>
|
||||||
*** Output of to_latex ***
|
*** Output of to_latex ***
|
||||||
\vspace{.5em} \hrule \vspace{.5em}
|
\vspace{.5em} \hrule \vspace{.5em}
|
||||||
|
|
||||||
|
|
2
vendor/plugins/maruku/spec/block_docs/ie.md
vendored
2
vendor/plugins/maruku/spec/block_docs/ie.md
vendored
|
@ -31,7 +31,7 @@ md_el(:document,[
|
||||||
|
|
||||||
<pre><code><p>here's an apostrophe & a quote "</p></code></pre>
|
<pre><code><p>here's an apostrophe & a quote "</p></code></pre>
|
||||||
|
|
||||||
<pre class="xml"><code lang="xml"><p>here's an apostrophe & a quote "</p></code></pre>
|
<pre class="xml"><code lang="xml"><span class="punct"><</span><span class="tag">p</span><span class="punct">></span>here's an apostrophe & a quote "<span class="punct"></</span><span class="tag">p</span><span class="punct">></span></code></pre>
|
||||||
|
|
||||||
<pre class="not_supported"><code lang="not_supported"><p>here's an apostrophe & a quote "</p></code></pre>
|
<pre class="not_supported"><code lang="not_supported"><p>here's an apostrophe & a quote "</p></code></pre>
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ md_el(:document,[
|
||||||
<p>Result alone:</p>
|
<p>Result alone:</p>
|
||||||
<img src="http://jigsaw.w3.org/css-validator/images/vcss"/>
|
<img src="http://jigsaw.w3.org/css-validator/images/vcss"/>
|
||||||
<p>Without closing:</p>
|
<p>Without closing:</p>
|
||||||
<img src="http://jigsaw.w3.org/css-validator/images/vcss" /><div>
|
<img src="http://jigsaw.w3.org/css-validator/images/vcss"/><div>
|
||||||
<p>
|
<p>
|
||||||
<p>This is</p>
|
<p>This is</p>
|
||||||
<em>
|
<em>
|
||||||
|
@ -106,8 +106,20 @@ md_el(:document,[
|
||||||
</p>
|
</p>
|
||||||
</div><table>
|
</div><table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><p>This is a</p><em><p>true</p></em><p>markdown text. (no par)</p></td>
|
<td>
|
||||||
<td><p>This is</p><em><p>true</p></em><p>markdown text. (par)</p></td>
|
<p>This is a</p>
|
||||||
|
<em>
|
||||||
|
<p>true</p>
|
||||||
|
</em>
|
||||||
|
<p>markdown text. (no par)</p>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p>This is</p>
|
||||||
|
<em>
|
||||||
|
<p>true</p>
|
||||||
|
</em>
|
||||||
|
<p>markdown text. (par)</p>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
*** Output of to_latex ***
|
*** Output of to_latex ***
|
||||||
|
|
|
@ -102,7 +102,7 @@ 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>
|
||||||
** Output of to_latex ***
|
*** Output of to_latex ***
|
||||||
Search on \href{http://www.google.com}{Google}
|
Search on \href{http://www.google.com}{Google}
|
||||||
|
|
||||||
Search on \href{http://www.google.com}{Google}
|
Search on \href{http://www.google.com}{Google}
|
||||||
|
|
Loading…
Reference in a new issue