From 9a08e6c44e3b856ed522b76c6a37490a84d5621a Mon Sep 17 00:00:00 2001 From: Peter Florijn Date: Sat, 10 Feb 2024 16:22:55 +0100 Subject: [PATCH] Generate Pelican site --- articles/pelican-title_capitalize-plugin.html | 38 ++++++++++--------- feeds/all.atom.xml | 38 ++++++++++--------- feeds/pelican.atom.xml | 38 ++++++++++--------- 3 files changed, 63 insertions(+), 51 deletions(-) diff --git a/articles/pelican-title_capitalize-plugin.html b/articles/pelican-title_capitalize-plugin.html index 465ed551..79afe0e9 100644 --- a/articles/pelican-title_capitalize-plugin.html +++ b/articles/pelican-title_capitalize-plugin.html @@ -80,26 +80,30 @@

-

`python

-

”“” -Pelican plugin to replace “-” with a space in an article’s title. “”“

-

from pelican import signals

-

def title_capitalize(generator, metadata): - try: - metadata[“title”] = metadata[“title”].capitalize() - except KeyError: pass

-
# not sure if you have to return metadata, or if it is
-# globally updated as it's a dictionary
-return metadata
-
+
"""
+Pelican plugin to replace "-" with a space in an article's title.
+"""
+
+from pelican import signals
+
+def title_capitalize(generator, metadata):
+    try:
+        metadata["title"] = metadata["title"].capitalize()
+    except KeyError:
+        pass
+
+    # not sure if you have to return metadata, or if it is
+    # globally updated as it's a dictionary
+    return metadata
+
+
+def register():
+    """Register the plugin pieces with Pelican."""
 
-

def register(): - “”“Register the plugin pieces with Pelican.”“”

-
signals.article_generator_context.connect(title_capitalize)
-signals.page_generator_context.connect(title_capitalize)
+    signals.article_generator_context.connect(title_capitalize)
+    signals.page_generator_context.connect(title_capitalize)
 
-

’‘’

diff --git a/feeds/all.atom.xml b/feeds/all.atom.xml index f3447a5b..4c873840 100644 --- a/feeds/all.atom.xml +++ b/feeds/all.atom.xml @@ -1,24 +1,28 @@ -Daily Scrumhttps://blog.florijnconsultancy.nl/2024-02-10T15:54:00+01:00A personal blogPelican title_capitalize plugin2024-02-10T15:54:00+01:002024-02-10T15:54:00+01:00Peter Florijntag:blog.florijnconsultancy.nl,2024-02-10:/articles/pelican-title_capitalize-plugin.html<p><span class="dquo">&#8220;</span>`python</p> -<p>&rdquo;&ldquo;&rdquo; -Pelican plugin to replace &ldquo;-&rdquo; with a space in an article&rsquo;s title.&nbsp;&ldquo;&rdquo;&ldquo;</p> -<p>from pelican import&nbsp;signals</p> -<p>def title_capitalize(generator, metadata): - try: - metadata[&ldquo;title&rdquo;] = metadata[&ldquo;title&rdquo;].capitalize() - except KeyError:&nbsp;pass</p> -<div class="highlight"><pre><span></span><code>#<span class="w"> </span><span class="nv">not</span><span class="w"> </span><span class="nv">sure</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="nv">you</span><span class="w"> </span><span class="nv">have</span><span class="w"> </span><span class="nv">to</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nv">metadata</span>,<span class="w"> </span><span class="nv">or</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="nv">it</span><span class="w"> </span><span class="nv">is</span> -#<span class="w"> </span><span class="nv">globally</span><span class="w"> </span><span class="nv">updated</span><span class="w"> </span><span class="nv">as</span><span class="w"> </span><span class="nv">it</span><span class="err">&#39;s a dictionary</span> -<span class="err">return metadata</span> -</code></pre></div> +Daily Scrumhttps://blog.florijnconsultancy.nl/2024-02-10T15:54:00+01:00A personal blogPelican title_capitalize plugin2024-02-10T15:54:00+01:002024-02-10T15:54:00+01:00Peter Florijntag:blog.florijnconsultancy.nl,2024-02-10:/articles/pelican-title_capitalize-plugin.html<div class="highlight"><pre><span></span><code><span class="sd">&quot;&quot;&quot;</span> +<span class="sd">Pelican plugin to replace &quot;-&quot; with a space in an article&#39;s title.</span> +<span class="sd">&quot;&quot;&quot;</span> + +<span class="kn">from</span> <span class="nn">pelican</span> <span class="kn">import</span> <span class="n">signals</span> + +<span class="k">def</span> <span class="nf">title_capitalize</span><span class="p">(</span><span class="n">generator</span><span class="p">,</span> <span class="n">metadata</span><span class="p">):</span> + <span class="k">try</span><span class="p">:</span> + <span class="n">metadata</span><span class="p">[</span><span class="s2">&quot;title&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">metadata</span><span class="p">[</span><span class="s2">&quot;title&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">capitalize</span><span class="p">()</span> + <span class="k">except</span> <span class="ne">KeyError</span><span class="p">:</span> + <span class="k">pass</span> + + <span class="c1"># not sure if you have to return metadata, or if it is</span> + <span class="c1"># globally updated as it&#39;s a dictionary</span> + <span class="k">return</span> <span class="n">metadata</span> + + +<span class="k">def</span> <span class="nf">register</span><span class="p">():</span> +<span class="w"> </span><span class="sd">&quot;&quot;&quot;Register the plugin pieces with Pelican.&quot;&quot;&quot;</span> -<p>def register(): - &ldquo;&rdquo;&ldquo;Register the plugin pieces with&nbsp;Pelican.&rdquo;&ldquo;&rdquo;</p> -<div class="highlight"><pre><span></span><code><span class="n">signals</span><span class="o">.</span><span class="n">article_generator_context</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">title_capitalize</span><span class="p">)</span> -<span class="n">signals</span><span class="o">.</span><span class="n">page_generator_context</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">title_capitalize</span><span class="p">)</span> + <span class="n">signals</span><span class="o">.</span><span class="n">article_generator_context</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">title_capitalize</span><span class="p">)</span> + <span class="n">signals</span><span class="o">.</span><span class="n">page_generator_context</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">title_capitalize</span><span class="p">)</span> </code></pre></div> -<p>&rsquo;&lsquo;&rsquo;</p> <!-- more -->No sound guitar rig2024-02-09T06:30:00+01:002024-02-09T06:30:00+01:00Peter Florijntag:blog.florijnconsultancy.nl,2024-02-09:/articles/no-sound-guitar-rig.html<p>No sound from Motu 2 using Guitar&nbsp;Rig</p> <ol> <li>check sound&nbsp;source</li> diff --git a/feeds/pelican.atom.xml b/feeds/pelican.atom.xml index db094dd6..1ab7ec3b 100644 --- a/feeds/pelican.atom.xml +++ b/feeds/pelican.atom.xml @@ -1,22 +1,26 @@ -Daily Scrum - Pelicanhttps://blog.florijnconsultancy.nl/2024-02-10T15:54:00+01:00A personal blogPelican title_capitalize plugin2024-02-10T15:54:00+01:002024-02-10T15:54:00+01:00Peter Florijntag:blog.florijnconsultancy.nl,2024-02-10:/articles/pelican-title_capitalize-plugin.html<p><span class="dquo">&#8220;</span>`python</p> -<p>&rdquo;&ldquo;&rdquo; -Pelican plugin to replace &ldquo;-&rdquo; with a space in an article&rsquo;s title.&nbsp;&ldquo;&rdquo;&ldquo;</p> -<p>from pelican import&nbsp;signals</p> -<p>def title_capitalize(generator, metadata): - try: - metadata[&ldquo;title&rdquo;] = metadata[&ldquo;title&rdquo;].capitalize() - except KeyError:&nbsp;pass</p> -<div class="highlight"><pre><span></span><code>#<span class="w"> </span><span class="nv">not</span><span class="w"> </span><span class="nv">sure</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="nv">you</span><span class="w"> </span><span class="nv">have</span><span class="w"> </span><span class="nv">to</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nv">metadata</span>,<span class="w"> </span><span class="nv">or</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="nv">it</span><span class="w"> </span><span class="nv">is</span> -#<span class="w"> </span><span class="nv">globally</span><span class="w"> </span><span class="nv">updated</span><span class="w"> </span><span class="nv">as</span><span class="w"> </span><span class="nv">it</span><span class="err">&#39;s a dictionary</span> -<span class="err">return metadata</span> -</code></pre></div> +Daily Scrum - Pelicanhttps://blog.florijnconsultancy.nl/2024-02-10T15:54:00+01:00A personal blogPelican title_capitalize plugin2024-02-10T15:54:00+01:002024-02-10T15:54:00+01:00Peter Florijntag:blog.florijnconsultancy.nl,2024-02-10:/articles/pelican-title_capitalize-plugin.html<div class="highlight"><pre><span></span><code><span class="sd">&quot;&quot;&quot;</span> +<span class="sd">Pelican plugin to replace &quot;-&quot; with a space in an article&#39;s title.</span> +<span class="sd">&quot;&quot;&quot;</span> + +<span class="kn">from</span> <span class="nn">pelican</span> <span class="kn">import</span> <span class="n">signals</span> + +<span class="k">def</span> <span class="nf">title_capitalize</span><span class="p">(</span><span class="n">generator</span><span class="p">,</span> <span class="n">metadata</span><span class="p">):</span> + <span class="k">try</span><span class="p">:</span> + <span class="n">metadata</span><span class="p">[</span><span class="s2">&quot;title&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">metadata</span><span class="p">[</span><span class="s2">&quot;title&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">capitalize</span><span class="p">()</span> + <span class="k">except</span> <span class="ne">KeyError</span><span class="p">:</span> + <span class="k">pass</span> + + <span class="c1"># not sure if you have to return metadata, or if it is</span> + <span class="c1"># globally updated as it&#39;s a dictionary</span> + <span class="k">return</span> <span class="n">metadata</span> + + +<span class="k">def</span> <span class="nf">register</span><span class="p">():</span> +<span class="w"> </span><span class="sd">&quot;&quot;&quot;Register the plugin pieces with Pelican.&quot;&quot;&quot;</span> -<p>def register(): - &ldquo;&rdquo;&ldquo;Register the plugin pieces with&nbsp;Pelican.&rdquo;&ldquo;&rdquo;</p> -<div class="highlight"><pre><span></span><code><span class="n">signals</span><span class="o">.</span><span class="n">article_generator_context</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">title_capitalize</span><span class="p">)</span> -<span class="n">signals</span><span class="o">.</span><span class="n">page_generator_context</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">title_capitalize</span><span class="p">)</span> + <span class="n">signals</span><span class="o">.</span><span class="n">article_generator_context</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">title_capitalize</span><span class="p">)</span> + <span class="n">signals</span><span class="o">.</span><span class="n">page_generator_context</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">title_capitalize</span><span class="p">)</span> </code></pre></div> -<p>&rsquo;&lsquo;&rsquo;</p> <!-- more --> \ No newline at end of file