forked from varia/varia.website
98 lines
12 KiB
HTML
98 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="generator" content="Pelican" />
|
|
<title>Unbelievable !</title>
|
|
<link rel="stylesheet" href="/theme/css/main.css" />
|
|
<link href="/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="A Pelican Blog Atom Feed" />
|
|
<meta name="description" content="Or completely awesome. Depends the needs. a root-relative link to markdown-article a file-relative link to markdown-article Testing sourcecode..." />
|
|
</head>
|
|
|
|
<body id="index" class="home">
|
|
<header id="banner" class="body">
|
|
<h1><a href="/">A Pelican Blog</a></h1>
|
|
<nav><ul>
|
|
<li><a href="/tag/oh.html">Oh Oh Oh</a></li>
|
|
<li><a href="/override/">Override url/save_as</a></li>
|
|
<li><a href="/pages/this-is-a-test-page.html">This is a test page</a></li>
|
|
<li><a href="/category/bar.html">bar</a></li>
|
|
<li><a href="/category/cat1.html">cat1</a></li>
|
|
<li class="active"><a href="/category/misc.html">misc</a></li>
|
|
<li><a href="/category/yeah.html">yeah</a></li>
|
|
</ul></nav>
|
|
</header><!-- /#banner -->
|
|
<section id="content" class="body">
|
|
<article>
|
|
<header>
|
|
<h1 class="entry-title">
|
|
<a href="/unbelievable.html" rel="bookmark"
|
|
title="Permalink to Unbelievable !">Unbelievable !</a></h1>
|
|
</header>
|
|
|
|
<div class="entry-content">
|
|
<footer class="post-info">
|
|
<abbr class="published" title="2010-10-15T20:30:00+00:00">
|
|
Published: Fri 15 October 2010
|
|
</abbr>
|
|
|
|
<p>In <a href="/category/misc.html">misc</a>.</p>
|
|
|
|
</footer><!-- /.post-info --> <p>Or completely awesome. Depends the needs.</p>
|
|
<p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a>
|
|
<a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p>
|
|
<div class="section" id="testing-sourcecode-directive">
|
|
<h2>Testing sourcecode directive</h2>
|
|
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span>
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
<div class="section" id="testing-another-case">
|
|
<h2>Testing another case</h2>
|
|
<p>This will now have a line number in 'custom' since it's the default in
|
|
pelican.conf, it will have nothing in default.</p>
|
|
<div class="highlight"><pre><span></span><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span>
|
|
</pre></div>
|
|
<p>Lovely.</p>
|
|
</div>
|
|
<div class="section" id="testing-more-sourcecode-directives">
|
|
<h2>Testing more sourcecode directives</h2>
|
|
<div class="highlight"><pre><span></span><span id="foo-8"><a name="foo-8"></a><span class="lineno special"> 8 </span><span class="testingk">def</span> <span class="testingnf">run</span><span class="testingp">(</span><span class="testingbp">self</span><span class="testingp">):</span><br></span><span id="foo-9"><a name="foo-9"></a><span class="lineno"> </span> <span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">assert_has_content</span><span class="testingp">()</span><br></span><span id="foo-10"><a name="foo-10"></a><span class="lineno special">10 </span> <span class="testingk">try</span><span class="testingp">:</span><br></span><span id="foo-11"><a name="foo-11"></a><span class="lineno"> </span> <span class="testingn">lexer</span> <span class="testingo">=</span> <span class="testingn">get_lexer_by_name</span><span class="testingp">(</span><span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">arguments</span><span class="testingp">[</span><span class="testingmi">0</span><span class="testingp">])</span><br></span><span id="foo-12"><a name="foo-12"></a><span class="lineno special">12 </span> <span class="testingk">except</span> <span class="testingne">ValueError</span><span class="testingp">:</span><br></span><span id="foo-13"><a name="foo-13"></a><span class="lineno"> </span> <span class="testingc1"># no lexer found - use the text one instead of an exception</span><br></span><span id="foo-14"><a name="foo-14"></a><span class="lineno special">14 </span> <span class="testingn">lexer</span> <span class="testingo">=</span> <span class="testingn">TextLexer</span><span class="testingp">()</span><br></span><span id="foo-15"><a name="foo-15"></a><span class="lineno"> </span><br></span><span id="foo-16"><a name="foo-16"></a><span class="lineno special">16 </span> <span class="testingk">if</span> <span class="testingp">(</span><span class="testings1">'linenos'</span> <span class="testingow">in</span> <span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">options</span> <span class="testingow">and</span><br></span><span id="foo-17"><a name="foo-17"></a><span class="lineno"> </span> <span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">options</span><span class="testingp">[</span><span class="testings1">'linenos'</span><span class="testingp">]</span> <span class="testingow">not</span> <span class="testingow">in</span> <span class="testingp">(</span><span class="testings1">'table'</span><span class="testingp">,</span> <span class="testings1">'inline'</span><span class="testingp">)):</span><br></span><span id="foo-18"><a name="foo-18"></a><span class="lineno special">18 </span> <span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">options</span><span class="testingp">[</span><span class="testings1">'linenos'</span><span class="testingp">]</span> <span class="testingo">=</span> <span class="testings1">'table'</span><br></span><span id="foo-19"><a name="foo-19"></a><span class="lineno"> </span><br></span><span id="foo-20"><a name="foo-20"></a><span class="lineno special">20 </span> <span class="testingk">for</span> <span class="testingn">flag</span> <span class="testingow">in</span> <span class="testingp">(</span><span class="testings1">'nowrap'</span><span class="testingp">,</span> <span class="testings1">'nobackground'</span><span class="testingp">,</span> <span class="testings1">'anchorlinenos'</span><span class="testingp">):</span><br></span><span id="foo-21"><a name="foo-21"></a><span class="lineno"> </span> <span class="testingk">if</span> <span class="testingn">flag</span> <span class="testingow">in</span> <span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">options</span><span class="testingp">:</span><br></span><span id="foo-22"><a name="foo-22"></a><span class="lineno special">22 </span> <span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">options</span><span class="testingp">[</span><span class="testingn">flag</span><span class="testingp">]</span> <span class="testingo">=</span> <span class="testingkc">True</span><br></span><span id="foo-23"><a name="foo-23"></a><span class="lineno"> </span><br></span><span id="foo-24"><a name="foo-24"></a><span class="lineno special">24 </span> <span class="testingc1"># noclasses should already default to False, but just in case...</span><br></span><span id="foo-25"><a name="foo-25"></a><span class="lineno"> </span> <span class="testingn">formatter</span> <span class="testingo">=</span> <span class="testingn">HtmlFormatter</span><span class="testingp">(</span><span class="testingn">noclasses</span><span class="testingo">=</span><span class="testingkc">False</span><span class="testingp">,</span> <span class="testingo">**</span><span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">options</span><span class="testingp">)</span><br></span><span id="foo-26"><a name="foo-26"></a><span class="lineno special">26 </span> <span class="testingn">parsed</span> <span class="testingo">=</span> <span class="testingn">highlight</span><span class="testingp">(</span><span class="testings1">'</span><span class="testingse">\n</span><span class="testings1">'</span><span class="testingo">.</span><span class="testingn">join</span><span class="testingp">(</span><span class="testingbp">self</span><span class="testingo">.</span><span class="testingn">content</span><span class="testingp">),</span> <span class="testingn">lexer</span><span class="testingp">,</span> <span class="testingn">formatter</span><span class="testingp">)</span><br></span><span id="foo-27"><a name="foo-27"></a><span class="lineno"> </span> <span class="testingk">return</span> <span class="testingp">[</span><span class="testingn">nodes</span><span class="testingo">.</span><span class="testingn">raw</span><span class="testingp">(</span><span class="testings1">''</span><span class="testingp">,</span> <span class="testingn">parsed</span><span class="testingp">,</span> <span class="testingnb">format</span><span class="testingo">=</span><span class="testings1">'html'</span><span class="testingp">)]</span><br></span></pre></div>
|
|
<p>Lovely.</p>
|
|
</div>
|
|
<div class="section" id="testing-even-more-sourcecode-directives">
|
|
<h2>Testing even more sourcecode directives</h2>
|
|
<span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span>
|
|
<p>Lovely.</p>
|
|
</div>
|
|
<div class="section" id="testing-overriding-config-defaults">
|
|
<h2>Testing overriding config defaults</h2>
|
|
<p>Even if the default is line numbers, we can override it here</p>
|
|
<div class="highlight"><pre><span></span><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span>
|
|
</pre></div>
|
|
<p>Lovely.</p>
|
|
</div>
|
|
|
|
</div><!-- /.entry-content -->
|
|
|
|
</article>
|
|
</section>
|
|
<section id="extras" class="body">
|
|
<div class="social">
|
|
<h2>social</h2>
|
|
<ul>
|
|
<li><a href="/feeds/all.atom.xml" type="application/atom+xml" rel="alternate">atom feed</a></li>
|
|
|
|
</ul>
|
|
</div><!-- /.social -->
|
|
</section><!-- /#extras -->
|
|
|
|
<footer id="contentinfo" class="body">
|
|
<address id="about" class="vcard body">
|
|
Proudly powered by <a href="https://getpelican.com/">Pelican</a>, which takes great advantage of <a href="https://www.python.org/">Python</a>.
|
|
</address><!-- /#about -->
|
|
|
|
<p>The theme is by <a href="https://www.smashingmagazine.com/2009/08/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
|
|
</footer><!-- /#contentinfo -->
|
|
|
|
</body>
|
|
</html> |