<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Defective Semantics &#187; wordpress</title>
	<atom:link href="http://scarff.id.au/blog/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://scarff.id.au</link>
	<description>Dean Scarff's perpetual struggle with technology, and other anecdotes</description>
	<lastBuildDate>Thu, 03 Nov 2011 22:39:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>XHTML fixes for the WordPress reCAPTCHA plugin</title>
		<link>http://scarff.id.au/blog/2010/xhtml-fixes-for-the-wordpress-recaptcha-plugin/</link>
		<comments>http://scarff.id.au/blog/2010/xhtml-fixes-for-the-wordpress-recaptcha-plugin/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 16:01:39 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[Problems]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://scarff.id.au/?p=456</guid>
		<description><![CDATA[<p>The wp-recaptcha plugin for WordPress breaks when you&#8217;re serving pages as application/xhtml+xml.  I inadvertently broke comments when I installed it (silly me for not testing!).  I&#8217;ve written a patch that fixes it.</p>
<p>The default javascript API uses <code>document.write</code>, which isn&#8217;t a DOM method and hence is not a method of true XML documents.  It&#8217;s not a new issue either, wp-recaptcha has had a history of breaking XHTML.  The thing is, the WordPress plugin (which uses the PHP library by the recaptcha people) has an option to &#8220;Be XHTML 1.0 Strict compliant&#8221;; but this only fixes the use of iframes and noscript!</p>
<p><small class="postscript">Updated: pushed fork to github</small><br />
<span id="more-456"></span></p>
<p>Under firefox, you get an error like:</p>
<pre>
Error: uncaught exception:
[Exception... "Operation is not supported"  code: "9"
 nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)"
 location: "http://www.google.com/recaptcha/api/challenge?k=xxx Line: 12"]
</pre>
<p>While under Chrome it&#8217;s</p>
<pre>
Uncaught TypeError: Object #&#60;a Document&#62; has no method 'write'
api.recaptcha.net/challengek=xxx
</pre><p>&#8230; <a href="http://scarff.id.au/blog/2010/xhtml-fixes-for-the-wordpress-recaptcha-plugin/" class="read_more">more</a></p>]]></description>
			<content:encoded><![CDATA[<p>The wp-recaptcha plugin for WordPress breaks when you&#8217;re serving pages as application/xhtml+xml.  I inadvertently broke comments when I installed it (silly me for not testing!).  I&#8217;ve written a patch that fixes it.</p>
<p>The default javascript API uses <code>document.write</code>, which isn&#8217;t a DOM method and hence is not a method of true XML documents.  It&#8217;s not a new issue either, wp-recaptcha has had a history of <a href="http://rickardandersson.com/recaptcha-and-xhtml">breaking XHTML</a>.  The thing is, the WordPress plugin (which uses the PHP library by the recaptcha people) has an option to &#8220;Be XHTML 1.0 Strict compliant&#8221;; but this only fixes the use of iframes and noscript!</p>
<p><small class="postscript">Updated: pushed fork to github</small><br />
<span id="more-456"></span></p>
<p>Under firefox, you get an error like:</p>
<pre>
Error: uncaught exception:
[Exception... "Operation is not supported"  code: "9"
 nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)"
 location: "http://www.google.com/recaptcha/api/challenge?k=xxx Line: 12"]
</pre>
<p>While under Chrome it&#8217;s</p>
<pre>
Uncaught TypeError: Object #&lt;a Document&gt; has no method 'write'
api.recaptcha.net/challengek=xxx
</pre>
<p>The real solution is to use the <a href="http://code.google.com/apis/recaptcha/docs/display.html#AJAX">reCAPTCHA AJAX API</a>, which for whatever reason isn&#8217;t exposed in the PHP library.  You can grab my <a href="http://github.com/p00ya/wp-recaptcha">xml fix for wp-recaptcha</a> from github.</p>
]]></content:encoded>
			<wfw:commentRss>http://scarff.id.au/blog/2010/xhtml-fixes-for-the-wordpress-recaptcha-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>reStructuredText for WordPress</title>
		<link>http://scarff.id.au/blog/2008/restructuredtext-for-wordpress/</link>
		<comments>http://scarff.id.au/blog/2008/restructuredtext-for-wordpress/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 10:23:52 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[rest-wordpress]]></category>
		<category><![CDATA[reStructuredText]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scarff.id.au/8/restructuredtext-for-wordpress/</guid>
		<description><![CDATA[<p>I&#8217;ve previously mentioned how Matthew Scott&#8217;s reStructuredText for WordPress is a good hack for making wordpress usable.  However, revision 5 from the rest-wordpress bazaar repository was broken in a few ways.</p>
<p>The most annoying way was that the options I&#8217;d configured up the top of the file weren&#8217;t having the desired effect.  I wasted the better part of an hour in debugging until I recalled how horrid PHP scoping was.  It was a simple fix.</p>
<p><span id="more-8"></span></p>
<pre class="codeblock diff">
--- rest.php	2008-01-03 00:28:23 +0000
+++ rest.php	2008-02-04 09:20:59 +0000
@@ -95,6 +95,7 @@
  */
 function reST($text) {
   global $rst2html;
+  global $rst2html_options;
   global $cachedir;
   global $usepipes;
   global $tmpdir;
</pre>
<p>Additionally, the handling of wordpress &#8220;more&#8221; directives was quite fragile.  They broke with the default wordpress theme.  Matthew seems to have incorporated some of the suggestions from pupeno, but there are a few problems with that post:</p>
<ul>
<li>I think pupeno</li></ul><p>&#8230; <a href="http://scarff.id.au/blog/2008/restructuredtext-for-wordpress/" class="read_more">more</a></p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve previously mentioned how Matthew Scott&#8217;s <a href="http://goldenspud.com/rotr/index.php/2006/12/15/using-restructuredtext-with-wordpress/">reStructuredText for WordPress</a> is a good hack for <a href="/blog/2008/wordpress-it-is-sigh/">making wordpress usable</a>.  However, revision 5 from the <a href="http://bazaar.launchpad.net/~gldnspud/rest-wordpress/trunk">rest-wordpress bazaar repository</a> was broken in a few ways.</p>
<p>The most annoying way was that the options I&#8217;d configured up the top of the file weren&#8217;t having the desired effect.  I wasted the better part of an hour in debugging until I recalled how horrid PHP scoping was.  It was a simple fix.</p>
<p><span id="more-8"></span></p>
<pre class="codeblock diff">
--- rest.php	2008-01-03 00:28:23 +0000
+++ rest.php	2008-02-04 09:20:59 +0000
@@ -95,6 +95,7 @@
  */
 function reST($text) {
   global $rst2html;
+  global $rst2html_options;
   global $cachedir;
   global $usepipes;
   global $tmpdir;
</pre>
<p>Additionally, the handling of wordpress &#8220;more&#8221; directives was quite fragile.  They broke with the default wordpress theme.  Matthew seems to have incorporated some of the suggestions from <a href="http://pupeno.com/2007/01/17/rst-on-wp/">pupeno</a>, but there are a few problems with that post:</p>
<ul>
<li>I think pupeno forgot to change the <code>$prefix</code> when he wrote he was changing it for debian.</li>
<li>The suggested link processing is *way* too broad; it&#8217;s only meant to be used for &#8220;more&#8221; links, and the way it is it will clobber any linky-looking thing regardless of context.</li>
</ul>
<p>I sent a couple of patches to Matthew Scott; hopefully he&#8217;ll apply<br />
them.  In the meantime, I started my own <a href="https://code.launchpad.net/~p00ya/rest-wordpress/dos-hacks">rst-wordpress branch</a> on launchpad.</p>
<p>Despite all this, I feel a more robust solution is in order, probably involving driving docutils directly via python, and maybe even using docutil&#8217;s XML output with XSLT.</p>
]]></content:encoded>
			<wfw:commentRss>http://scarff.id.au/blog/2008/restructuredtext-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress it is *sigh*</title>
		<link>http://scarff.id.au/blog/2008/wordpress-it-is-sigh/</link>
		<comments>http://scarff.id.au/blog/2008/wordpress-it-is-sigh/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 01:46:53 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[blogware]]></category>
		<category><![CDATA[hobix]]></category>
		<category><![CDATA[reStructuredText]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scarff.id.au/?p=3</guid>
		<description><![CDATA[<p>While my search for <em>good</em> blogware has turned up the empty set, I&#8217;ve taken the easy option and gone with wordpress.</p>
<p>What did I want from my blogware?  Well:</p>
<ul>
<li>a minimal markup for inline formatting</li>
<li>the ability to copy and paste code without having to escape it or encode HTML entities</li>
<li>extending the code to be fun&#8230;</li>
</ul>
<p>The only decent markup language I&#8217;ve come across is reStructuredText, although I can tolerate mediawiki&#8217;s.  It does things <b>right</b>:</p>
<ul>
<li>the markup is pretty close to what I&#8217;d use if I was posting in plain text</li>
<li>you can escape the markup if you need to</li>
<li>you don&#8217;t need to escape literal blocks (apart from indenting them)</li>
<li>it supports higher-level things like metadata, xrefs, citations</li>
</ul>
<p>The only problem is that it&#8217;s very python-centric.  Even though it&#8217;s semi-standardised, it evolves as the docutils dev team add features to the docutils processor.  There&#8230; <a href="http://scarff.id.au/blog/2008/wordpress-it-is-sigh/" class="read_more">more</a></p>]]></description>
			<content:encoded><![CDATA[<p>While my search for <em>good</em> blogware has turned up the empty set, I&#8217;ve taken the easy option and gone with wordpress.</p>
<p>What did I want from my blogware?  Well:</p>
<ul>
<li>a minimal markup for inline formatting</li>
<li>the ability to copy and paste code without having to escape it or encode HTML entities</li>
<li>extending the code to be fun&#8230;</li>
</ul>
<p>The only decent markup language I&#8217;ve come across is <a href="http://docutils.sourceforge.net/docs/user/rst/quickref.html">reStructuredText</a>, although I can tolerate mediawiki&#8217;s.  It does things <b>right</b>:</p>
<ul>
<li>the markup is pretty close to what I&#8217;d use if I was posting in plain text</li>
<li>you can escape the markup if you need to</li>
<li>you don&#8217;t need to escape literal blocks (apart from indenting them)</li>
<li>it supports higher-level things like metadata, xrefs, citations</li>
</ul>
<p>The only problem is that it&#8217;s very python-centric.  Even though it&#8217;s semi-standardised, it evolves as the docutils dev team add features to the docutils processor.  There aren&#8217;t processors for perl, ruby or C, so it&#8217;s not the why-aren&#8217;t-we-using-this-it&#8217;ll-work-ootb solution that, say, YAML is in its domain.</p>
<p>The plugin that sealed the deal with wordpress was <a href="https://launchpad.net/rest-wordpress/">reST for wordpress</a>.  It is a hack: it calls &#8220;rst2html&#8220; and rips the body out, and recommends you turn off the &#8220;correct invalidly nested XHTML automatically&#8221; feature of wordpress (although this may be to avoid pre-processing, rather than because the rst output is broken).</p>
<p>I <em>really wanted</em> <a href="http://redcloth.org/hobix.com/">hobix</a> to work.  It wasn&#8217;t going to happen.  Apart from the markup issues, its maintenance future <a href="http://article.gmane.org/gmane.comp.web.hobix.general/419">doesn&#8217;t look bright</a>.  A bunch of stuff is broken, and from my exposure to that code base, adding my own plugins is likely to be anything but fun.</p>
<p>The motivation to post is at the critical lower bound as it is, without procrastinating about mending the posting-platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://scarff.id.au/blog/2008/wordpress-it-is-sigh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

