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

master
Jacques Distler 2011-08-27 09:45:27 -05:00
commit c5a2e325c0
21 changed files with 149 additions and 84 deletions

View File

@ -45,7 +45,7 @@ class PageRendererTest < ActiveSupport::TestCase
end
def test_wiki_links_after_empty
assert_markup_parsed_as(%{<code/>\n<p>This is a <span class='newWikiWord'>wikilink<a href=} +
assert_markup_parsed_as(%{<code></code>\n<p>This is a <span class='newWikiWord'>wikilink<a href=} +
%{'../show/wikilink'>?</a></span>.</p>},
"<code></code>\n\nThis is a [[wikilink]].")
end
@ -55,7 +55,7 @@ class PageRendererTest < ActiveSupport::TestCase
"would be <a class='existingWikiWord' href='../show/MyWay'>My Way</a> " +
"<math class='maruku-mathml' display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>" +
"<mi>sin</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><semantics>" +
"<annotation-xml encoding='SVG1.1'><svg/></annotation-xml></semantics></math> in kinda " +
"<annotation-xml encoding='SVG1.1'><svg></svg></annotation-xml></semantics></math> in kinda " +
"<a class='existingWikiWord' href='../show/ThatWay'>That Way</a> in " +
"<span class='newWikiWord'>His Way<a href='../show/HisWay'>?</a></span> " +
%{though <a class='existingWikiWord' href='../show/MyWay'>My Way</a> OverThere \342\200\223 see } +
@ -164,7 +164,7 @@ END_THM
%{<div class='maruku-equation'><math class='maruku-mathml' display='block' } +
%{xmlns='http://www.w3.org/1998/Math/MathML'><mi>sin</mi><mo stretchy='false'>} +
%{(</mo><mi>x</mi><mo stretchy='false'>)</mo><semantics><annotation-xml encoding='SVG1.1'>} +
%{<svg/></annotation-xml></semantics></math><span class='maruku-eq-tex'><code style='display: none;'>} +
%{<svg></svg></annotation-xml></semantics></math><span class='maruku-eq-tex'><code style='display: none;'>} +
%{\\sin(x) \\begin{svg}&lt;svg/&gt;\\end{svg}</code></span></div>},
"$$\\sin(x) \\begin{svg}<svg/>\\end{svg}$$")
@ -601,7 +601,7 @@ END_THM
# currently, upper case HTML elements are not allowed
assert_markup_parsed_as(
"<p>This &lt;IMG SRC='http://hobix.com/sample.jpg' alt=''/&gt; is an inline image link.</p>",
"<p>This &lt;IMG SRC='http://hobix.com/sample.jpg' alt=''&gt;&lt;/IMG&gt; is an inline image link.</p>",
'This <IMG SRC="http://hobix.com/sample.jpg" alt="" /> is an inline image link.')
end
@ -659,7 +659,7 @@ END_THM
"<a class='existingWikiWord' href='MyWay.html'>My Way</a> " +
"<math class='maruku-mathml' display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>" +
"<mi>sin</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><semantics>" +
"<annotation-xml encoding='SVG1.1'><svg/></annotation-xml></semantics></math> in kinda " +
"<annotation-xml encoding='SVG1.1'><svg></svg></annotation-xml></semantics></math> in kinda " +
"<a class='existingWikiWord' href='ThatWay.html'>That Way</a> in " +
"<span class='newWikiWord'>His Way</span> though " +
%{<a class='existingWikiWord' href='MyWay.html'>My Way</a> OverThere \342\200\223 see } +

View File

@ -107,14 +107,14 @@ require 'maruku/string_utils'
end
if (content_only)
xml = body.to_xml(:indent => (context[:indent] || 2), :save_with => 2 )
xml = body.to_xml(:indent => (context[:indent] || 2), :save_with => 18 )
else
doc2 = Nokogiri::XML::Document.parse("<div>"+S5_external+"</div>")
doc2.root.children.each{ |child| head << child }
add_css_to(head)
xml = html.to_xml(:indent => (context[:indent] || 2), :save_with => 2 )
xml = html.to_xml(:indent => (context[:indent] || 2), :save_with => 18 )
Xhtml11_mathml2_svg11 + xml
end
end

View File

