title: Sphinx variable substitution in code blocks
body: <p>Using Sphinx 1.2.3 and given this RST snippet:</p>
  
  <pre><code>.. code-block:: xml
  
      &lt;foo&gt;
          &lt;bar&gt;|version|&lt;/bar&gt;
      &lt;/foo&gt;
  </code></pre>
  
  <p>and in <code>conf.py</code> I have:</p>
  
  <pre><code>version = '1.0.2'
  </code></pre>
  
  <p>How do you ensure that the above RST snippet renders as:</p>
  
  <pre><code>&lt;foo&gt;
      &lt;bar&gt;1.0.2&lt;/bar&gt;
  &lt;/foo&gt;
  </code></pre>
  
  <p>This <a href="https://stackoverflow.com/questions/8821511/substitutions-in-sphinx-code-blocks">previous question</a> indicates that we should use <code>.. parsed-literal::</code> instead of <code>.. code-block::</code>, but that does not work, nor does the referenced link in that question work either.</p>
  
  <p>I also want to retain syntax highlighting.</p>