<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://www.takashilawson.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://www.takashilawson.com/" rel="alternate" type="text/html" /><updated>2026-03-20T15:18:54+00:00</updated><id>https://www.takashilawson.com/feed.xml</id><title type="html">Dr Takashi Lawson</title><subtitle>Website of Dr Takashi Lawson.</subtitle><author><name>Takashi Lawson</name></author><entry><title type="html">Edge Case: Invalid syntax highlight languages</title><link href="https://www.takashilawson.com/docs/edge%20case/edge-case-broken-highlighting/" rel="alternate" type="text/html" title="Edge Case: Invalid syntax highlight languages" /><published>2009-10-06T00:00:00+00:00</published><updated>2009-10-06T00:00:00+00:00</updated><id>https://www.takashilawson.com/docs/edge%20case/edge-case-broken-highlighting</id><content type="html" xml:base="https://www.takashilawson.com/docs/edge%20case/edge-case-broken-highlighting/"><![CDATA[<p>Good highlighting:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">str</span> <span class="o">=</span> <span class="no">ARGV</span><span class="p">.</span><span class="nf">first</span>
<span class="k">if</span> <span class="n">str</span>
  <span class="n">str</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">b</span><span class="p">[</span><span class="sr">/\A_(.*)_\z/</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
  <span class="k">if</span> <span class="n">str</span> <span class="n">and</span> <span class="no">Gem</span><span class="o">::</span><span class="no">Version</span><span class="p">.</span><span class="nf">correct?</span><span class="p">(</span><span class="n">str</span><span class="p">)</span>
    <span class="n">version</span> <span class="o">=</span> <span class="n">str</span>
    <span class="no">ARGV</span><span class="p">.</span><span class="nf">shift</span>
  <span class="k">end</span>
<span class="k">end</span>
</code></pre></div></div>

<p>Good (but dumb) highlighting:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>str = ARGV.first
if str
  str = str.b[/\A_(.*)_\z/, 1]
  if str and Gem::Version.correct?(str)
    version = str
    ARGV.shift
  end
end
</code></pre></div></div>

<p>Bad highlighting:</p>

<pre><code class="language-invalid">str = ARGV.first
if str
  str = str.b[/\A_(.*)_\z/, 1]
  if str and Gem::Version.correct?(str)
    version = str
    ARGV.shift
  end
end
</code></pre>]]></content><author><name>Takashi Lawson</name></author><category term="docs" /><category term="Edge Case" /><category term="content" /><category term="css" /><category term="edge case" /><summary type="html"><![CDATA[Good highlighting:]]></summary></entry></feed>