blog.notmyidea.org/pelican-a-simple-static-blog-generator-in-python.html
2019-11-07 17:39:15 +01:00

204 lines
No EOL
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<title>Pelican, a simple static blog generator in python - Alexis - Carnets en ligne</title>
<meta charset="utf-8" />
<link href="https://blog.notmyidea.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Alexis - Carnets en ligne Full Atom Feed" />
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/poole.css"/>
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/syntax.css"/>
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/lanyon.css"/>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=PT+Serif:400,400italic,700%7CPT+Sans:400">
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/styles.css"/>
<style>
h1 {
font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
padding: 80px 50px;
text-align: center;
text-transform: uppercase;
text-rendering: optimizeLegibility;
color: #202020;
letter-spacing: .1em;
text-shadow:
-1px -1px 1px #111,
2px 2px 1px #eaeaea;
}
#main {
text-align: justify;
text-justify: inter-word;
}
#main h1 {
padding: 10px;
}
.post-headline {
padding: 15px;
}
</style>
</head>
<body>
<!-- Target for toggling the sidebar `.sidebar-checkbox` is for regular
styles, `#sidebar-checkbox` for behavior. -->
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">
<!-- Toggleable sidebar -->
<div class="sidebar" id="sidebar">
<div class="sidebar-item">
<div class="profile">
<img src="https://blog.notmyidea.org/theme/img/profile.png"/>
</div>
</div>
<nav class="sidebar-nav">
<a class="sidebar-nav-item" href="/">Articles</a>
<a class="sidebar-nav-item" href="https://www.vieuxsinge.com">Brasserie du Vieux Singe</a>
<a class="sidebar-nav-item" href="http://blog.notmyidea.org/pages/about.html">A propos</a>
<a class="sidebar-nav-item" href="https://twitter.com/ametaireau">Messages courts</a>
<a class="sidebar-nav-item" href="https://github.com/almet">Code</a>
</nav>
</div> <div class="wrap">
<div class="masthead">
<div class="container">
<h3 class="masthead-title">
<a href="https://blog.notmyidea.org/" title="Home">Alexis - Carnets en ligne</a>
</h3>
</div>
</div>
<div class="container content">
<div id="main" class="posts">
<h1 class="post-title">Pelican, a simple static blog generator in python</h1>
<span class="post-date">06 octobre 2010, dans <a class="no-color" href="category/technologie.html">Technologie</a></span>
<img id="illustration" src="" />
<div class="post article">
<h1>🌟</h1>
<p>Those days, I've wrote a little python application to fit my blogging
needs. I'm an occasional blogger, a vim lover, I like restructured text
and DVCSes, so I've made a little tool that makes good use of all that.</p>
<p><a href="http://docs.getpelican.com">Pelican</a> (for calepin) is just a simple
tool to generate your blog as static files, letting you using your
editor of choice (vim!). It's easy to extend, and has a template
support (via jinja2).</p>
<p>I've made it to fit <em>my</em> needs. I hope it will fit yours, but maybe it
wont, and it have not be designed to feet everyone's needs.</p>
<p>Need an example ? You're looking at it ! This weblog is using pelican
to be generated, also for the atom feeds.</p>
<p>I've released it under AGPL, since I want all the modifications to be
profitable to all the users.</p>
<p>You can find a repository to fork at
<a href="https://github.com/getpelican/pelican/">https://github.com/getpelican/pelican/</a>. feel free to hack it !</p>
<p>If you just want to get started, use your installer of choice (pip,
easy_install, …) And then have a look to the help (pelican --help)</p>
<p>``` sourceCode bash
$ pip install pelican</p>
<div class="highlight"><pre><span></span><span class="o">##</span> <span class="k">Usage</span>
<span class="n">Here</span><span class="err">&#39;</span><span class="n">s</span> <span class="n">a</span> <span class="n">sample</span> <span class="k">usage</span> <span class="k">of</span> <span class="n">pelican</span>
<span class="o">```</span> <span class="n">sourceCode</span> <span class="n">bash</span>
<span class="err">$</span> <span class="n">pelican</span> <span class="p">.</span>
<span class="n">writing</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">alexis</span><span class="o">/</span><span class="n">projets</span><span class="o">/</span><span class="n">notmyidea</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="k">output</span><span class="o">/</span><span class="k">index</span><span class="p">.</span><span class="n">html</span>
<span class="n">writing</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">alexis</span><span class="o">/</span><span class="n">projets</span><span class="o">/</span><span class="n">notmyidea</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="k">output</span><span class="o">/</span><span class="n">tags</span><span class="p">.</span><span class="n">html</span>
<span class="n">writing</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">alexis</span><span class="o">/</span><span class="n">projets</span><span class="o">/</span><span class="n">notmyidea</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="k">output</span><span class="o">/</span><span class="n">categories</span><span class="p">.</span><span class="n">html</span>
<span class="n">writing</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">alexis</span><span class="o">/</span><span class="n">projets</span><span class="o">/</span><span class="n">notmyidea</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="k">output</span><span class="o">/</span><span class="n">archives</span><span class="p">.</span><span class="n">html</span>
<span class="n">writing</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">alexis</span><span class="o">/</span><span class="n">projets</span><span class="o">/</span><span class="n">notmyidea</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="k">output</span><span class="o">/</span><span class="n">category</span><span class="o">/</span><span class="n">python</span><span class="p">.</span><span class="n">html</span>
<span class="n">writing</span>
<span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">alexis</span><span class="o">/</span><span class="n">projets</span><span class="o">/</span><span class="n">notmyidea</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="k">output</span><span class="o">/</span><span class="n">pelican</span><span class="o">-</span><span class="n">a</span><span class="o">-</span><span class="k">simple</span><span class="o">-</span><span class="k">static</span><span class="o">-</span><span class="n">blog</span><span class="o">-</span><span class="n">generator</span><span class="o">-</span><span class="k">in</span><span class="o">-</span><span class="n">python</span><span class="p">.</span><span class="n">html</span>
<span class="n">Done</span> <span class="o">!</span>
</pre></div>
<p>You also can use the --help option for the command line to get more
informations</p>
<p>``` sourceCode bash
$pelican --help
usage: pelican [-h] [-t TEMPLATES] [-o OUTPUT] [-m MARKUP] [-s SETTINGS] [-b]
path</p>
<p>A tool to generate a static blog, with restructured text input files.</p>
<p>positional arguments:
path Path where to find the content files (default is
"content").</p>
<p>optional arguments:
-h, --help show this help message and exit
-t TEMPLATES, --templates-path TEMPLATES
Path where to find the templates. If not specified,
will uses the ones included with pelican.
-o OUTPUT, --output OUTPUT
Where to output the generated files. If not specified,
a directory will be created, named "output" in the
current path.
-m MARKUP, --markup MARKUP
the markup language to use. Currently only
ReSTreucturedtext is available.
-s SETTINGS, --settings SETTINGS
the settings of the application. Default to None.
-b, --debug
```</p>
<p>Enjoy :)</p>
</div>
</div>
</div>
<label for="sidebar-checkbox" class="sidebar-toggle"></label>
<script>
(function(document) {
var i = 0;
// snip empty header rows since markdown can't
var rows = document.querySelectorAll('tr');
for(i=0; i<rows.length; i++) {
var ths = rows[i].querySelectorAll('th');
var rowlen = rows[i].children.length;
if (ths.length > 0 && ths.length === rowlen) {
rows[i].remove();
}
}
})(document);
</script>
<script>
/* Lanyon & Poole are Copyright (c) 2014 Mark Otto. Adapted to Pelican 20141223 and extended a bit by @thomaswilley */
(function(document) {
var toggle = document.querySelector('.sidebar-toggle');
var sidebar = document.querySelector('#sidebar');
var checkbox = document.querySelector('#sidebar-checkbox');
document.addEventListener('click', function(e) {
var target = e.target;
if(!checkbox.checked ||
sidebar.contains(target) ||
(target === checkbox || target === toggle)) return;
checkbox.checked = false;
}, false);
})(document);
</script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//tracker.notmyidea.org/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 3]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//tracker.notmyidea.org/piwik.php?idsite=3" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</div>
</body>
</html>