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

This commit is contained in:
Jacques Distler 2009-05-13 01:31:28 -05:00
commit 9e4e565221
20 changed files with 1725 additions and 136 deletions

View file

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

View file

@ -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('&','&amp;')
tex = tex.escapeHTML
mathml = "<code>#{tex}</code>"
return Document.new(mathml).root
end

View file

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

View file

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

View file

@ -19,7 +19,7 @@
#++
module MaRuKu
Version = '0.5.9'
Version = '0.6.0'
MarukuURL = 'http://maruku.rubyforge.org/'

View file

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

View file

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

View file

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

View file

@ -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:
&lt;table&gt;
&lt;td markdown=&quot;1&quot;&gt;This is *true* markdown text. (no par)&lt;/td&gt;
&lt;td markdown=&quot;block&quot;&gt;This is *true* markdown text. (par)&lt;/td&gt;
&lt;/tr&gt;</pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
&lt;/table&gt;</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 ***

View file

@ -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'>&#098;&#105;&#108;&#108;&#064;&#103;&#111;&#111;&#103;&#108;&#101;&#046;&#099;&#111;&#109;</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 ***

View file

@ -1,4 +1,4 @@
Write a comment abouth the test here.
This should not trigger the list
*** Parameters: ***
{}
*** Markdown input: ***

View file

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

View file

@ -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&#8217;s it, nothing else is supported.</p>

View file

@ -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>&alpha;</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>&alpha;</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>&beta;</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>&gamma;</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>&alpha;</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>&alpha;</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>&beta;</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>&gamma;</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)

View file

@ -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>&alpha;</mi></math><thead>
<td><math class='maruku-mathml' display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&beta;</mi></math></td>
</thead>
</table>
*** Output of to_latex ***

View file

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

View 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&#8217;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&#8217;re using Safari/WebKit or Opera/Kestrel, you&#8217;ll notice the typefaces (fonts, as colloquialized) are <em>very</em> non-standard. (As of this writing, I&#8217;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&#8217;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&#8230; 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&#8217;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&#8217; 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&#8217;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&#8217;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 &#8216;new&#8217; <code>@font-face</code> declaration. No, it&#8217;s not really &#8216;new&#8217;, but yes, it feels like it is.</p>
<p>To put it simply, and to be very blunt, it&#8217;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: &#39;Diavlo&#39;;
src: url(./Diavlo/Diavlo_Book.otf) format(&quot;opentype&quot;);
}
@font-face {
font-family: &#39;Diavlo&#39;;
font-weight: 900;
src: url(./Diavlo/Diavlo_Black.otf) format(&quot;opentype&quot;);
}
h1, h2, h3, h4, h5, h6 {
font-family: &#39;Diavlo&#39;;
font-weight: 900;
}
div#content {
font-family: &#39;Diavlo&#39;;
}</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&#8217;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&#8217;s the method I have used in the places I current implement <code>@font-face</code>:</p>
<pre><code>@font-face {
font-family: &#39;Diavlo Book&#39;;
src: url(./Diavlo/Diavlo_Book.otf) format(&quot;opentype&quot;);
}
@font-face {
font-family: &#39;Diavlo Black&#39;;
src: url(./Diavlo/Diavlo_Black.otf) format(&quot;opentype&quot;);
}
h1, h2, h3, h4, h5, h6 {
font-family: &#39;Diavlo Black&#39;;
}
div#content {
font-family: &#39;Diavlo Book&#39;;
}</code></pre>
<p>Isn&#8217;t it horrible? Seriously, my eyes, they bleed. There&#8217;s lots of problems with this far beyond the lack of semanticity when it comes to the typeface names&#8230; 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 &#8216;fixing&#8217; - for instance, <code>&lt;b&gt;</code> would have no effect in a page styled for WebKit as above; We would have to specify something like <code>b {font-family: &#39;Diavlo Black&#39;;}</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&#8217;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 &#8216;not <abbr title='Don&apos;t Repeat Yourself'>DRY</abbr>&#8217;. 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&#8217;s bastardized name.</p>
</li>
<li>
<p>You remove our user&#8217;s user choice, and waste bandwidth.</p>
<p>Since the names refer to families that don&#8217;t, in fact, exist, the browser can&#8217;t override the declaration with a user&#8217;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&#8217;t use that - it doesn&#8217;t know to use &#8216;Diavlo&#8217;, which the user has installed, because it was told to use &#8216;Diavlo Black&#8217;, which no user in the entire world has installed on their computer.</p>
</li>
</ul>
<p>This whole thing is rather worrying - I&#8217;ve heard Opera has <code>@font-face</code> support, though I haven&#8217;t had time to test this myself, so I don&#8217;t know if it actually does - or, for that matter, if it does it &#8216;correctly&#8217;, 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&#8217;s unrelated <code>@font-face</code> declaration notwithstanding) - I really don&#8217;t want to see it&#8217;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&#8230; come on, WebKit team, this isn&#8217;t like you - you&#8217;re always the ones with the closest-to-standard implementation, and the cleanest code, and&#8230; 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&#8217;re pioneering a leap into the future when it comes to the Web - this is as important, or <em>more</em> important, than Mosiac&#8217;s allowing of images was.</p>
<p>To put it succinctly - don&#8217;t fuck this up, y&#8217;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&#8217;re a pioneer, and deserve recognition as such.</p>
<a href='#fnref:1' rev='footnote'>&#8617;</a></li><li id='fn:2'>
<p>To give Microsoft a little credit, something I rarely do&#8230; Yes, I&#8217;m aware Microsoft submitted EOT to the <abbr title='World Wide Web Consortium'>W3C</abbr> as a proposal - the problem isn&#8217;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'>&#8617;</a></li></ol></div></body></html>

File diff suppressed because one or more lines are too long

View 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:
&lt;svg:svg/&gt;</pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>REXML could not parse this XML/HTML:
&lt;svg:svg
width=&quot;600px&quot; height=&quot;400px&quot;&gt;
&lt;svg:g id=&quot;group&quot;&gt;
&lt;svg:circle id=&quot;circ1&quot; r=&quot;1cm&quot; cx=&quot;3cm&quot; cy=&quot;3cm&quot; style=&quot;fill:red;&quot;&gt;&lt;/svg:circle&gt;
&lt;svg:circle id=&quot;circ2&quot; r=&quot;1cm&quot; cx=&quot;7cm&quot; cy=&quot;3cm&quot; style=&quot;fill:red;&quot; /&gt;
&lt;/svg:g&gt;
&lt;/svg:svg&gt;</pre></body></html>

View 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:
&lt;svg:svg/&gt;</pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>REXML could not parse this XML/HTML:
&lt;svg:svg
width=&quot;600px&quot; height=&quot;400px&quot;&gt;
&lt;svg:g id=&quot;group&quot;&gt;
&lt;svg:circle id=&quot;circ1&quot; r=&quot;1cm&quot; cx=&quot;3cm&quot; cy=&quot;3cm&quot; style=&quot;fill:red;&quot;&gt;&lt;/svg:circle&gt;
&lt;svg:circle id=&quot;circ2&quot; r=&quot;1cm&quot; cx=&quot;7cm&quot; cy=&quot;3cm&quot; style=&quot;fill:red;&quot; /&gt;
&lt;/svg:g&gt;
&lt;/svg:svg&gt;</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)