Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
9e4e565221
20 changed files with 1725 additions and 136 deletions
8
vendor/plugins/maruku/AUTHORS
vendored
8
vendor/plugins/maruku/AUTHORS
vendored
|
@ -1,11 +1,15 @@
|
|||
Incomplete list of contributors
|
||||
-------------------------------
|
||||
|
||||
Code and patches from:
|
||||
|
||||
* [Andrea Censi](http://www.dis.uniroma1.it/~acensi)
|
||||
* [Jacques Distler](http://golem.ph.utexas.edu/~distler)
|
||||
* [Andrea Censi](http://www.cds.caltech.edu/~andrea/)
|
||||
* [Jacques Distler](http://golem.ph.utexas.edu/~distler/)
|
||||
* Paul Dlug
|
||||
* [Ari Stern](http://www.acm.caltech.edu/~astern)
|
||||
* Damir Zekic (z3c)
|
||||
* Alexandr Mankuta (cheba)
|
||||
* Nathan Weizenbaum <nex342@gmail.com>
|
||||
|
||||
Bug reporting, feature requests and praise:
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module MaRuKu; module Out; module HTML
|
|||
# or return an empty array on error
|
||||
# return []
|
||||
# or have a string parsed by REXML:
|
||||
tex = tex.gsub('&','&')
|
||||
tex = tex.escapeHTML
|
||||
mathml = "<code>#{tex}</code>"
|
||||
return Document.new(mathml).root
|
||||
end
|
||||
|
|
6
vendor/plugins/maruku/lib/maruku/helpers.rb
vendored
6
vendor/plugins/maruku/lib/maruku/helpers.rb
vendored
|
@ -91,10 +91,10 @@ module Helpers
|
|||
raw_html = "<marukuwrap>#{raw_html}</marukuwrap>"
|
||||
e.instance_variable_set :@parsed_html,
|
||||
REXML::Document.new(raw_html)
|
||||
rescue #Exception => ex
|
||||
rescue REXML::ParseException => ex
|
||||
e.instance_variable_set :@parsed_html, nil
|
||||
# tell_user "Malformed block of HTML:\n"+
|
||||
# add_tabs(raw_html,1,'|')
|
||||
maruku_recover "REXML cannot parse this block of HTML/XML:\n"+
|
||||
add_tabs(raw_html,1,'|') + "\n"+ex.inspect
|
||||
# " #{raw_html.inspect}\n\n"+ex.inspect
|
||||
end
|
||||
e
|
||||
|
|
|
@ -198,14 +198,17 @@ Disabled by default because of security concerns.
|
|||
XPath.match(doc, "//*[attribute::markdown]" ).each do |e|
|
||||
# puts "Found #{e}"
|
||||
# should we parse block-level or span-level?
|
||||
parse_blocks = (e.attributes['markdown'] == 'block') ||
|
||||
block_tags.include?(e.name)
|
||||
# remove 'markdown' attribute
|
||||
e.delete_attribute 'markdown'
|
||||
|
||||
how = e.attributes['markdown']
|
||||
parse_blocks = (how == 'block') || block_tags.include?(e.name)
|
||||
|
||||
# Select all text elements of e
|
||||
XPath.match(e, "//text()" ).each { |original_text|
|
||||
s = original_text.value.strip
|
||||
if s.size > 0
|
||||
|
||||
# puts "Parsing #{s.inspect} as blocks: #{parse_blocks} (#{e.name}, #{e.attributes['markdown']}) "
|
||||
|
||||
el = md_el(:dummy,
|
||||
parse_blocks ? parse_text_as_markdown(s) :
|
||||
parse_lines_as_span([s]) )
|
||||
|
@ -217,7 +220,11 @@ Disabled by default because of security concerns.
|
|||
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
|
||||
# remove 'markdown' attribute
|
||||
e.delete_attribute 'markdown'
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
2
vendor/plugins/maruku/lib/maruku/version.rb
vendored
2
vendor/plugins/maruku/lib/maruku/version.rb
vendored
|
@ -19,7 +19,7 @@
|
|||
#++
|
||||
|
||||
module MaRuKu
|
||||
Version = '0.5.9'
|
||||
Version = '0.6.0'
|
||||
|
||||
MarukuURL = 'http://maruku.rubyforge.org/'
|
||||
|
||||
|
|
|
@ -54,18 +54,18 @@ require 'maruku/ext/div'; {} # params
|
|||
|
||||
*** Output of inspect ***
|
||||
md_el(:document,[
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[]),
|
||||
md_el(:div,[md_par(["text"])],{},[])
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[]),
|
||||
md_el(:div,[md_par(["text"])],{:label=>nil,:num=>nil,:type=>nil},[])
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
<div>
|
||||
|
@ -116,7 +116,29 @@ md_el(:document,[
|
|||
<p>text</p>
|
||||
</div>
|
||||
*** Output of to_latex ***
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
|
||||
text
|
||||
*** Output of to_md ***
|
||||
text
|
||||
|
||||
|
|
|
@ -6,13 +6,15 @@ require 'maruku/ext/div'; {} # params
|
|||
ciao
|
||||
=--
|
||||
*** Output of inspect ***
|
||||
md_el(:document,[md_el(:div,[md_par(["ciao"])],{},[])],{},[])
|
||||
md_el(:document,[
|
||||
md_el(:div,[md_par(["ciao"])],{:label=>nil,:num=>nil,:type=>nil},[])
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
<div>
|
||||
<p>ciao</p>
|
||||
</div>
|
||||
*** Output of to_latex ***
|
||||
|
||||
ciao
|
||||
*** Output of to_md ***
|
||||
ciao
|
||||
*** Output of to_s ***
|
||||
|
|
|
@ -16,8 +16,8 @@ md_el(:document,[
|
|||
md_el(:div,[
|
||||
md_par(["this is the last warning!"]),
|
||||
md_par(["please, go away!"]),
|
||||
md_el(:div,[md_par(["or else terrible things will happen"])],{},[[:class, "menace"]])
|
||||
],{},[[:class, "warning"]])
|
||||
md_el(:div,[md_par(["or else terrible things will happen"])],{:label=>nil,:num=>nil,:type=>nil},[[:class, "menace"]])
|
||||
],{:label=>nil,:num=>nil,:type=>nil},[[:class, "warning"]])
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
<div class='warning'>
|
||||
|
@ -30,7 +30,11 @@ md_el(:document,[
|
|||
</div>
|
||||
</div>
|
||||
*** Output of to_latex ***
|
||||
this is the last warning!
|
||||
|
||||
please, go away!
|
||||
|
||||
or else terrible things will happen
|
||||
*** Output of to_md ***
|
||||
this is the last warning!
|
||||
|
||||
|
|
|
@ -37,20 +37,12 @@ Without closing:
|
|||
|
||||
<table>
|
||||
<tr>
|
||||
<td markdown="1">This is *true* markdown text. (no par)</td>
|
||||
<td markdown="1">This is a *true* markdown text. (no par)</td>
|
||||
<td markdown="block">This is *true* markdown text. (par)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
The following is invalid HTML, and will generate an error:
|
||||
|
||||
<table>
|
||||
<td markdown="1">This is *true* markdown text. (no par)</td>
|
||||
<td markdown="block">This is *true* markdown text. (par)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
*** Output of inspect ***
|
||||
md_el(:document,[
|
||||
|
@ -68,10 +60,7 @@ md_el(:document,[
|
|||
md_par(["Without closing:"]),
|
||||
md_html("<img src=\"http://jigsaw.w3.org/css-validator/images/vcss\" />"),
|
||||
md_html("<div markdown=\"1\">\n\tThis is *true* markdown text (paragraph)\n\n\t<p markdown=\"1\">\n\t\tThis is *true* markdown text (no paragraph)\n\t</p>\n\t<p markdown=\"block\">\n\t\tThis is *true* markdown text (block paragraph)\n\t</p>\n</div>"),
|
||||
md_html("<table>\n<tr>\n<td markdown=\"1\">This is *true* markdown text. (no par)</td>\n<td markdown=\"block\">This is *true* markdown text. (par)</td>\n</tr>\n</table>"),
|
||||
md_par(["The following is invalid HTML, and will generate an error:"]),
|
||||
md_html("<table>\n<td markdown=\"1\">This is *true* markdown text. (no par)</td>\n<td markdown=\"block\">This is *true* markdown text. (par)</td>\n</tr>"),
|
||||
md_html("</table>")
|
||||
md_html("<table>\n<tr>\n<td markdown=\"1\">This is a *true* markdown text. (no par)</td>\n<td markdown=\"block\">This is *true* markdown text. (par)</td>\n</tr>\n</table>")
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
<p>Input:</p>
|
||||
|
@ -118,7 +107,7 @@ md_el(:document,[
|
|||
</div><table>
|
||||
<tr>
|
||||
<td>
|
||||
<p>This is</p>
|
||||
<p>This is a</p>
|
||||
<em>
|
||||
<p>true</p>
|
||||
</em>
|
||||
|
@ -133,13 +122,6 @@ md_el(:document,[
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>The following is invalid HTML, and will generate an error:</p>
|
||||
<pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
|
||||
<table>
|
||||
<td markdown="1">This is *true* markdown text. (no par)</td>
|
||||
<td markdown="block">This is *true* markdown text. (par)</td>
|
||||
</tr></pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
|
||||
</table></pre>
|
||||
*** Output of to_latex ***
|
||||
Input:
|
||||
|
||||
|
@ -154,8 +136,6 @@ Result on span:
|
|||
Result alone:
|
||||
|
||||
Without closing:
|
||||
|
||||
The following is invalid HTML, and will generate an error:
|
||||
*** Output of to_md ***
|
||||
Input:
|
||||
|
||||
|
@ -168,11 +148,8 @@ Result on span:
|
|||
Result alone:
|
||||
|
||||
Without closing:
|
||||
|
||||
The following is invalid HTML, and will
|
||||
generate an error:
|
||||
*** Output of to_s ***
|
||||
Input:Result: Input:Result on span: Result alone:Without closing:The following is invalid HTML, and will generate an error:
|
||||
Input:Result: Input:Result on span: Result alone:Without closing:
|
||||
*** EOF ***
|
||||
|
||||
|
||||
|
|
17
vendor/plugins/maruku/tests/unittest/links.md
vendored
17
vendor/plugins/maruku/tests/unittest/links.md
vendored
|
@ -24,7 +24,9 @@ Search on <http://www.gogole.com> or <http://Here.com> or ask <mailto:bill@googl
|
|||
or you might ask bill@google.com.
|
||||
|
||||
If all else fails, ask [Google](http://www.google.com)
|
||||
|
||||
|
||||
And now [reference-style link ID with spaces] [Google Images]
|
||||
|
||||
[google]: http://www.google.com
|
||||
|
||||
[google2]: http://www.google.com 'Single quotes'
|
||||
|
@ -67,6 +69,10 @@ md_el(:document,[
|
|||
"If all else fails, ask ",
|
||||
md_im_link(["Google"], "http://www.google.com", nil)
|
||||
]),
|
||||
md_par([
|
||||
"And now ",
|
||||
md_link(["reference-style link ID with spaces"],"google_images")
|
||||
]),
|
||||
md_ref_def("google", "http://www.google.com", {:title=>nil}),
|
||||
md_ref_def("google2", "http://www.google.com", {:title=>"Single quotes"}),
|
||||
md_ref_def("google3", "http://www.google.com", {:title=>"Double quotes"}),
|
||||
|
@ -94,6 +100,8 @@ md_el(:document,[
|
|||
<p>Search on <a href='http://www.gogole.com'>http://www.gogole.com</a> or <a href='http://Here.com'>http://Here.com</a> or ask <a href='mailto:bill@google.com'>bill@google.com</a> or you might ask bill@google.com.</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>
|
||||
*** Output of to_latex ***
|
||||
Search on \href{http://www.google.com}{Google}
|
||||
|
||||
|
@ -114,6 +122,8 @@ Inline with title: \href{http://google.com}{Google images}
|
|||
Search on \href{http://www.gogole.com}{http\char58\char47\char47www\char46gogole\char46com} or \href{http://Here.com}{http\char58\char47\char47Here\char46com} or ask \href{mailto:bill@google.com}{bill\char64google\char46com} or you might ask bill@google.com.
|
||||
|
||||
If all else fails, ask \href{http://www.google.com}{Google}
|
||||
|
||||
And now \href{http://images.google.com}{reference-style link ID with spaces}
|
||||
*** Output of to_md ***
|
||||
Search on Google
|
||||
|
||||
|
@ -135,8 +145,11 @@ Search on or or ask or you might ask
|
|||
bill@google.com.
|
||||
|
||||
If all else fails, ask Google
|
||||
|
||||
And now
|
||||
reference-style link ID with spaces
|
||||
*** 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 Google
|
||||
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
|
||||
*** EOF ***
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Write a comment abouth the test here.
|
||||
This should not trigger the list
|
||||
*** Parameters: ***
|
||||
{}
|
||||
*** Markdown input: ***
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Write a comment here
|
||||
*** Parameters: ***
|
||||
{}
|
||||
require 'maruku/ext/math';{}
|
||||
*** Markdown input: ***
|
||||
|
||||
$$ x = y $$
|
||||
|
@ -16,42 +16,69 @@ $$
|
|||
|
||||
*** Output of inspect ***
|
||||
md_el(:document,[
|
||||
md_par(["$$ x = y $$"]),
|
||||
md_el(:header,["$$ x"],{:level=>1},[]),
|
||||
md_par(["$$ x = y $$"]),
|
||||
md_par(["$$ x = y $$"])
|
||||
md_el(:equation,[],{:label=>nil,:math=>" x = y ",:num=>nil},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[])
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
<p>$$ x = y $$</p>
|
||||
|
||||
<h1 id='_x'>$$ x</h1>
|
||||
|
||||
<p>$$ x = y $$</p>
|
||||
|
||||
<p>$$ x = y $$</p>
|
||||
<div class='maruku-equation'><code class='maruku-mathml'> x = y </code><div class='maruku-eq-tex'><code style='display: none'>x = y</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
|
||||
</code><div class='maruku-eq-tex'><code style='display: none'>x = y</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
|
||||
</code><div class='maruku-eq-tex'><code style='display: none'>x = y</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
|
||||
</code><div class='maruku-eq-tex'><code style='display: none'>x = y</code></div></div>
|
||||
*** Output of to_latex ***
|
||||
\$\$ x = y \$\$
|
||||
|
||||
\hypertarget{_x}{}\section*{{\$\$ x}}\label{_x}
|
||||
|
||||
\$\$ x = y \$\$
|
||||
|
||||
\$\$ x = y \$\$
|
||||
\begin{displaymath}
|
||||
x = y
|
||||
\end{displaymath}
|
||||
\begin{displaymath}
|
||||
x = y
|
||||
\end{displaymath}
|
||||
\begin{displaymath}
|
||||
x = y
|
||||
\end{displaymath}
|
||||
\begin{displaymath}
|
||||
x = y
|
||||
\end{displaymath}
|
||||
*** Output of to_md ***
|
||||
$$ x = y $$
|
||||
|
||||
$$ x$$ x = y $$
|
||||
|
||||
$$ x = y $$
|
||||
*** Output of to_s ***
|
||||
$$ x = y $$$$ x$$ x = y $$$$ x = y $$
|
||||
|
||||
*** EOF ***
|
||||
|
||||
|
||||
|
||||
OK!
|
||||
|
||||
Failed tests: [:to_html]
|
||||
|
||||
*** Output of inspect ***
|
||||
md_el(:document,[
|
||||
md_el(:equation,[],{:label=>nil,:math=>" x = y ",:num=>nil},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[])
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
-----| WARNING | -----
|
||||
<div class='maruku-equation'><code class='maruku-mathml'> x = y </code><span class='maruku-eq-tex'><code style='display: none'>x = y</code></span></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
|
||||
</code><span class='maruku-eq-tex'><code style='display: none'>x = y</code></span></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
|
||||
</code><span class='maruku-eq-tex'><code style='display: none'>x = y</code></span></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
|
||||
</code><span class='maruku-eq-tex'><code style='display: none'>x = y</code></span></div>
|
||||
*** Output of to_latex ***
|
||||
\begin{displaymath}
|
||||
x = y
|
||||
\end{displaymath}
|
||||
\begin{displaymath}
|
||||
x = y
|
||||
\end{displaymath}
|
||||
\begin{displaymath}
|
||||
x = y
|
||||
\end{displaymath}
|
||||
\begin{displaymath}
|
||||
x = y
|
||||
\end{displaymath}
|
||||
*** Output of to_md ***
|
||||
|
||||
*** Output of to_s ***
|
||||
|
||||
*** Output of Markdown.pl ***
|
||||
(not used anymore)
|
||||
|
|
|
@ -22,9 +22,9 @@ md_el(:document,[
|
|||
<p>Here are some formulas:</p>
|
||||
|
||||
<ul>
|
||||
<li><span class='maruku-inline'><code class='maruku-mathml'>\alpha</code></span></li>
|
||||
<li><code class='maruku-mathml'>\alpha</code></li>
|
||||
|
||||
<li><span class='maruku-inline'><code class='maruku-mathml'>x^{n}+y^{n} \neq z^{n}</code></span></li>
|
||||
<li><code class='maruku-mathml'>x^{n}+y^{n} \neq z^{n}</code></li>
|
||||
</ul>
|
||||
|
||||
<p>That’s it, nothing else is supported.</p>
|
||||
|
|
|
@ -25,12 +25,7 @@ md_el(:document,[
|
|||
md_el(:equation,[],{:label=>nil,:math=>" \\gamma ",:num=>nil},[])
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
<div class='maruku-equation' id='eq:eq1'><span class='maruku-eq-number'>(1)</span><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>α</mi></math><div class='maruku-eq-tex'><code style='display: none'> \alpha
|
||||
|
||||
</code></div></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>α</mi></math><div class='maruku-eq-tex'><code style='display: none'> \alpha
|
||||
|
||||
</code></div></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>β</mi></math><div class='maruku-eq-tex'><code style='display: none'> \beta
|
||||
</code></div></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>γ</mi></math><div class='maruku-eq-tex'><code style='display: none'> \gamma </code></div></div>
|
||||
<div class='maruku-equation' id='eq:eq1'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>α</mi></math><span class='maruku-eq-tex'><code style='display: none'>\alpha</code></span><span class='maruku-eq-number'>(1)</span></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>α</mi></math><span class='maruku-eq-tex'><code style='display: none'>\alpha</code></span></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>β</mi></math><span class='maruku-eq-tex'><code style='display: none'>\beta</code></span></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>γ</mi></math><span class='maruku-eq-tex'><code style='display: none'>\gamma</code></span></div>
|
||||
*** Output of to_latex ***
|
||||
\begin{equation}
|
||||
\alpha
|
||||
|
@ -52,45 +47,9 @@ md_el(:document,[
|
|||
|
||||
|
||||
|
||||
OK!
|
||||
|
||||
Failed tests: [:to_html]
|
||||
|
||||
*** Output of inspect ***
|
||||
md_el(:document,[
|
||||
md_el(:equation,[],{:label=>"eq1",:math=>"\t\\alpha\n\n",:num=>1},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>"\t\\alpha\n\n",:num=>nil},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>" \\beta\n",:num=>nil},[]),
|
||||
md_el(:equation,[],{:label=>nil,:math=>" \\gamma ",:num=>nil},[])
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
-----| WARNING | -----
|
||||
<div class='maruku-equation' id='eq:eq1'><span class='maruku-eq-number'>(1)</span><code class='maruku-mathml'> \alpha
|
||||
|
||||
</code><div class='maruku-eq-tex'><code style='display: none'> \alpha
|
||||
|
||||
</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> \alpha
|
||||
|
||||
</code><div class='maruku-eq-tex'><code style='display: none'> \alpha
|
||||
|
||||
</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> \beta
|
||||
</code><div class='maruku-eq-tex'><code style='display: none'> \beta
|
||||
</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> \gamma </code><div class='maruku-eq-tex'><code style='display: none'> \gamma </code></div></div>
|
||||
*** Output of to_latex ***
|
||||
\begin{equation}
|
||||
\alpha
|
||||
\label{eq1}\end{equation}
|
||||
\begin{displaymath}
|
||||
\alpha
|
||||
\end{displaymath}
|
||||
\begin{displaymath}
|
||||
\beta
|
||||
\end{displaymath}
|
||||
\begin{displaymath}
|
||||
\gamma
|
||||
\end{displaymath}
|
||||
*** Output of to_md ***
|
||||
|
||||
*** Output of to_s ***
|
||||
|
||||
*** Output of Markdown.pl ***
|
||||
(not used anymore)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Write a comment here
|
||||
*** Parameters: ***
|
||||
{}
|
||||
require 'maruku/ext/math';{:html_math_engine => 'itex2mml' }
|
||||
*** Markdown input: ***
|
||||
<table markdown='1'>
|
||||
$\alpha$
|
||||
|
@ -13,8 +13,8 @@ md_el(:document,[
|
|||
md_html("<table markdown='1'>\n\t$\\alpha$\n\t<thead>\n\t\t<td>$\\beta$</td>\n\t</thead>\n</table>")
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
<table><span class='maruku-inline'><code class='maruku-mathml'>\alpha</code></span><thead>
|
||||
<td><span class='maruku-inline'><code class='maruku-mathml'>\beta</code></span></td>
|
||||
<table><math class='maruku-mathml' display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>α</mi></math><thead>
|
||||
<td><math class='maruku-mathml' display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>β</mi></math></td>
|
||||
</thead>
|
||||
</table>
|
||||
*** Output of to_latex ***
|
||||
|
|
|
@ -4,15 +4,15 @@ This shows how Maruku recovers from parsing errors
|
|||
*** Markdown input: ***
|
||||
Search on [Google images][ GoOgle search ]
|
||||
*** Output of inspect ***
|
||||
md_el(:document,[md_par(["Search on Google imagesGoOgle search ]"])],{},[])
|
||||
md_el(:document,[md_par(["Search on ", md_link(["Google images"],"google_search")])],{},[])
|
||||
*** Output of to_html ***
|
||||
<p>Search on Google imagesGoOgle search ]</p>
|
||||
<p>Search on <span>Google images</span></p>
|
||||
*** Output of to_latex ***
|
||||
Search on Google imagesGoOgle search ]
|
||||
Search on Google images
|
||||
*** Output of to_md ***
|
||||
Search on Google imagesGoOgle search ]
|
||||
Search on Google images
|
||||
*** Output of to_s ***
|
||||
Search on Google imagesGoOgle search ]
|
||||
Search on Google images
|
||||
*** EOF ***
|
||||
|
||||
|
||||
|
|
101
vendor/plugins/maruku/tests/unittest/red_tests/abbrev.html
vendored
Normal file
101
vendor/plugins/maruku/tests/unittest/red_tests/abbrev.html
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC
|
||||
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
||||
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>WebKit (Safari 3.1) and the CSS @font-face declaration</title></head>
|
||||
<body>
|
||||
<h1 id='webkit_safari_31_and_the_css_fontface_declaration'>WebKit (Safari 3.1) and the <abbr title='Cascading Style Sheets'>CSS</abbr> @font-face declaration</h1>
|
||||
|
||||
<p>I’m a big fan of typography in general. If you check out <a href='http://elliottcable.name'>my homepage</a> or my <a href='http://elliottcable.name/contact.xhtml'>contact elliottcable</a> page, and you’re using Safari/WebKit or Opera/Kestrel, you’ll notice the typefaces (fonts, as colloquialized) are <em>very</em> non-standard. (As of this writing, I’m using <a href='http://www.josbuivenga.demon.nl/museo.html' title='Jos Buivenga'>Museo</a> and <a href='http://www.josbuivenga.demon.nl/diavlo.html' title='Jos Buivenga'>Diavlo</a> heavily on both.)</p>
|
||||
|
||||
<p>The internet has not be a friendly place for typohiles like myself, up to this point, at least. One might even say it was a frightful, mentally scarring environment for those akin to yours truly. We’ve been restricted to reading page after page after page on day after day after day for year after year after year abominations of markup and design enslaved by the horrible overlords we know as Lucida, Verdana, Arial, Helvetica, Geneva, Georgia, Courier, and… dare I invoke ye, thou my terrible overlord? Times New Roman.</p>
|
||||
|
||||
<p>Wherefore art thou, my glorious Archer? And thee as well, my beautiful Garamond? The technical restrictions of that horrible monster we know as the Web Browser hath forced us all too long to use those most banal, those most common, and those most abused, out of all of the typefaces of the world.</p>
|
||||
|
||||
<p>All hyperbole aside, I’m extremely happy to see the advent of a standard <code>@font-face</code> declaration in <abbr title='Cascading Style Sheets'>CSS</abbr>. Internet Explorer first implemented a crutched, basic version of this way back in version 4, but nothing ever really came of it - their decision to create the proprietary <abbr title='Embedded OpenType'>.EOT</abbr> format to appease overly restrictive type foundries’ worries about intellectual property (aka. the cold, hard dominatrix that we know only as Ms. Profit) truly and completely killed that initial attempt at bringing astute typography and it’s advocates to the web. This new run at <code>@font-face</code> by an established, trusted, and open group (the <a href='http://w3c.org' title='World Wide Web Consortium'><abbr title='World Wide Web Consortium'>W3C</abbr></a> itself, responsible for helping to make much of what we use as designers on the web standard and cross-system compatible) has a much better chance, in my humble opinion - and I am quite looking forward to the consequences if it succeeds.</p>
|
||||
|
||||
<p>Now, onwards to the topic of my post as declared in the header (yes, I know, a slow start - but it’s an interesting topic with an interesting history!). WebKit, the open source rendering engine behind the wonderfulness that is Safari, and how it handles the ‘new’ <code>@font-face</code> declaration. No, it’s not really ‘new’, but yes, it feels like it is.</p>
|
||||
|
||||
<p>To put it simply, and to be very blunt, it’s broken.</p>
|
||||
|
||||
<p>The <a href='http://?'><abbr title='Cascading Style Sheets'>CSS</abbr> spec section</a> for <code>@font-face</code> is very specific - typefaces are to be selected based on a wide array of criteria placed in the <code>@font-face</code> declaration block itself. Various textual <abbr title='Cascading Style Sheets'>CSS</abbr> attributes may be defined within the <code>@font-face</code> declaration, and then they will be checked when the typeface is referred to later in the <abbr title='Cascading Style Sheets'>CSS</abbr>. For instance, if I have two <code>@font-face</code> declarations for the Diavlo family - one for regular text, and one for a heavier weighted version of the typeface - then I later utilize Diavlo in a <code>font-family:</code> attribute, it should refer to the basic Diavlo font defined in the first <code>@font-face</code>. However, if I were to do the same, but also specify a heavy <code>font-weight:</code>, then it should use the heavier version of Diavlo. To place this example in code:</p>
|
||||
|
||||
<pre><code>@font-face {
|
||||
font-family: 'Diavlo';
|
||||
src: url(./Diavlo/Diavlo_Book.otf) format("opentype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Diavlo';
|
||||
font-weight: 900;
|
||||
src: url(./Diavlo/Diavlo_Black.otf) format("opentype");
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: 'Diavlo';
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
div#content {
|
||||
font-family: 'Diavlo';
|
||||
}</code></pre>
|
||||
|
||||
<p>As you can see, my headings should use the typeface defined in <code>Diavlo_Black.otf</code>, while my body content should use <code>Diavlo_Book.otf</code>. However, in WebKit, this doesn’t work - it completely ignores any attribute except <code>font-family:</code> and <code>src:</code> in a <code>@font-face</code> declaration! Completely ignores them! Not only that - not <em>only</em> that - it disregards all but the last <code>@font-face</code> for a given <code>font-family:</code> attribute string!</p>
|
||||
|
||||
<p>The implication here is that, to make <code>@font-face</code> work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare <em>completely imaginary, non-existent type families</em> to satisfy WebKit alone. Here’s the method I have used in the places I current implement <code>@font-face</code>:</p>
|
||||
|
||||
<pre><code>@font-face {
|
||||
font-family: 'Diavlo Book';
|
||||
src: url(./Diavlo/Diavlo_Book.otf) format("opentype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Diavlo Black';
|
||||
src: url(./Diavlo/Diavlo_Black.otf) format("opentype");
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: 'Diavlo Black';
|
||||
}
|
||||
|
||||
div#content {
|
||||
font-family: 'Diavlo Book';
|
||||
}</code></pre>
|
||||
|
||||
<p>Isn’t it horrible? Seriously, my eyes, they bleed. There’s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names… let me see how many ways this breaks the purpose of <code>@font-face</code>:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>You remove a large element our control over the display of the page.</p>
|
||||
|
||||
<p>As soon as we begin to use <code>@font-face</code> in our page, we can no longer make any use of any other textual control attribute - <code>font-weight:</code>, <code>font-style:</code>, and <code>font-variant:</code> are no longer available to us, because they no longer correctly map to technical typeface variant/features.</p>
|
||||
|
||||
<p>Also, many default elements are destroyed, unusable, without ‘fixing’ - for instance, <code><b></code> would have no effect in a page styled for WebKit as above; We would have to specify something like <code>b {font-family: 'Diavlo Black';}</code> - how broken is that? Unless we caught all such default elements and re-styled them to use the bastardized names instead of the correct attributes, lots of basic HTML formatting would be broken. I myself may never use in-document formatting (separation of design and content!), but what about comments forms? Forum posts? Direct HTML-literal quotes?</p>
|
||||
|
||||
<p>If we want to use Javascript to modify the display of the content, we can’t simply adjust the mentioned textual control attributes - we have to know and change the entire <code>font-family:</code> array of strings.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>You make us very wet.</p>
|
||||
|
||||
<p>And by wet, I mean ‘not <abbr title='Don't Repeat Yourself'>DRY</abbr>’. What if we decide to change one of the bastardized font names? Or use a different font entirely? We have to go through all of our <abbr title='Cascading Style Sheets'>CSS</abbr>, all of our Javascript, and make sure we update every occurrence of the typeface’s bastardized name.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>You remove our user’s user choice, and waste bandwidth.</p>
|
||||
|
||||
<p>Since the names refer to families that don’t, in fact, exist, the browser can’t override the declaration with a user’s installed version of the typeface. This means that, regardless of whether the user already has the typeface installed on their own computer, the browser won’t use that - it doesn’t know to use ‘Diavlo’, which the user has installed, because it was told to use ‘Diavlo Black’, which no user in the entire world has installed on their computer.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>This whole thing is rather worrying - I’ve heard Opera has <code>@font-face</code> support, though I haven’t had time to test this myself, so I don’t know if it actually does - or, for that matter, if it does it ‘correctly’, or has the same problems as WebKit. But either way, WebKit is one of the first two implementations to ever attempt to support <code>@font-face</code> (Microsoft’s unrelated <code>@font-face</code> declaration notwithstanding) - I really don’t want to see it’s early mistakes carried on to FireFox in a few years, and then Internet Explorer a few decades after that. That will leave us stuck with this broken system forever, as it has been demonstrated time and time again that if nobody else supports an old standard correctly, a newcomer to the standard will not do it correctly either. I for one would really, really, hate that.</p>
|
||||
|
||||
<p>In summary… come on, WebKit team, this isn’t like you - you’re always the ones with the closest-to-standard implementation, and the cleanest code, and… hell, overall? Webkit is the most secure/fastest browser available. But this is making me lose my faith in you, guys, please get it right. You’re pioneering a leap into the future when it comes to the Web - this is as important, or <em>more</em> important, than Mosiac’s allowing of images was.</p>
|
||||
|
||||
<p>To put it succinctly - don’t fuck this up, y’all.</p>
|
||||
<div class='footnotes'><hr /><ol><li id='fn:1'>
|
||||
<p>These are fonts by <a href='jos'>Jos Buivenga</a>, quite the amazing person. His (free) fonts are, uniquely, released for use on the web in <code>@font-face</code> declarations - unlike the vast majority of other (even free to download) typefaces, which have ridiculously restricting licenses and terms of use statements. Props, Jos - you’re a pioneer, and deserve recognition as such.</p>
|
||||
<a href='#fnref:1' rev='footnote'>↩</a></li><li id='fn:2'>
|
||||
<p>To give Microsoft a little credit, something I rarely do… Yes, I’m aware Microsoft submitted EOT to the <abbr title='World Wide Web Consortium'>W3C</abbr> as a proposal - the problem isn’t with their attempts to make it non-proprietary, but with the basic concept of making typefaces on the web DRMed. Look what such attempts have done to the music and video industry - simply decimated it. Do we really want to see the same thing happen to our beloved medium as typography moves into the 21st century?</p>
|
||||
<a href='#fnref:2' rev='footnote'>↩</a></li></ol></div></body></html>
|
1388
vendor/plugins/maruku/tests/unittest/red_tests/abbrev.md
vendored
Normal file
1388
vendor/plugins/maruku/tests/unittest/red_tests/abbrev.md
vendored
Normal file
File diff suppressed because one or more lines are too long
15
vendor/plugins/maruku/tests/unittest/red_tests/xml.html
vendored
Normal file
15
vendor/plugins/maruku/tests/unittest/red_tests/xml.html
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC
|
||||
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
||||
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||
<body><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>REXML could not parse this XML/HTML:
|
||||
<svg:svg/></pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>REXML could not parse this XML/HTML:
|
||||
<svg:svg
|
||||
width="600px" height="400px">
|
||||
<svg:g id="group">
|
||||
<svg:circle id="circ1" r="1cm" cx="3cm" cy="3cm" style="fill:red;"></svg:circle>
|
||||
<svg:circle id="circ2" r="1cm" cx="7cm" cy="3cm" style="fill:red;" />
|
||||
</svg:g>
|
||||
</svg:svg></pre></body></html>
|
70
vendor/plugins/maruku/tests/unittest/red_tests/xml.md
vendored
Normal file
70
vendor/plugins/maruku/tests/unittest/red_tests/xml.md
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
Write a comment here
|
||||
*** Parameters: ***
|
||||
{:on_error=>:raise}
|
||||
*** Markdown input: ***
|
||||
|
||||
<img/>
|
||||
|
||||
<svg:svg/>
|
||||
|
||||
<svg:svg
|
||||
width="600px" height="400px">
|
||||
<svg:g id="group">
|
||||
<svg:circle id="circ1" r="1cm" cx="3cm" cy="3cm" style="fill:red;"></svg:circle>
|
||||
<svg:circle id="circ2" r="1cm" cx="7cm" cy="3cm" style="fill:red;" />
|
||||
</svg:g>
|
||||
</svg:svg>
|
||||
|
||||
*** Output of inspect ***
|
||||
md_el(:document,[
|
||||
md_html("<svg:svg/>"),
|
||||
md_html("<svg:svg \nwidth=\"600px\" height=\"400px\">\n <svg:g id=\"group\">\n\t<svg:circle id=\"circ1\" r=\"1cm\" cx=\"3cm\" cy=\"3cm\" style=\"fill:red;\"></svg:circle>\n\t<svg:circle id=\"circ2\" r=\"1cm\" cx=\"7cm\" cy=\"3cm\" style=\"fill:red;\" />\n </svg:g>\n</svg:svg>")
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
<svg:svg /><svg:svg height='400px' width='600px'>
|
||||
<svg:g id='group'>
|
||||
<svg:circle cy='3cm' id='circ1' r='1cm' cx='3cm' style='fill:red;' />
|
||||
<svg:circle cy='3cm' id='circ2' r='1cm' cx='7cm' style='fill:red;' />
|
||||
</svg:g>
|
||||
</svg:svg>
|
||||
*** Output of to_latex ***
|
||||
|
||||
*** Output of to_md ***
|
||||
|
||||
*** Output of to_s ***
|
||||
|
||||
*** EOF ***
|
||||
|
||||
|
||||
|
||||
|
||||
Failed tests: [:inspect, :to_html]
|
||||
|
||||
*** Output of inspect ***
|
||||
-----| WARNING | -----
|
||||
md_el(:document,[
|
||||
md_html("<img />"),
|
||||
md_html("<svg:svg/>"),
|
||||
md_html("<svg:svg \nwidth=\"600px\" height=\"400px\">\n <svg:g id=\"group\">\n\t<svg:circle id=\"circ1\" r=\"1cm\" cx=\"3cm\" cy=\"3cm\" style=\"fill:red;\"></svg:circle>\n\t<svg:circle id=\"circ2\" r=\"1cm\" cx=\"7cm\" cy=\"3cm\" style=\"fill:red;\" />\n </svg:g>\n</svg:svg>")
|
||||
],{},[])
|
||||
*** Output of to_html ***
|
||||
-----| WARNING | -----
|
||||
<img /><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>REXML could not parse this XML/HTML:
|
||||
<svg:svg/></pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>REXML could not parse this XML/HTML:
|
||||
<svg:svg
|
||||
width="600px" height="400px">
|
||||
<svg:g id="group">
|
||||
<svg:circle id="circ1" r="1cm" cx="3cm" cy="3cm" style="fill:red;"></svg:circle>
|
||||
<svg:circle id="circ2" r="1cm" cx="7cm" cy="3cm" style="fill:red;" />
|
||||
</svg:g>
|
||||
</svg:svg></pre>
|
||||
*** Output of to_latex ***
|
||||
|
||||
*** Output of to_md ***
|
||||
|
||||
*** Output of to_s ***
|
||||
|
||||
*** Output of Markdown.pl ***
|
||||
(not used anymore)
|
||||
*** Output of Markdown.pl (parsed) ***
|
||||
(not used anymore)
|
Loading…
Reference in a new issue