@ -46,7 +46,7 @@ module MaRuKu; module Out; module HTML
d.root << render_footnotes
end
xml = d.to_xml(:indent => (context[:indent] || 2), :save_with => 2 )
xml = d.to_xml(:indent => (context[:indent] || 2), :save_with => 18 )
xml.gsub!(/\A<dummy>\s*|\s*<\/dummy>\s*\Z|\A<dummy\s*\/>/,'')
xml
@ -59,7 +59,7 @@ module MaRuKu; module Out; module HTML
doc = to_html_document_tree
xml = ""
xml = doc.to_xml(:indent => (context[:indent] || 2), :save_with => 2 )
xml = doc.to_xml(:indent => (context[:indent] || 2), :save_with => 18 )
Xhtml11_mathml2_svg11 + xml
end

View File

@ -8,7 +8,7 @@ Write a comment here
*** Output of inspect ***
md_el(:document,[md_par([md_im_image(["bar"], "/foo.jpg", nil)])],{},[])
*** Output of to_html ***
<p><img src="/foo.jpg" alt="bar"/></p>
<p><img src="/foo.jpg" alt="bar" /></p>
*** Output of to_latex ***
*** Output of to_md ***

View File

@ -57,7 +57,7 @@ md_el(:document,[
<p>That&#8217;s some text with a footnote <sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> and another <sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup> and another <sup id="fnref:3"><a href="#fn:3" rel="footnote">3</a></sup>.</p>
<p>This is not a footnote.</p>
<div class="footnotes"><hr/><ol><li id="fn:1">
<div class="footnotes"><hr /><ol><li id="fn:1">
<p>And that&#8217;s the footnote. This is second sentence (same paragraph). <a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li><li id="fn:2">
<p>This is the very long one.</p>

View File

@ -22,7 +22,7 @@ md_el(:document,[
md_el(:hrule,[],{},[])
],{},[])
*** Output of to_html ***
<hr/><hr/><hr/><hr/><hr/>
<hr /><hr /><hr /><hr /><hr />
*** Output of to_latex ***
\vspace{.5em} \hrule \vspace{.5em}

View File

@ -12,8 +12,8 @@ md_el(:document,[
md_html("<div></div>")
],{},[])
*** Output of to_html ***
<p>One <div/>123</p>
<div/>
<p>One <div></div>123</p>
<div></div>
*** Output of to_latex ***
One 123
*** Output of to_md ***

View File

@ -15,7 +15,7 @@ md_el(:document,[
],{},[])
*** Output of to_html ***
<div class="frame">
<a class="photo" href="http://www.flickr.com/photos/censi/54757256/"><img alt="" moz-do-not-send="true" src="http://static.flickr.com/27/54757256_1a2c1d2a95_m.jpg"/></a>
<a class="photo" href="http://www.flickr.com/photos/censi/54757256/"><img alt="" moz-do-not-send="true" src="http://static.flickr.com/27/54757256_1a2c1d2a95_m.jpg" /></a>
</div>
*** Output of to_latex ***

View File

@ -13,7 +13,7 @@ md_el(:document,[
],{},[])
*** Output of to_html ***
<div class="frame">
<a class="photo" href="http://www.flickr.com/photos/censi/88561568/"><img moz-do-not-send="true" src="http://static.flickr.com/28/88561568_ab84d28245_m.jpg" width="240" height="180" alt="Aperitif"/></a>
<a class="photo" href="http://www.flickr.com/photos/censi/88561568/"><img moz-do-not-send="true" src="http://static.flickr.com/28/88561568_ab84d28245_m.jpg" width="240" height="180" alt="Aperitif" /></a>
</div>
*** Output of to_latex ***

View File

@ -31,11 +31,11 @@ md_el(:document,[
<pre><code>&lt;p&gt;here's an apostrophe &amp; a quote "&lt;/p&gt;</code></pre>
<pre class="xml"><code lang="xml"><span class="punct">&lt;</span><span class="tag">p</span><span class="punct">&gt;</span>here's an apostrophe &amp; a quote "<span class="punct">&lt;/</span><span class="tag">p</span><span class="punct">&gt;</span></code></pre>
<pre class="xml"><code lang="xml" xml:lang="xml"><span class="punct">&lt;</span><span class="tag">p</span><span class="punct">&gt;</span>here's an apostrophe &amp; a quote "<span class="punct">&lt;/</span><span class="tag">p</span><span class="punct">&gt;</span></code></pre>
<pre class="not_supported"><code lang="not_supported">&lt;p&gt;here's an apostrophe &amp; a quote "&lt;/p&gt;</code></pre>
<pre class="not_supported"><code lang="not_supported" xml:lang="not_supported">&lt;p&gt;here's an apostrophe &amp; a quote "&lt;/p&gt;</code></pre>
<pre class="xml"><code lang="xml"><span class="punct">&lt;</span><span class="tag">p</span><span class="punct">&gt;</span>here's an apostrophe &amp; a quote "<span class="punct">&lt;/</span><span class="tag">p</span><span class="punct">&gt;</span></code></pre>
<pre class="xml"><code lang="xml" xml:lang="xml"><span class="punct">&lt;</span><span class="tag">p</span><span class="punct">&gt;</span>here's an apostrophe &amp; a quote "<span class="punct">&lt;/</span><span class="tag">p</span><span class="punct">&gt;</span></code></pre>
*** Output of to_latex ***
{\colorbox[rgb]{1.00,0.93,1.00}{\tt \char60p\char62here\char39s~an~apostrophe~\char38~a~quote~\char34\char60\char47p\char62}}

View File

@ -52,15 +52,15 @@ md_el(:document,[
md_ref_def("css2", "http://jigsaw.w3.org/css-validator/images/vcss", {:title=>"Optional title attribute"})
],{},[])
*** Output of to_html ***
<p>This page does not utilize <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets"/></p>
<p>This page does not utilize <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" /></p>
<p>Please mouseover to see the title: <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" title="Title ok!"/></p>
<p>Please mouseover to see the title: <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" title="Title ok!" /></p>
<p>Please mouseover to see the title: <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" title="Title ok!"/></p>
<p>Please mouseover to see the title: <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" title="Title ok!" /></p>
<p>I&#8217;ll say it one more time: this page does not use <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" title="Optional title attribute"/></p>
<p>I&#8217;ll say it one more time: this page does not use <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" title="Optional title attribute" /></p>
<p>This is double size: <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" title="Optional title attribute"/></p>
<p>This is double size: <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Cascading Style Sheets" title="Optional title attribute" /></p>
*** Output of to_latex ***
This page does not utilize

View File

@ -16,9 +16,9 @@ md_el(:document,[
md_ref_def("image", "image.jpg", {:title=>nil})
],{},[])
*** Output of to_html ***
<p>This is an <img src="image.jpg" alt="image"/>.</p>
<p>This is an <img src="image.jpg" alt="image" />.</p>
<p>This is an <img src="image.jpg" alt="image"/>.</p>
<p>This is an <img src="image.jpg" alt="image" />.</p>
*** Output of to_latex ***
This is an .

View File

@ -73,12 +73,12 @@ md_el(:document,[
<pre><code>&lt;img src="http://jigsaw.w3.org/css-validator/images/vcss"/&gt;</code></pre>
<p>Result on span: <img src="http://jigsaw.w3.org/css-validator/images/vcss"/></p>
<p>Result on span: <img src="http://jigsaw.w3.org/css-validator/images/vcss" /></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>
<img src="http://jigsaw.w3.org/css-validator/images/vcss"/><div>
<img src="http://jigsaw.w3.org/css-validator/images/vcss" /><div>
<p>
<p>This is</p>
<em>

View File

@ -102,9 +102,9 @@ md_el(:document,[
<p>Paragraph (1 space after), list with no space: * ciao</p>
<p>Paragraph (2 spaces after), list with no space:<br/>* ciao</p>
<p>Paragraph (2 spaces after), list with no space:<br />* ciao</p>
<p>Paragraph (3 spaces after), list with no space: <br/>* ciao</p>
<p>Paragraph (3 spaces after), list with no space: <br />* ciao</p>
<p>Paragraph with block quote:</p>
@ -120,7 +120,7 @@ md_el(:document,[
<h2 id="header_2">header</h2>
<p>Paragraph with html after <div/></p>
<p>Paragraph with html after <div></div></p>
<p>Paragraph with html after, indented: <em>Emphasis</em></p>

View File

@ -7,7 +7,7 @@ Write a comment here
*** Output of inspect ***
md_el(:document,[md_html("<br />")],{},[])
*** Output of to_html ***
<br/>
<br />
*** Output of to_latex ***
*** Output of to_md ***

View File

@ -74,9 +74,9 @@ md_el(:document,[
<p>Paragraph (1 space after), list with no space: * ciao</p>
<p>Paragraph (2 spaces after), list with no space:<br/>* ciao</p>
<p>Paragraph (2 spaces after), list with no space:<br />* ciao</p>
<p>Paragraph (3 spaces after), list with no space: <br/>* ciao</p>
<p>Paragraph (3 spaces after), list with no space: <br />* ciao</p>
<p>Paragraph with block quote:</p>

View File

@ -28,7 +28,7 @@ md_el(:document,[
<p>Paragraph 2</p>
<p>Paragraph 3 Paragraph 4 Paragraph Br-&gt;<br/>Paragraph 5</p>
<p>Paragraph 3 Paragraph 4 Paragraph Br-&gt;<br />Paragraph 5</p>
*** Output of to_latex ***
Paragraph 1

View File

@ -21,8 +21,8 @@ md_el(:document,[
],{:align=>[:left, :left, :left]},[])
],{},[])
*** Output of to_html ***
<table><thead><tr><th/><th>1</th><th>2</th></tr></thead><tbody><tr><td style="text-align: left;">A</td><td style="text-align: left;">X</td><td style="text-align: left;"/></tr>
<tr><td style="text-align: left;">B</td><td style="text-align: left;"/><td style="text-align: left;">X</td></tr>
<table><thead><tr><th></th><th>1</th><th>2</th></tr></thead><tbody><tr><td style="text-align: left;">A</td><td style="text-align: left;">X</td><td style="text-align: left;"></td></tr>
<tr><td style="text-align: left;">B</td><td style="text-align: left;"></td><td style="text-align: left;">X</td></tr>
</tbody></table>
*** Output of to_latex ***
\begin{tabular}{l|l|l}

View File

@ -381,40 +381,40 @@ md_el(:document,[
md_ref_def("spec", "http://?>", {:title=>") *[DRY]: Don"})
],{},[])
*** Output of to_html ***
<h1 id='webkit_safari_31_and_the_css_fontface_declaration'>WebKit (Safari 3.1) and the CSS @font-face declaration</h1>
<h1 id="webkit_safari_31_and_the_css_fontface_declaration_1">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&gt;' title='Jos Buivenga'>Museo</a> and <a href='http://www.josbuivenga.demon.nl/diavlo.html&gt;' title='Jos Buivenga'>Diavlo</a><sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup> heavily on both.)</p>
<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's Museo free typeface">Museo</a> and <a href="http://www.josbuivenga.demon.nl/diavlo.html" title="Jos Buivenga's free Diavlo typeface">Diavlo</a><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> 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 CSS. 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 .EOT<sup id='fnref:2'><a href='#fn:2' rel='footnote'>2</a></sup> 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&gt;' title='World Wide Web Consortium'>W3C</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>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><sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup> 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://?&gt;' title=') *[DRY]: Don'>CSS 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 CSS 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 CSS. 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>
<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-family: 'Diavlo';
src: url(./Diavlo/Diavlo_Book.otf) format("opentype");
}
@font-face {
font-family: &#39;Diavlo&#39;;
font-family: 'Diavlo';
font-weight: 900;
src: url(./Diavlo/Diavlo_Black.otf) format(&quot;opentype&quot;);
src: url(./Diavlo/Diavlo_Black.otf) format("opentype");
}
h1, h2, h3, h4, h5, h6 {
font-family: &#39;Diavlo&#39;;
font-family: 'Diavlo';
font-weight: 900;
}
div#content {
font-family: &#39;Diavlo&#39;;
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&#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>
@ -422,21 +422,21 @@ div#content {
<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-family: 'Diavlo Book';
src: url(./Diavlo/Diavlo_Book.otf) format("opentype");
}
@font-face {
font-family: &#39;Diavlo Black&#39;;
src: url(./Diavlo/Diavlo_Black.otf) format(&quot;opentype&quot;);
font-family: 'Diavlo Black';
src: url(./Diavlo/Diavlo_Black.otf) format("opentype");
}
h1, h2, h3, h4, h5, h6 {
font-family: &#39;Diavlo Black&#39;;
font-family: 'Diavlo Black';
}
div#content {
font-family: &#39;Diavlo Book&#39;;
font-family: 'Diavlo Book';
}</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>
@ -447,7 +447,7 @@ div#content {
<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>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: '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&#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>
@ -455,7 +455,7 @@ div#content {
<li>
<p>You make us very wet.</p>
<p>And by wet, I mean &#8216;not DRY&#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 CSS, all of our Javascript, and make sure we update every occurrence of the typeface&#8217;s bastardized name.</p>
<p>And by wet, I mean &#8216;not <abbr title="Don'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>
@ -470,32 +470,97 @@ div#content {
<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>
<p><em><span>CSS</span>: Cascading Style Sheets</em><span>.EOT</span>: Embedded OpenType <sup id='fnref:3'><a href='#fn:3' rel='footnote'>3</a></sup>: To give Microsoft a little credit, something I rarely do&#8230; Yes, I&#8217;m aware Microsoft submitted EOT to the W3C 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? <em><a href='http://w3c.org&gt;' title='World Wide Web Consortium'>W3C</a>: World Wide Web Consortium</em></p>
<div class='footnotes'><hr /><ol /></div>
<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. <a href="#fnref:1" rev="footnote">&#8617;</a></p>
</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? <a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li></ol></div>
*** Output of to_latex ***
#<NameError: undefined local variable or method `fid' for md_foot_ref("^jos"):MaRuKu::MDElement>
./lib/maruku/output/to_latex.rb:466:in `to_latex_footnote_reference'
./lib/maruku/output/to_latex.rb:538:in `send'
./lib/maruku/output/to_latex.rb:538:in `array_to_latex'
./lib/maruku/output/to_latex.rb:529:in `each'
./lib/maruku/output/to_latex.rb:529:in `array_to_latex'
./lib/maruku/output/to_latex.rb:524:in `children_to_latex'
./lib/maruku/output/to_latex.rb:158:in `to_latex_paragraph'
./lib/maruku/output/to_latex.rb:538:in `send'
./lib/maruku/output/to_latex.rb:538:in `array_to_latex'
./lib/maruku/output/to_latex.rb:529:in `each'
./lib/maruku/output/to_latex.rb:529:in `array_to_latex'
./lib/maruku/output/to_latex.rb:524:in `children_to_latex'
./lib/maruku/output/to_latex.rb:42:in `to_latex'
bin/marutest:93:in `send'
bin/marutest:93:in `run_test'
bin/marutest:88:in `each'
bin/marutest:88:in `run_test'
bin/marutest:262:in `marutest'
bin/marutest:259:in `each'
bin/marutest:259:in `marutest'
bin/marutest:334
\hypertarget{webkit_safari_31_and_the_css_fontface_declaration_1}{}\section*{{WebKit (Safari 3.1) and the CSS @font-face declaration}}\label{webkit_safari_31_and_the_css_fontface_declaration_1}
I'{}m a big fan of typography in general. If you check out \href{http://elliottcable.name}{my homepage} or my \href{http://elliottcable.name/contact.xhtml}{contact elliottcable} page, and you'{}re using Safari/WebKit or Opera/Kestrel, you'{}ll notice the typefaces (fonts, as colloquialized) are \emph{very} non-standard. (As of this writing, I'{}m using \href{http://www.josbuivenga.demon.nl/museo.html}{Museo} and \href{http://www.josbuivenga.demon.nl/diavlo.html}{Diavlo}\footnote{These are fonts by \href{jos}{Jos Buivenga}, quite the amazing person. His (free) fonts are, uniquely, released for use on the web in {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} 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.} heavily on both.)
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\ldots{} dare I invoke ye, thou my terrible overlord? Times New Roman.
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.
All hyperbole aside, I'{}m extremely happy to see the advent of a standard {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration in CSS. 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 .EOT\footnote{To give Microsoft a little credit, something I rarely do\ldots{} Yes, I'{}m aware Microsoft submitted EOT to the W3C 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?} 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 {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} by an established, trusted, and open group (the \href{http://w3c.org}{W3C} 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.
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'{} {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration. No, it'{}s not really `{}new'{}, but yes, it feels like it is.
To put it simply, and to be very blunt, it'{}s broken.
The \href{http://?}{CSS spec section} for {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} is very specific - typefaces are to be selected based on a wide array of criteria placed in the {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration block itself. Various textual CSS attributes may be defined within the {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration, and then they will be checked when the typeface is referred to later in the CSS. For instance, if I have two {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} 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 {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45family\char58}} attribute, it should refer to the basic Diavlo font defined in the first {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}}. However, if I were to do the same, but also specify a heavy {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45weight\char58}}, then it should use the heavier version of Diavlo. To place this example in code:
\begin{verbatim}@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';
}\end{verbatim}
As you can see, my headings should use the typeface defined in {\colorbox[rgb]{1.00,0.93,1.00}{\tt Diavlo\char95Black\char46otf}}, while my body content should use {\colorbox[rgb]{1.00,0.93,1.00}{\tt Diavlo\char95Book\char46otf}}. However, in WebKit, this doesn'{}t work - it completely ignores any attribute except {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45family\char58}} and {\colorbox[rgb]{1.00,0.93,1.00}{\tt src\char58}} in a {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} declaration! Completely ignores them! Not only that - not \emph{only} that - it disregards all but the last {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} for a given {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45family\char58}} attribute string!
The implication here is that, to make {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} work as it is currently implemented in WebKit (and thus, Safari 3.1), I have to declare \emph{completely imaginary, non-existent type families} to satisfy WebKit alone. Here'{}s the method I have used in the places I current implement {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}}:
\begin{verbatim}@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';
}\end{verbatim}
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\ldots{} let me see how many ways this breaks the purpose of {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}}:
\begin{itemize}%
\item You remove a large element our control over the display of the page.
As soon as we begin to use {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} in our page, we can no longer make any use of any other textual control attribute - {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45weight\char58}}, {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45style\char58}}, and {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45variant\char58}} are no longer available to us, because they no longer correctly map to technical typeface variant/features.
Also, many default elements are destroyed, unusable, without `{}fixing'{} - for instance, {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char60b\char62}} would have no effect in a page styled for WebKit as above; We would have to specify something like {\colorbox[rgb]{1.00,0.93,1.00}{\tt b\char32\char123font\char45family\char58\char32\char39Diavlo\char32Black\char39\char59\char125}} - 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?
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 {\colorbox[rgb]{1.00,0.93,1.00}{\tt font\char45family\char58}} array of strings.
\item You make us very wet.
And by wet, I mean `{}not DRY'{}. 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 CSS, all of our Javascript, and make sure we update every occurrence of the typeface'{}s bastardized name.
\item You remove our user'{}s user choice, and waste bandwidth.
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.
\end{itemize}
This whole thing is rather worrying - I'{}ve heard Opera has {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} 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 {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} (Microsoft'{}s unrelated {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char64font\char45face}} 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.
In summary\ldots{} 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\ldots{} 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 \emph{more} important, than Mosiac'{}s allowing of images was.
To put it succinctly - don'{}t fuck this up, y'{}all.
*** Output of to_md ***
WebKit (Safari 3.1) and the CSS @font-face declarationI m a big fan of typography in general.
If you check out my homepageor my

View File

@ -31,7 +31,7 @@ puts Maruku.new($stdin).to_html</code></pre>
<p>This is ruby code:</p>
<pre class="ruby"><code lang="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">maruku</span><span class="punct">'</span></code></pre>
<pre class="ruby"><code lang="ruby" xml:lang="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">maruku</span><span class="punct">'</span></code></pre>
<pre><code>puts Maruku.new($stdin).to_html</code></pre>
*** Output of to_latex ***

View File

@ -29,10 +29,10 @@ md_el(:document,[
],{},[])
],{},[])
*** Output of to_html ***
<p>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:<br/>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet.</p>
<p>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Break:<br />Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet.</p>
<ul>
<li>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:<br/>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet</li>
<li>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet Lorem ipsum Break:<br />Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet</li>
<li>Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet</li>
</ul>