Synchronized build

This commit is contained in:
Lektor Bot 2023-09-09 02:29:28 +00:00
parent 8763c86f1e
commit 792bf222e6
30 changed files with 166 additions and 166 deletions

View File

@ -151,7 +151,7 @@ speak multiple languages and allow you to easily create localized websites.</li>
<div class="slideshow-wrapper"> <div class="slideshow-wrapper">
<div class="slideshow"> <div class="slideshow">
<div class="slideshow-inner"> <div class="slideshow-inner">
<div class="carousel slide" data-ride="carousel" data-interval="8500" id="carousel-1135bd614e8c4959b651c82645b4c5e7"> <div class="carousel slide" data-ride="carousel" data-interval="8500" id="carousel-e816b82cce294be68564d6684183ee7b">
<div class="carousel-inner" role="listbox"> <div class="carousel-inner" role="listbox">
@ -210,11 +210,11 @@ be completely customized.</p>
</div> </div>
</div> </div>
<a class="left carousel-control" href="#carousel-1135bd614e8c4959b651c82645b4c5e7" role="button" data-slide="prev"> <a class="left carousel-control" href="#carousel-e816b82cce294be68564d6684183ee7b" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span> <span class="sr-only">Previous</span>
</a> </a>
<a class="right carousel-control" href="#carousel-1135bd614e8c4959b651c82645b4c5e7" role="button" data-slide="next"> <a class="right carousel-control" href="#carousel-e816b82cce294be68564d6684183ee7b" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span> <span class="sr-only">Next</span>
</a> </a>

View File

@ -144,7 +144,7 @@
<h2>Configuration</h2> <h2>Configuration</h2>
<p>Here is a basic configuration:</p> <p>Here is a basic configuration:</p>
<pre lang="ini"><span class="k">[feed]</span> <pre lang="ini"><span class="k">[feed]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Site&#39;s Blog</span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Site's Blog</span>
<span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/blog</span> <span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/blog</span>
<span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/feed.xml</span> <span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/feed.xml</span>
</pre> </pre>
@ -153,14 +153,14 @@
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Blog</span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Blog</span>
<span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span> <span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span>
<span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/feed.xml</span> <span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/feed.xml</span>
<span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/&#39;).filter(F.type == &#39;post&#39;)</span> <span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query('/').filter(F.type == 'post')</span>
<span class="na">item_model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span> <span class="na">item_model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span>
<span class="k">[coffee]</span> <span class="k">[coffee]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Blog: Articles About Coffee</span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Blog: Articles About Coffee</span>
<span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span> <span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span>
<span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/category/coffee/feed.xml</span> <span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/category/coffee/feed.xml</span>
<span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/blog&#39;).filter(F.categories.contains(&#39;coffee&#39;))</span> <span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query('/blog').filter(F.categories.contains('coffee'))</span>
<span class="na">item_model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span> <span class="na">item_model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span>
</pre> </pre>
<p>The section names, like <code>blog</code> and <code>coffee</code>, are just used as internal identifiers.</p> <p>The section names, like <code>blog</code> and <code>coffee</code>, are just used as internal identifiers.</p>

View File

@ -154,23 +154,23 @@ files = A.bib B.bib
<p>For the default template, you can also add the following javascript to show some entries if you have a long list (relies on jquery):</p> <p>For the default template, you can also add the following javascript to show some entries if you have a long list (relies on jquery):</p>
<pre><code>$(document).ready(function() <pre><code>$(document).ready(function()
{ {
$(&quot;.BIBTeX&quot;).hide(); $(".BIBTeX").hide();
$(&quot;.BIBTeXtoggle&quot;).click( function () { $(".BIBTeXtoggle").click( function () {
$(this).parent().children(&quot;.BIBTeX&quot;).toggle(300); $(this).parent().children(".BIBTeX").toggle(300);
return false; return false;
}); });
$(&quot;.BIBYear&quot;).hide(); $(".BIBYear").hide();
$(&quot;.BIBYear:first&quot;).show(); $(".BIBYear:first").show();
$(&quot;.BIBYearheader&quot;).click( function () { $(".BIBYearheader").click( function () {
$(this).parent().children(&quot;.BIBYear&quot;).toggle(300); $(this).parent().children(".BIBYear").toggle(300);
return false; return false;
}); });
$(&quot;.bibshowall&quot;).click( function () { $(".bibshowall").click( function () {
$(&quot;.BIBYear&quot;).show(); $(".BIBYear").show();
}); });
$(&quot;.bibhideall&quot;).click( function () { $(".bibhideall").click( function () {
$(&quot;.BIBYear&quot;).hide(); $(".BIBYear").hide();
$(&quot;.BIBYear:first&quot;).show(); $(".BIBYear:first").show();
}); });
}); });
</code></pre> </code></pre>

View File

@ -149,7 +149,7 @@ link = /for-example/link-to-your/biblioprahy
<ol> <ol>
<li>Use method citation_short_output in the template of your literature page. It creates an unordered list of entries.</li> <li>Use method citation_short_output in the template of your literature page. It creates an unordered list of entries.</li>
</ol> </ol>
<pre><code> &lt;ul id=&quot;literatur&quot;&gt; <pre><code> &lt;ul id="literatur"&gt;
{% for entry in citation_entries() %} {% for entry in citation_entries() %}
{{ citation_short_output(entry)|decode|safe }} {{ citation_short_output(entry)|decode|safe }}
{% endfor %} {% endfor %}
@ -166,16 +166,16 @@ link = /for-example/link-to-your/biblioprahy
<p>produces</p> <p>produces</p>
<pre><code>&lt;h2&gt;{title}&lt;/h2&gt;&lt;h3&gt;{authors} ({pubYear})&lt;/h3&gt; <pre><code>&lt;h2&gt;{title}&lt;/h2&gt;&lt;h3&gt;{authors} ({pubYear})&lt;/h3&gt;
&lt;p&gt;{note}&lt;/p&gt; &lt;p&gt;{note}&lt;/p&gt;
&lt;dl class=&quot;literature&quot;&gt; &lt;dl class="literature"&gt;
&lt;dt class=&quot;edition&quot;&gt;&lt;/dt&gt; &lt;dt class="edition"&gt;&lt;/dt&gt;
&lt;dd&gt;{edition}&lt;/dd&gt; &lt;dd&gt;{edition}&lt;/dd&gt;
&lt;dt class=&quot;editors&quot;&gt;&lt;/dt&gt; &lt;dt class="editors"&gt;&lt;/dt&gt;
&lt;dd&gt;{editors}&lt;/dd&gt; &lt;dd&gt;{editors}&lt;/dd&gt;
&lt;dt class=&quot;pages&quot;&gt;&lt;/dt&gt; &lt;dt class="pages"&gt;&lt;/dt&gt;
&lt;dd&gt;{pages}&lt;/dd&gt; &lt;dd&gt;{pages}&lt;/dd&gt;
&lt;dt class=&quot;issbn&quot;&gt;&lt;/dt&gt; &lt;dt class="issbn"&gt;&lt;/dt&gt;
&lt;dd&gt;{issbn}&lt;/dd&gt; &lt;dd&gt;{issbn}&lt;/dd&gt;
&lt;dt class=&quot;publisher&quot;&gt;&lt;/dt&gt; &lt;dt class="publisher"&gt;&lt;/dt&gt;
&lt;dd&gt;{publisher}&lt;/dd&gt; &lt;dd&gt;{publisher}&lt;/dd&gt;
&lt;/dl&gt; &lt;/dl&gt;
</code></pre> </code></pre>
@ -206,8 +206,8 @@ citation_note(entry)
</code></pre> </code></pre>
<h3>In-text Cites</h3> <h3>In-text Cites</h3>
<p>To cite a certain entry in your texts you can use the <strong>jinja_env globals</strong>:</p> <p>To cite a certain entry in your texts you can use the <strong>jinja_env globals</strong>:</p>
<pre><code>citation_full_cite(id, link=&quot;&quot;) <pre><code>citation_full_cite(id, link="")
citation_full_citeNP(id, link=&quot;&quot;) citation_full_citeNP(id, link="")
</code></pre> </code></pre>
<p>Both methods create a complete hyperlink inside your text for the entry with <em>id</em>. You may give it any url to the <em>link</em> parameter to e.g. link it to your bibliography page. The NP in the second stands for <em>No Parantheses</em>. So you'll receive e.g.</p> <p>Both methods create a complete hyperlink inside your text for the entry with <em>id</em>. You may give it any url to the <em>link</em> parameter to e.g. link it to your bibliography page. The NP in the second stands for <em>No Parantheses</em>. So you'll receive e.g.</p>
<pre><code>AuthorI &amp; AuthorII (2019) <pre><code>AuthorI &amp; AuthorII (2019)

View File

@ -140,7 +140,7 @@
<p>Lektor plugin to add Creative Commons license to your pages</p> <p>Lektor plugin to add Creative Commons license to your pages</p>
<h2>Usage</h2> <h2>Usage</h2>
<p>On your templates use:</p> <p>On your templates use:</p>
<pre><code>&lt;div class=&quot;license&quot;&gt;{{ render_cc_license(type, size, template, caller) }}&lt;/div&gt; <pre><code>&lt;div class="license"&gt;{{ render_cc_license(type, size, template, caller) }}&lt;/div&gt;
</code></pre> </code></pre>
<ul> <ul>
<li><code>type</code> is a <code>string</code> with the license type (e.g.: <code>'by'</code>, <code>'by-sa'</code>, <code>'by-nc-sa'</code>).</li> <li><code>type</code> is a <code>string</code> with the license type (e.g.: <code>'by'</code>, <code>'by-sa'</code>, <code>'by-nc-sa'</code>).</li>
@ -151,12 +151,12 @@
</ul> </ul>
<h2>Examples</h2> <h2>Examples</h2>
<p>Simply rendering the license of your choice:</p> <p>Simply rendering the license of your choice:</p>
<pre><code>&lt;div class=&quot;license&quot;&gt;{{ render_cc_license('by-sa') }}&lt;/div&gt; <pre><code>&lt;div class="license"&gt;{{ render_cc_license('by-sa') }}&lt;/div&gt;
</code></pre> </code></pre>
<p>Using Jinja2 <a href="http://jinja.pocoo.org/docs/2.10/templates/#call" rel="nofollow">call</a> block to inject your own template:</p> <p>Using Jinja2 <a href="http://jinja.pocoo.org/docs/2.10/templates/#call" rel="nofollow">call</a> block to inject your own template:</p>
<pre><code>{% call(license, license_url, icon_path) render_cc_license('by-sa', size='normal') %} <pre><code>{% call(license, license_url, icon_path) render_cc_license('by-sa', size='normal') %}
&lt;a class=&quot;nav-item&quot; rel=&quot;license&quot; target=&quot;_blank&quot; href=&quot;{{ license_url }}&quot;&gt; &lt;a class="nav-item" rel="license" target="_blank" href="{{ license_url }}"&gt;
&lt;img alt=&quot;{{ license }}&quot; style=&quot;border-width:0&quot; src=&quot;{{ icon_path }}&quot; /&gt; &lt;img alt="{{ license }}" style="border-width:0" src="{{ icon_path }}" /&gt;
&lt;/a&gt; &lt;/a&gt;
{% endcall %} {% endcall %}
</code></pre> </code></pre>

View File

@ -152,7 +152,7 @@ your disqus community:</p>
<p>Now you can add a discussion box to any of your templates by just using <p>Now you can add a discussion box to any of your templates by just using
the <code>render_disqus_comments</code> function. Just calling it is enough to the <code>render_disqus_comments</code> function. Just calling it is enough to
get the comment box:</p> get the comment box:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;comments&quot;</span><span class="p">&gt;</span>{{ render_disqus_comments() }}<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">"comments"</span><span class="p">&gt;</span>{{ render_disqus_comments() }}<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
</pre> </pre>
<p>Optionally the function accepts a few arguemnts:</p> <p>Optionally the function accepts a few arguemnts:</p>
<ul> <ul>

View File

@ -181,11 +181,11 @@ then in the page template (e.g. in <code>templates/index.html</code>) one could
reference the <code>items</code> field (e.g. <code>{% for page in this.items %}</code>) reference the <code>items</code> field (e.g. <code>{% for page in this.items %}</code>)
to determine which pages to display on the page.</p> to determine which pages to display on the page.</p>
<h2>Author</h2> <h2>Author</h2>
<p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org">dairiki@dairiki.org</a></p> <p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org" rel="nofollow">dairiki@dairiki.org</a></p>
<h2>Changelog</h2> <h2>Changelog</h2>
<h3>0.1 — 2021-02-05</h3> <h3>0.1 — 2021-02-05</h3>
<p>No code changes.</p> <p>No code changes.</p>
<p>Update development status classifier to &quot;stable&quot;.</p> <p>Update development status classifier to "stable".</p>
<h4>Fixes</h4> <h4>Fixes</h4>
<ul> <ul>
<li>Include the correct LICENSE file.</li> <li>Include the correct LICENSE file.</li>

View File

@ -244,7 +244,7 @@ Unfortunately, the last released version of Lektor (as of August 12,
to install Lektor from git if you want to be able to sort records by to install Lektor from git if you want to be able to sort records by
<code>gittimestamp</code>.</p> <code>gittimestamp</code>.</p>
<h2>Author</h2> <h2>Author</h2>
<p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org">dairiki@dairiki.org</a></p> <p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org" rel="nofollow">dairiki@dairiki.org</a></p>
<h2>Changelog</h2> <h2>Changelog</h2>
<h3>Release 0.1.0.post1 (2021-08-12)</h3> <h3>Release 0.1.0.post1 (2021-08-12)</h3>
<p>No code changes.</p> <p>No code changes.</p>
@ -252,7 +252,7 @@ to install Lektor from git if you want to be able to sort records by
required in order to be able to sort records by <code>gittimestamp</code> fields.</p> required in order to be able to sort records by <code>gittimestamp</code> fields.</p>
<h3>Release 0.1 (2021-02-05)</h3> <h3>Release 0.1 (2021-02-05)</h3>
<p>No code changes.</p> <p>No code changes.</p>
<p>Update development status classifier to &quot;stable&quot;.</p> <p>Update development status classifier to "stable".</p>
<p>Add functional tests.</p> <p>Add functional tests.</p>
<h3>Release 0.1a2 (2021-02-03)</h3> <h3>Release 0.1a2 (2021-02-03)</h3>
<h4>Bugs Fixed</h4> <h4>Bugs Fixed</h4>

View File

@ -157,7 +157,7 @@ folder in your Lektor projects base directory. And, put the
<h3>Using in Templates</h3> <h3>Using in Templates</h3>
<p>Now you can add a Google analytics code-snippet in your templates by <p>Now you can add a Google analytics code-snippet in your templates by
just calling the <span class="docutils literal">generate_google_analytics</span> function inside its <span class="docutils literal">&lt;body&gt; &lt;/body&gt;</span> tags.</p> just calling the <span class="docutils literal">generate_google_analytics</span> function inside its <span class="docutils literal">&lt;body&gt; &lt;/body&gt;</span> tags.</p>
<pre><code><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><s>&quot;ga-script&quot;</s><span class="p">&gt;</span>{{ generate_google_analytics() }}<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span></code></pre> <pre><code><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><s>"ga-script"</s><span class="p">&gt;</span>{{ generate_google_analytics() }}<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span></code></pre>
<p>Thats it. All the <span class="docutils literal">HTML</span> files that rendered from that template will <p>Thats it. All the <span class="docutils literal">HTML</span> files that rendered from that template will
include Google-Analytics code automatically.</p> include Google-Analytics code automatically.</p>
</section> </section>

View File

@ -131,17 +131,17 @@ can deposit scholarly documents from all academic fields.</p>
<p>In <code>./configs/hal.ini</code>, the query field must be specified, following to the <p>In <code>./configs/hal.ini</code>, the query field must be specified, following to the
<a href="https://api.archives-ouvertes.fr/docs/search" rel="nofollow">HAL docs</a></p> <a href="https://api.archives-ouvertes.fr/docs/search" rel="nofollow">HAL docs</a></p>
<p>Example:</p> <p>Example:</p>
<pre><code>query = ((authIdHal_s:my-id-hal) OR (authFullName_s:&quot;My Name&quot;)) <pre><code>query = ((authIdHal_s:my-id-hal) OR (authFullName_s:"My Name"))
</code></pre> </code></pre>
<h2>Usage</h2> <h2>Usage</h2>
<h3>Example</h3> <h3>Example</h3>
<pre lang="html"><span class="p">&lt;</span><span class="nt">ul</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;publications&quot;</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;publications&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">ul</span> <span class="na">class</span><span class="o">=</span><span class="s">"publications"</span> <span class="na">id</span><span class="o">=</span><span class="s">"publications"</span><span class="p">&gt;</span>
{% for publi in hal_publications %} {% for publi in hal_publications %}
<span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">{{</span> <span class="na">publi</span><span class="err">.</span><span class="na">link</span> <span class="err">}}</span><span class="p">&gt;</span>{{ publi.title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">{{</span> <span class="na">publi</span><span class="err">.</span><span class="na">link</span> <span class="err">}}</span><span class="p">&gt;</span>{{ publi.title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
@ @
{{ publi.where }} - {{ publi.where }} -
{{ publi.authors|join(&#39;, &#39;) }} {{ publi.authors|join(', ') }}
({{ publi.date }}) ({{ publi.date }})
<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
{% endfor %} {% endfor %}
@ -158,7 +158,7 @@ HAL API.</li>
<li><code>hal_id</code>: The HAL ID of the publication</li> <li><code>hal_id</code>: The HAL ID of the publication</li>
<li><code>authors</code>: A list of strings (author names)</li> <li><code>authors</code>: A list of strings (author names)</li>
<li><code>date</code>: A string (<code>producedDate_s</code>)</li> <li><code>date</code>: A string (<code>producedDate_s</code>)</li>
<li><code>type</code>: The publication type, eg &quot;ART&quot;, &quot;COMM&quot;, &quot;POSTER&quot;, etc/</li> <li><code>type</code>: The publication type, eg "ART", "COMM", "POSTER", etc/</li>
</ul> </ul>
<p>and properties:</p> <p>and properties:</p>
<ul> <ul>
@ -171,7 +171,7 @@ if missing)</li>
<h2>Known caveat</h2> <h2>Known caveat</h2>
<p>Lektor will not 'know' that the page must be rebuilt when new entries are <p>Lektor will not 'know' that the page must be rebuilt when new entries are
returned by the HAL API request. returned by the HAL API request.
As a workaround, the plugin allows to mark any page as &quot;dirty&quot;, so it is rebuilt As a workaround, the plugin allows to mark any page as "dirty", so it is rebuilt
everytime. Add this to the template that uses the publications list:</p> everytime. Add this to the template that uses the publications list:</p>
<pre lang="jinja2">{{ volatile() }} <pre lang="jinja2">{{ volatile() }}
</pre> </pre>

View File

@ -146,14 +146,14 @@ For example, you may have an image called <code>waffle.jpg</code>, and to link t
All images will be converted to webp using <a href="https://pypi.org/project/Pillow/" rel="nofollow">Pillow</a>.</p> All images will be converted to webp using <a href="https://pypi.org/project/Pillow/" rel="nofollow">Pillow</a>.</p>
<p>You can use the images like that:</p> <p>You can use the images like that:</p>
<pre lang="html"><span class="cm">&lt;!-- Simple example --&gt;</span> <pre lang="html"><span class="cm">&lt;!-- Simple example --&gt;</span>
<span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;waffle.jpg&quot;</span><span class="p">&gt;&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;waffle-small.jpg&quot;</span> <span class="p">/&gt;&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"waffle.jpg"</span><span class="p">&gt;&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">"waffle-small.jpg"</span> <span class="p">/&gt;&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
<span class="cm">&lt;!-- example with srcset --&gt;</span> <span class="cm">&lt;!-- example with srcset --&gt;</span>
<span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;waffle-small.webp&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"waffle-small.webp"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;waffle-small.webp&quot;</span> <span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">"waffle-small.webp"</span>
<span class="na">srcset</span><span class="o">=</span><span class="s">&quot;waffle-small.webp 640w, // Viewport bis zu 640</span> <span class="na">srcset</span><span class="o">=</span><span class="s">"waffle-small.webp 640w, // Viewport bis zu 640</span>
<span class="s"> waffle-medium.webp 1280w, // Viewport größer als 1280</span> <span class="s"> waffle-medium.webp 1280w, // Viewport größer als 1280</span>
<span class="s"> waffle-woowee.webp 1920w&quot;</span> <span class="err">//</span> <span class="na">Viewport</span> <span class="na">größer</span> <span class="na">als</span> <span class="na">1920</span> <span class="s"> waffle-woowee.webp 1920w"</span> <span class="err">//</span> <span class="na">Viewport</span> <span class="na">größer</span> <span class="na">als</span> <span class="na">1920</span>
<span class="p">/&gt;</span> <span class="p">/&gt;</span>
<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
</pre> </pre>

View File

@ -157,7 +157,7 @@ the build process down too excruciatingly much.</p>
<li><a href="https://pypi.org/project/lektor-index-pages/" rel="nofollow">PyPI</a></li> <li><a href="https://pypi.org/project/lektor-index-pages/" rel="nofollow">PyPI</a></li>
</ul> </ul>
<h2>Author</h2> <h2>Author</h2>
<p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org">dairiki@dairiki.org</a></p> <p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org" rel="nofollow">dairiki@dairiki.org</a></p>
<h2>Changelog</h2> <h2>Changelog</h2>
<h3>Release 1.1.0 (2023-06-16)</h3> <h3>Release 1.1.0 (2023-06-16)</h3>
<ul> <ul>
@ -193,7 +193,7 @@ the build process down too excruciatingly much.</p>
</ul> </ul>
<h3>Release 0.1 (2021-02-05)</h3> <h3>Release 0.1 (2021-02-05)</h3>
<p>No code changes.</p> <p>No code changes.</p>
<p>Update development status classifier to &quot;stable&quot;.</p> <p>Update development status classifier to "stable".</p>
<h3>Release 0.1a3 (2020-05-08)</h3> <h3>Release 0.1a3 (2020-05-08)</h3>
<h4>API changes</h4> <h4>API changes</h4>
<ul> <ul>

View File

@ -153,7 +153,7 @@
<span class="cp">{%</span> <span class="k">if</span> <span class="nv">meaning_of_life</span> <span class="o">==</span> <span class="nv">meaning_of_universe</span> <span class="o">==</span> <span class="m">42</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">if</span> <span class="nv">meaning_of_life</span> <span class="o">==</span> <span class="nv">meaning_of_universe</span> <span class="o">==</span> <span class="m">42</span> <span class="cp">%}</span>
<span class="x"> </span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_it_all</span> <span class="o">=</span> <span class="nv">meaning_of_life</span> <span class="cp">%}</span> <span class="x"> </span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_it_all</span> <span class="o">=</span> <span class="nv">meaning_of_life</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span>
<span class="x"> </span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_it_all</span> <span class="o">=</span> <span class="s1">&#39;Undefined&#39;</span> <span class="cp">%}</span> <span class="x"> </span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_it_all</span> <span class="o">=</span> <span class="s1">'Undefined'</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
<span class="cp">{{</span> <span class="nv">meaning_of_it_all</span> <span class="cp">}}</span> <span class="cp">{{</span> <span class="nv">meaning_of_it_all</span> <span class="cp">}}</span>
</pre> </pre>

View File

@ -133,8 +133,8 @@ in the sidebar of your Lektor-based site. This can be done by adding
something like to your site base template:</p> something like to your site base template:</p>
<pre lang="html+jinja"><span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span>Recent Posts<span class="p">&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span> <pre lang="html+jinja"><span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span>Recent Posts<span class="p">&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">post</span> <span class="k">in</span> <span class="nv">site.query</span><span class="o">(</span><span class="s1">&#39;/blog&#39;</span><span class="o">)</span><span class="nv">.order_by</span><span class="o">(</span><span class="s1">&#39;-pub_date&#39;</span><span class="o">)</span><span class="nv">.limit</span><span class="o">(</span><span class="m">3</span><span class="o">)</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">for</span> <span class="nv">post</span> <span class="k">in</span> <span class="nv">site.query</span><span class="o">(</span><span class="s1">'/blog'</span><span class="o">)</span><span class="nv">.order_by</span><span class="o">(</span><span class="s1">'-pub_date'</span><span class="o">)</span><span class="nv">.limit</span><span class="o">(</span><span class="m">3</span><span class="o">)</span> <span class="cp">%}</span>
<span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">post</span><span class="o">|</span><span class="nf">url</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">post.title</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"</span><span class="cp">{{</span> <span class="nv">post</span><span class="o">|</span><span class="nf">url</span> <span class="cp">}}</span><span class="s">"</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">post.title</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
</pre> </pre>
@ -177,8 +177,8 @@ most-recent posts.)</p>
<p>Thus, the example above, if replaced by:</p> <p>Thus, the example above, if replaced by:</p>
<pre lang="html+jinja"><span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span>Recent Posts<span class="p">&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span> <pre lang="html+jinja"><span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span>Recent Posts<span class="p">&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">post</span> <span class="k">in</span> <span class="nv">site.query</span><span class="o">(</span><span class="s1">&#39;/blog&#39;</span><span class="o">)</span><span class="nv">.order_by</span><span class="o">(</span><span class="s1">&#39;-pub_date&#39;</span><span class="o">)</span><span class="nv">.limit</span><span class="o">(</span><span class="m">3</span><span class="o">)|</span><span class="nf">limit_dependencies</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">for</span> <span class="nv">post</span> <span class="k">in</span> <span class="nv">site.query</span><span class="o">(</span><span class="s1">'/blog'</span><span class="o">)</span><span class="nv">.order_by</span><span class="o">(</span><span class="s1">'-pub_date'</span><span class="o">)</span><span class="nv">.limit</span><span class="o">(</span><span class="m">3</span><span class="o">)|</span><span class="nf">limit_dependencies</span> <span class="cp">%}</span>
<span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">post</span><span class="o">|</span><span class="nf">url</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">post.title</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"</span><span class="cp">{{</span> <span class="nv">post</span><span class="o">|</span><span class="nf">url</span> <span class="cp">}}</span><span class="s">"</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">post.title</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
</pre> </pre>
@ -191,7 +191,7 @@ of the three most recent posts.</p>
</code></pre> </code></pre>
<p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor plugin documentation</a> for more information.</p> <p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor plugin documentation</a> for more information.</p>
<h2>Author</h2> <h2>Author</h2>
<p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org">dairiki@dairiki.org</a></p> <p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org" rel="nofollow">dairiki@dairiki.org</a></p>
<h2>Changelog</h2> <h2>Changelog</h2>
<h3>Release 1.0.0 (2023-01-31)</h3> <h3>Release 1.0.0 (2023-01-31)</h3>
<p>No code changes from 1.0.0b1.</p> <p>No code changes from 1.0.0b1.</p>
@ -200,7 +200,7 @@ of the three most recent posts.</p>
<p>Drop support for python&lt;3.7 and lektor&lt;3.3.</p> <p>Drop support for python&lt;3.7 and lektor&lt;3.3.</p>
<h3>Release 0.1 (2021-02-05)</h3> <h3>Release 0.1 (2021-02-05)</h3>
<p>No code changes.</p> <p>No code changes.</p>
<p>Update development status classifier to &quot;stable&quot;.</p> <p>Update development status classifier to "stable".</p>
<p>Test under python 3.9. Stop testing under 3.5.</p> <p>Test under python 3.9. Stop testing under 3.5.</p>
<h3>Release 0.1a1 (2020-05-19)</h3> <h3>Release 0.1a1 (2020-05-19)</h3>
<p>Initial release.</p> <p>Initial release.</p>

View File

@ -158,19 +158,19 @@ inspired by the extension in Python Markdown but simplified.</p>
<tbody> <tbody>
<tr> <tr>
<td align="left">!</td> <td align="left">!</td>
<td align="left"><code>&lt;div class=&quot;admonition admonition-note&quot;&gt;</code></td> <td align="left"><code>&lt;div class="admonition admonition-note"&gt;</code></td>
</tr> </tr>
<tr> <tr>
<td align="left">!!</td> <td align="left">!!</td>
<td align="left"><code>&lt;div class=&quot;admonition admonition-info&quot;&gt;</code></td> <td align="left"><code>&lt;div class="admonition admonition-info"&gt;</code></td>
</tr> </tr>
<tr> <tr>
<td align="left">!!!</td> <td align="left">!!!</td>
<td align="left"><code>&lt;div class=&quot;admonition admonition-tip&quot;&gt;</code></td> <td align="left"><code>&lt;div class="admonition admonition-tip"&gt;</code></td>
</tr> </tr>
<tr> <tr>
<td align="left">!!!!</td> <td align="left">!!!!</td>
<td align="left"><code>&lt;div class=&quot;admonition admonition-warning&quot;&gt;</code></td> <td align="left"><code>&lt;div class="admonition admonition-warning"&gt;</code></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -159,9 +159,9 @@ markdown data. It's a list where each item has the following attributes:</p>
</ul> </ul>
<p>Example rendering:</p> <p>Example rendering:</p>
<pre lang="jinja"><span class="x">&lt;h4&gt;Table Of Contents&lt;/h4&gt;</span> <pre lang="jinja"><span class="x">&lt;h4&gt;Table Of Contents&lt;/h4&gt;</span>
<span class="x">&lt;ul class=&quot;toc&quot;&gt;</span> <span class="x">&lt;ul class="toc"&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">item</span> <span class="k">in</span> <span class="nv">this.body.toc</span> <span class="k">recursive</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">for</span> <span class="nv">item</span> <span class="k">in</span> <span class="nv">this.body.toc</span> <span class="k">recursive</span> <span class="cp">%}</span>
<span class="x"> &lt;li&gt;&lt;a href=&quot;#</span><span class="cp">{{</span> <span class="nv">item.anchor</span> <span class="cp">}}</span><span class="x">&quot;&gt;</span><span class="cp">{{</span> <span class="nv">item.title</span> <span class="cp">}}</span><span class="x">&lt;/a&gt;</span><span class="cp">{%</span> <span class="x"> &lt;li&gt;&lt;a href="#</span><span class="cp">{{</span> <span class="nv">item.anchor</span> <span class="cp">}}</span><span class="x">"&gt;</span><span class="cp">{{</span> <span class="nv">item.title</span> <span class="cp">}}</span><span class="x">&lt;/a&gt;</span><span class="cp">{%</span>
<span class="k">if</span> <span class="nv">item.children</span> <span class="cp">%}</span><span class="x">&lt;ul&gt;</span><span class="cp">{{</span> <span class="nb">loop</span><span class="o">(</span><span class="nv">item.children</span><span class="o">)</span> <span class="cp">}}</span><span class="x">&lt;/ul&gt;</span><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="x">&lt;/li&gt;</span> <span class="k">if</span> <span class="nv">item.children</span> <span class="cp">%}</span><span class="x">&lt;ul&gt;</span><span class="cp">{{</span> <span class="nb">loop</span><span class="o">(</span><span class="nv">item.children</span><span class="o">)</span> <span class="cp">}}</span><span class="x">&lt;/ul&gt;</span><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="x">&lt;/li&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="x">&lt;/ul&gt;</span> <span class="x">&lt;/ul&gt;</span>

View File

@ -152,22 +152,22 @@ for Pygments. Just create a file named <code>markdown-highlighter.ini</code> in
</pre> </pre>
<p>You can use this to select any of the built-in Pygments styles. Support for <p>You can use this to select any of the built-in Pygments styles. Support for
custom styles will come in the future.</p> custom styles will come in the future.</p>
<p>The config file is considered the &quot;source&quot; for the Pygments stylesheet, so you must create the configuration file (it can be empty) or Lektor's build will prune <code>pygments.css</code>.</p> <p>The config file is considered the "source" for the Pygments stylesheet, so you must create the configuration file (it can be empty) or Lektor's build will prune <code>pygments.css</code>.</p>
<h2>In Markdown</h2> <h2>In Markdown</h2>
<p>To use the syntax highlighter you need to use fenced blocks and pass the name <p>To use the syntax highlighter you need to use fenced blocks and pass the name
of the pygments lexer after the opening fence:</p> of the pygments lexer after the opening fence:</p>
<pre><code>```python <pre><code>```python
print(&quot;Hello World!&quot;) print("Hello World!")
``` ```
</code></pre> </code></pre>
<h2>In Templates</h2> <h2>In Templates</h2>
<p>In templates the plugin provides the <code>get_pygments_stylesheet</code> function which <p>In templates the plugin provides the <code>get_pygments_stylesheet</code> function which
can be used to generate and retrieve a link to the pygments stylesheet:</p> can be used to generate and retrieve a link to the pygments stylesheet:</p>
<pre lang="jinja"><span class="x">&lt;link rel=&quot;stylesheet&quot; href=&quot;</span><span class="cp">{{</span> <span class="nv">get_pygments_stylesheet</span><span class="o">()|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&quot;&gt;</span> <pre lang="jinja"><span class="x">&lt;link rel="stylesheet" href="</span><span class="cp">{{</span> <span class="nv">get_pygments_stylesheet</span><span class="o">()|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">"&gt;</span>
</pre> </pre>
<p>In addition the <code>|pygmentize</code> filter can be used to highlight code from <p>In addition the <code>|pygmentize</code> filter can be used to highlight code from
templates. It takes one argument which is the lexer name:</p> templates. It takes one argument which is the lexer name:</p>
<pre lang="jinja"><span class="cp">{{</span> <span class="s1">&#39;print &quot;Hello World!&quot;&#39;</span><span class="o">|</span><span class="nf">pygmentize</span><span class="o">(</span><span class="s1">&#39;python&#39;</span><span class="o">)</span> <span class="cp">}}</span> <pre lang="jinja"><span class="cp">{{</span> <span class="s1">'print "Hello World!"'</span><span class="o">|</span><span class="nf">pygmentize</span><span class="o">(</span><span class="s1">'python'</span><span class="o">)</span> <span class="cp">}}</span>
</pre> </pre>

View File

@ -128,14 +128,14 @@ HTML ruby tags to Markdown.</p>
^^ ^^
</pre> </pre>
<p>This will generate the following HTML:</p> <p>This will generate the following HTML:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ruby-line&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"ruby-line"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
</pre> </pre>
<p>The rendering result:</p> <p>The rendering result:</p>
<p> <p>
<span class="ruby-line"> <span class="ruby-line">
&lt;ruby&gt;&lt;rp&gt;(&lt;/rp&gt;&lt;rt&gt;ある&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;&lt;/ruby&gt; 歩(ある)く
</span> </span>
</p> </p>
<p>You can combine adjacent ruby text like this:</p> <p>You can combine adjacent ruby text like this:</p>
@ -144,15 +144,15 @@ HTML ruby tags to Markdown.</p>
^^ ^^
</pre> </pre>
<p>And this will be rendered like this:</p> <p>And this will be rendered like this:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ruby-line&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"ruby-line"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span><span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span><span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ぶん<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ぶん<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
</pre> </pre>
<p>Rendered output:</p> <p>Rendered output:</p>
<span class="ruby-line"> <span class="ruby-line">
&lt;ruby&gt;&lt;rp&gt;(&lt;/rp&gt;&lt;rt&gt;&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;&lt;/ruby&gt; 自(じ)
&lt;ruby&gt;&lt;rp&gt;(&lt;/rp&gt;&lt;rt&gt;ぶん&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;&lt;/ruby&gt; 分(ぶん)
</span> </span>
<h3>Newline</h3> <h3>Newline</h3>
<p>This plugin will automatically add <code>&lt;br /&gt;</code> between each line in a ruby-block:</p> <p>This plugin will automatically add <code>&lt;br /&gt;</code> between each line in a ruby-block:</p>
@ -162,11 +162,11 @@ HTML ruby tags to Markdown.</p>
^^ ^^
</pre> </pre>
<p>This will output:</p> <p>This will output:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ruby-line&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"ruby-line"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">br</span> <span class="p">/&gt;</span> <span class="p">&lt;</span><span class="nt">br</span> <span class="p">/&gt;</span>
<span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ruby-line&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"ruby-line"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
</pre> </pre>
@ -178,12 +178,12 @@ HTML ruby tags to Markdown.</p>
^^ ^^
</pre> </pre>
<p>Output:</p> <p>Output:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ruby-line&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"ruby-line"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">br</span> <span class="p">/&gt;</span> <span class="p">&lt;</span><span class="nt">br</span> <span class="p">/&gt;</span>
<span class="p">&lt;</span><span class="nt">br</span> <span class="p">/&gt;</span> <span class="p">&lt;</span><span class="nt">br</span> <span class="p">/&gt;</span>
<span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ruby-line&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"ruby-line"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
</pre> </pre>
@ -196,12 +196,12 @@ with specified color.</p>
^^ ^^
</pre> </pre>
<p>This will generate the following HTML pieces:</p> <p>This will generate the following HTML pieces:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ruby-line&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;color: #44cc00&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"ruby-line"</span> <span class="na">style</span><span class="o">=</span><span class="s">"color: #44cc00"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
</pre> </pre>
<h3>Raw lines</h3> <h3>Raw lines</h3>
<p>Prepend <code>% </code>  to create a raw line. Raw lines are not converted to ruby tags, <p>Prepend <code>% </code> &nbsp;to create a raw line. Raw lines are not converted to ruby tags,
not affected by the color settings, and have a different class.</p> not affected by the color settings, and have a different class.</p>
<p>Example:</p> <p>Example:</p>
<pre lang="markdown">^^#44cc00 <pre lang="markdown">^^#44cc00
@ -210,11 +210,11 @@ not affected by the color settings, and have a different class.</p>
^^ ^^
</pre> </pre>
<p>Output:</p> <p>Output:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ruby-line&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;color: #44cc00&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"ruby-line"</span> <span class="na">style</span><span class="o">=</span><span class="s">"color: #44cc00"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ruby</span><span class="p">&gt;</span><span class="p">&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>(<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;</span><span class="nt">rt</span><span class="p">&gt;</span>ある<span class="p">&lt;/</span><span class="nt">rt</span><span class="p">&gt;&lt;</span><span class="nt">rp</span><span class="p">&gt;</span>)<span class="p">&lt;/</span><span class="nt">rp</span><span class="p">&gt;&lt;/</span><span class="nt">ruby</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">br</span> <span class="p">/&gt;</span> <span class="p">&lt;</span><span class="nt">br</span> <span class="p">/&gt;</span>
<span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;non-ruby-line&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"non-ruby-line"</span><span class="p">&gt;</span>
(aru)[ku] (aru)[ku]
<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
</pre> </pre>

View File

@ -142,7 +142,7 @@
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">netlify://my-domain.com</span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">netlify://my-domain.com</span>
</pre> </pre>
<h2>Access Token</h2> <h2>Access Token</h2>
<p>Get a personal access token from Netlify's &quot;applications&quot; page:</p> <p>Get a personal access token from Netlify's "applications" page:</p>
<ul> <ul>
<li><a href="https://app.netlify.com/applications" rel="nofollow">Applications</a></li> <li><a href="https://app.netlify.com/applications" rel="nofollow">Applications</a></li>
</ul> </ul>

View File

@ -179,13 +179,13 @@
<h3><code>parcel/package.json</code></h3> <h3><code>parcel/package.json</code></h3>
<p>This is a standard <code>package.json</code> file. It should contain two entries in the <code>scripts</code> section. The <code>build</code> script is used during <code>lektor build -f npm</code>, and the <code>watch</code> script is used during <code>lektor server -f npm</code>.</p> <p>This is a standard <code>package.json</code> file. It should contain two entries in the <code>scripts</code> section. The <code>build</code> script is used during <code>lektor build -f npm</code>, and the <code>watch</code> script is used during <code>lektor server -f npm</code>.</p>
<pre lang="json"><span class="p">{</span> <pre lang="json"><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;my-parcel-project&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"my-parcel-project"</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;1.0.0&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.0.0"</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;scripts&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"scripts"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;watch&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;NODE_ENV=development parcel --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">"watch"</span><span class="p">:</span><span class="w"> </span><span class="s2">"NODE_ENV=development parcel --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js"</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;build&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;NODE_ENV=production parcel build --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js&quot;</span> <span class="w"> </span><span class="nt">"build"</span><span class="p">:</span><span class="w"> </span><span class="s2">"NODE_ENV=production parcel build --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js"</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nt">&quot;private&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span> <span class="w"> </span><span class="nt">"private"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span>
<span class="p">}</span> <span class="p">}</span>
</pre> </pre>
<p>Now we can use <code>yarn add</code> to add Parcel, <a href="https://babeljs.io/" rel="nofollow">Babel</a> and <a href="https://sass-lang.com/" rel="nofollow">Sass</a>:</p> <p>Now we can use <code>yarn add</code> to add Parcel, <a href="https://babeljs.io/" rel="nofollow">Babel</a> and <a href="https://sass-lang.com/" rel="nofollow">Sass</a>:</p>
@ -195,7 +195,7 @@ $ yarn add parcel-bundler babel-preset-env node-sass
<h3><code>parcel/babelr.rc</code></h3> <h3><code>parcel/babelr.rc</code></h3>
<p>Next up is a simple Babel config file, using the recommended <code>env</code> preset.</p> <p>Next up is a simple Babel config file, using the recommended <code>env</code> preset.</p>
<pre lang="json"><span class="p">{</span> <pre lang="json"><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;presets&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;env&quot;</span><span class="p">]</span> <span class="w"> </span><span class="nt">"presets"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"env"</span><span class="p">]</span>
<span class="p">}</span> <span class="p">}</span>
</pre> </pre>
<h3><code>parcel/main.scss</code></h3> <h3><code>parcel/main.scss</code></h3>
@ -206,7 +206,7 @@ $ yarn add parcel-bundler babel-preset-env node-sass
</pre> </pre>
<h3><code>parcel/main.js</code></h3> <h3><code>parcel/main.js</code></h3>
<p>A simple Javascript file that imports the SCSS file so that Parcel will know to include it as well.</p> <p>A simple Javascript file that imports the SCSS file so that Parcel will know to include it as well.</p>
<pre lang="javascript"><span class="k">import</span><span class="w"> </span><span class="s1">&#39;./main.scss&#39;</span><span class="p">;</span> <pre lang="javascript"><span class="k">import</span><span class="w"> </span><span class="s1">'./main.scss'</span><span class="p">;</span>
</pre> </pre>
<h2>Running the Server</h2> <h2>Running the Server</h2>
<p>Now you're ready to go. When you run <code>lektor server</code> nothing wil happen, <p>Now you're ready to go. When you run <code>lektor server</code> nothing wil happen,
@ -220,8 +220,8 @@ Lektor website that use this plugin.</p>
<p>To manually trigger a build that also invokes webpack you can use <code>lektor build -f npm</code>.</p> <p>To manually trigger a build that also invokes webpack you can use <code>lektor build -f npm</code>.</p>
<h2>Including The Files</h2> <h2>Including The Files</h2>
<p>Now you need to include the files in your template. This will do it:</p> <p>Now you need to include the files in your template. This will do it:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{{ &#39;/static/gen/main.css&#39;| asseturl }}&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">"stylesheet"</span> <span class="na">href</span><span class="o">=</span><span class="s">"{{ '/static/gen/main.css'| asseturl }}"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">text/javascript</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;{{ &#39;/static/gen/main.js&#39;| asseturl }}&quot;</span> <span class="na">charset</span><span class="o">=</span><span class="s">&quot;utf-8&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">text/javascript</span> <span class="na">src</span><span class="o">=</span><span class="s">"{{ '/static/gen/main.js'| asseturl }}"</span> <span class="na">charset</span><span class="o">=</span><span class="s">"utf-8"</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</pre> </pre>
<h2>Complete Working Example</h2> <h2>Complete Working Example</h2>
<p>The <code>examples</code> folder of this repository contains working projects.</p> <p>The <code>examples</code> folder of this repository contains working projects.</p>

View File

@ -188,17 +188,17 @@ determine whether the <code>body</code> field is interpreted as being <code>mark
<span class="k">[fields.body]</span> <span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">polymorphic</span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">polymorphic</span>
<span class="na">polymorphic_type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&#39;html&#39; if this.body.lstrip().startswith(&#39;&lt;&#39;) else &#39;markdown&#39;</span> <span class="na">polymorphic_type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">'html' if this.body.lstrip().startswith('&lt;') else 'markdown'</span>
</pre> </pre>
<p>In this case, the <code>body</code> field will be interpreted as raw HTML if the <p>In this case, the <code>body</code> field will be interpreted as raw HTML if the
content of that field starts with a “<code>&lt;</code>”, otherwise it will be content of that field starts with a “<code>&lt;</code>”, otherwise it will be
interpreted as <em>Markdown</em> text.</p> interpreted as <em>Markdown</em> text.</p>
<h2>Author</h2> <h2>Author</h2>
<p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org">dairiki@dairiki.org</a></p> <p>Jeff Dairiki <a href="mailto:dairiki@dairiki.org" rel="nofollow">dairiki@dairiki.org</a></p>
<h2>Changelog</h2> <h2>Changelog</h2>
<h3>0.1 — 2021-02-05</h3> <h3>0.1 — 2021-02-05</h3>
<p>No code changes.</p> <p>No code changes.</p>
<p>Update development status classifier to &quot;stable&quot;.</p> <p>Update development status classifier to "stable".</p>
<p>Test under python 3.9. Stop testing under 3.5.</p> <p>Test under python 3.9. Stop testing under 3.5.</p>
<h3>0.1b1 — 2020-05-04</h3> <h3>0.1b1 — 2020-05-04</h3>
<p>Initial release.</p> <p>Initial release.</p>

View File

@ -163,7 +163,7 @@
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu://&lt;YOUR-BUCKET&gt;/&lt;NAME-OF-FOLDER&gt;</span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu://&lt;YOUR-BUCKET&gt;/&lt;NAME-OF-FOLDER&gt;</span>
</pre> </pre>
<p>for example, if you want to deploy your site to a bucket name &quot;abcde&quot;, folder &quot;fjhi&quot;, you will need to add a server section as below:</p> <p>for example, if you want to deploy your site to a bucket name "abcde", folder "fjhi", you will need to add a server section as below:</p>
<pre lang="ini"><span class="k">[servers.qiniu]</span> <pre lang="ini"><span class="k">[servers.qiniu]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu</span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>

View File

@ -145,7 +145,7 @@
<h2>How to use</h2> <h2>How to use</h2>
<p>Insert the following line in the template (e.g. layout.html) which you would like to show navigation.</p> <p>Insert the following line in the template (e.g. layout.html) which you would like to show navigation.</p>
<pre><code>{% for i in this._path | root_relative_path_list %} <pre><code>{% for i in this._path | root_relative_path_list %}
&gt;&gt;&lt;a href=&quot;{{i[0]}}&quot;&gt;{{i[1]}}&lt;/a&gt; &gt;&gt;&lt;a href="{{i[0]}}"&gt;{{i[1]}}&lt;/a&gt;
{% endfor %} {% endfor %}
</code></pre> </code></pre>
<p>Then, navigation is shown as below in case the page 'blog/first-post/'</p> <p>Then, navigation is shown as below in case the page 'blog/first-post/'</p>
@ -154,7 +154,7 @@
<p>If you do not want to show current page in the navigation, modify template as below.</p> <p>If you do not want to show current page in the navigation, modify template as below.</p>
<pre><code>{% for i in this._path | root_relative_path_list %} <pre><code>{% for i in this._path | root_relative_path_list %}
{% if not loop.last %} {% if not loop.last %}
&gt;&gt;&lt;a href=&quot;{{i[0]}}&quot;&gt;{{i[1]}}&lt;/a&gt; &gt;&gt;&lt;a href="{{i[0]}}"&gt;{{i[1]}}&lt;/a&gt;
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</code></pre> </code></pre>

View File

@ -140,17 +140,17 @@ something like custom tags) in your fields (not templates), so your content
doesn't have to have repetitive snippets over and over.</p> doesn't have to have repetitive snippets over and over.</p>
<p>For example, my blog has some specific HTML that I add when I want an image with <p>For example, my blog has some specific HTML that I add when I want an image with
a border and caption to be displayed. The HTML looks like this:</p> a border and caption to be displayed. The HTML looks like this:</p>
<pre lang="html"> <span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;alignright&quot;</span><span class="p">&gt;</span> <pre lang="html"> <span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">"alignright"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;image-large.jpg&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"image-large.jpg"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;image.jpg&quot;</span> <span class="p">/&gt;</span> <span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">"image.jpg"</span> <span class="p">/&gt;</span>
<span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;caption&quot;</span><span class="p">&gt;</span>The caption<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">"caption"</span><span class="p">&gt;</span>The caption<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
</pre> </pre>
<p>Copy-pasting this every time gets tedious, and I have to search and replace it <p>Copy-pasting this every time gets tedious, and I have to search and replace it
in all the content files every time I want to make a change. With the in all the content files every time I want to make a change. With the
shortcodes plugin, this can be written as:</p> shortcodes plugin, this can be written as:</p>
<pre><code>[% image align=right link=&quot;image-large.jpg&quot; image=image.jpg caption=&quot;The caption&quot; %] <pre><code>[% image align=right link="image-large.jpg" image=image.jpg caption="The caption" %]
</code></pre> </code></pre>
<p>Much easier, cleaner and less repetitive.</p> <p>Much easier, cleaner and less repetitive.</p>
<h2>Installation</h2> <h2>Installation</h2>
@ -165,7 +165,7 @@ full Jinja templates, although (due to some limitations of ini files) they need
to be on one line.</p> to be on one line.</p>
<p>For instance, for the example above, the config file could be:</p> <p>For instance, for the example above, the config file could be:</p>
<pre lang="ini"><span class="k">[global]</span> <pre lang="ini"><span class="k">[global]</span>
<span class="na">image</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&#39;&lt;div class=&quot;align{{ align }}&quot;&gt;{% if link %}&lt;a href=&quot;{{ link }}&quot;{% if not link.startswith(&quot;http&quot;) %} data-lightbox=&quot;gallery&quot;{% endif %}&gt;{% endif %}&lt;img src=&quot;{{ image }}&quot;&gt;{% if link %}&lt;/a&gt;{% endif %}{% if caption %}&lt;span class=&quot;caption&quot;&gt;{{ caption }}&lt;/span&gt;{% endif %}&lt;/div&gt;&#39;</span> <span class="na">image</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">'&lt;div class="align{{ align }}"&gt;{% if link %}&lt;a href="{{ link }}"{% if not link.startswith("http") %} data-lightbox="gallery"{% endif %}&gt;{% endif %}&lt;img src="{{ image }}"&gt;{% if link %}&lt;/a&gt;{% endif %}{% if caption %}&lt;span class="caption"&gt;{{ caption }}&lt;/span&gt;{% endif %}&lt;/div&gt;'</span>
</pre> </pre>
<p>This will allow you to use shortcodes with optional arguments, like so:</p> <p>This will allow you to use shortcodes with optional arguments, like so:</p>
<pre><code># An image with no caption or link: <pre><code># An image with no caption or link:
@ -176,7 +176,7 @@ to be on one line.</p>
[% image align=right link=http://www.example.com image=hello.jpg %] [% image align=right link=http://www.example.com image=hello.jpg %]
# Link and caption: # Link and caption:
[% image align=right link=http://www.example.com image=hello.jpg caption=&quot;Hello!&quot; %] [% image align=right link=http://www.example.com image=hello.jpg caption="Hello!" %]
</code></pre> </code></pre>
<p>Shortcodes defined within the section named <code>global</code> will be processed <p>Shortcodes defined within the section named <code>global</code> will be processed
automatically inside any of your sites Markdown content. It is also possible to automatically inside any of your sites Markdown content. It is also possible to
@ -186,7 +186,7 @@ will only be applied when the template passed the content through a Jinja2
filter named <code>shortcode</code>. For example, if your HTML template references a field filter named <code>shortcode</code>. For example, if your HTML template references a field
called <code>body</code>, and your config has a section called <code>[special]</code>, you may request called <code>body</code>, and your config has a section called <code>[special]</code>, you may request
expanding shortcodes defined within the <code>special</code> section like so:</p> expanding shortcodes defined within the <code>special</code> section like so:</p>
<pre><code>{{ body|shortcodes(section=&quot;special&quot;) }} <pre><code>{{ body|shortcodes(section="special") }}
</code></pre> </code></pre>
<p>This will enable all shortcodes from the specified section, in addition to all <p>This will enable all shortcodes from the specified section, in addition to all
globally defined shortcodes. If no section is specified, the filter defaults to globally defined shortcodes. If no section is specified, the filter defaults to

View File

@ -131,10 +131,10 @@
<p>This is a simple Lektor plugin that creates a template filter to remove HTML tags from a string. The use it was created for was to do processing on HTML outputted from a Markdown content field. The Markdown is rendered into HTML, and this filter can turn that into simple text, which was then passed to the <a href="https://github.com/terminal-labs/lektor-natural-language" rel="nofollow">lektor-natural-language</a> filters to get keywords, unsullied by things like <code>&lt;div&gt;</code> tags.</p> <p>This is a simple Lektor plugin that creates a template filter to remove HTML tags from a string. The use it was created for was to do processing on HTML outputted from a Markdown content field. The Markdown is rendered into HTML, and this filter can turn that into simple text, which was then passed to the <a href="https://github.com/terminal-labs/lektor-natural-language" rel="nofollow">lektor-natural-language</a> filters to get keywords, unsullied by things like <code>&lt;div&gt;</code> tags.</p>
<p>Example usage:</p> <p>Example usage:</p>
<p><code>{{ this.body|striphtmltags }}</code></p> <p><code>{{ this.body|striphtmltags }}</code></p>
<pre lang="jinja"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">var</span> <span class="o">=</span> <span class="s1">&#39;&lt;p&gt;&lt;strong&gt;Hello&lt;/strong&gt;World!&lt;/p&gt;&#39;</span> <span class="cp">%}</span> <pre lang="jinja"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">var</span> <span class="o">=</span> <span class="s1">'&lt;p&gt;&lt;strong&gt;Hello&lt;/strong&gt;World!&lt;/p&gt;'</span> <span class="cp">%}</span>
<span class="cp">{{</span> <span class="nv">var</span><span class="o">|</span><span class="nf">striphtmltags</span> <span class="cp">}}</span> <span class="cp">{{</span> <span class="nv">var</span><span class="o">|</span><span class="nf">striphtmltags</span> <span class="cp">}}</span>
</pre> </pre>
<p>The last example will render as &quot;Hello World!&quot;</p> <p>The last example will render as "Hello World!"</p>

View File

@ -155,7 +155,7 @@ tea
</pre> </pre>
<p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p> <p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p>
<h2>Overview</h2> <h2>Overview</h2>
<p>Say you have a &quot;blog-post&quot; model like this:</p> <p>Say you have a "blog-post" model like this:</p>
<pre lang="ini"><span class="k">[model]</span> <pre lang="ini"><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog Post</span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog Post</span>
@ -167,7 +167,7 @@ tea
<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
{% for t in this.tags -%} {% for t in this.tags -%}
<span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{{ (&#39;/blog@tag/&#39; ~ t)|url }}&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"{{ ('/blog@tag/' ~ t)|url }}"</span><span class="p">&gt;</span>
All posts tagged {{ t }} All posts tagged {{ t }}
<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
@ -176,13 +176,13 @@ tea
{% endif %} {% endif %}
</pre> </pre>
<p>This expression in the template generates a <em>source path</em> for each of the blog post's tags:</p> <p>This expression in the template generates a <em>source path</em> for each of the blog post's tags:</p>
<pre lang="jinja"><span class="x">&#39;/blog@tag/&#39; ~ t</span> <pre lang="jinja"><span class="x">'/blog@tag/' ~ t</span>
</pre> </pre>
<p>Then if the tag is &quot;my-tag&quot;, the expression renders a source path like:</p> <p>Then if the tag is "my-tag", the expression renders a source path like:</p>
<pre><code>/blog/tag/my-tag <pre><code>/blog/tag/my-tag
</code></pre> </code></pre>
<p>A Lektor source path becomes an actual URL using the <code>url</code> filter. So the template generates URLs to tag pages like:</p> <p>A Lektor source path becomes an actual URL using the <code>url</code> filter. So the template generates URLs to tag pages like:</p>
<pre><code>&lt;a href=&quot;{{ ('/blog@tag/' ~ t)|url }}&quot;&gt;&lt;/a&gt; <pre><code>&lt;a href="{{ ('/blog@tag/' ~ t)|url }}"&gt;&lt;/a&gt;
</code></pre> </code></pre>
<p>This uses the source path expression from before, but pipes it through <code>url</code> to generate an actual link from the blog post to a tag page.</p> <p>This uses the source path expression from before, but pipes it through <code>url</code> to generate an actual link from the blog post to a tag page.</p>
<h2>Configuration</h2> <h2>Configuration</h2>
@ -202,7 +202,7 @@ tea
<pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.children.filter(F.tags.contains(tag))</span> <pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.children.filter(F.tags.contains(tag))</span>
</pre> </pre>
<p>You can sort and filter with any expression:</p> <p>You can sort and filter with any expression:</p>
<pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.children.filter(F.tags.contains(tag) and F.status == &#39;published&#39;).order_by(&#39;-pub_date&#39;)</span> <pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.children.filter(F.tags.contains(tag) and F.status == 'published').order_by('-pub_date')</span>
</pre> </pre>
<p>If the parent page has <a href="https://www.getlektor.com/docs/guides/pagination/" rel="nofollow">a pagination query</a> you may want to use it for tagged pages:</p> <p>If the parent page has <a href="https://www.getlektor.com/docs/guides/pagination/" rel="nofollow">a pagination query</a> you may want to use it for tagged pages:</p>
<pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.pagination.items.filter(F.tags.contains(tag))</span> <pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.pagination.items.filter(F.tags.contains(tag))</span>
@ -223,7 +223,7 @@ tea
<span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span>Items:<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span>Items:<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
{% for i in this.items %} {% for i in this.items %}
<span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{{ i|url }}&quot;</span><span class="p">&gt;</span>{{ i._id }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"{{ i|url }}"</span><span class="p">&gt;</span>{{ i._id }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
{% else %} {% else %}
<span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">em</span><span class="p">&gt;</span>No items.<span class="p">&lt;/</span><span class="nt">em</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">em</span><span class="p">&gt;</span>No items.<span class="p">&lt;/</span><span class="nt">em</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
{% endfor %} {% endfor %}
@ -242,27 +242,27 @@ tea
<p>Default false. To set true, add this line to <code>tags.ini</code>:</p> <p>Default false. To set true, add this line to <code>tags.ini</code>:</p>
<pre lang="ini"><span class="na">ignore_missing</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span> <pre lang="ini"><span class="na">ignore_missing</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
</pre> </pre>
<p>This allows URLs to missing tag pages to be silently replaced with &quot;&quot;. The example use case is if your <code>blog-post.html</code> template includes a statement like:</p> <p>This allows URLs to missing tag pages to be silently replaced with "". The example use case is if your <code>blog-post.html</code> template includes a statement like:</p>
<pre lang="html">{% for t in this.tags -%} <pre lang="html">{% for t in this.tags -%}
<span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{{ (&#39;/blog@tag/&#39; ~ t)|url }}&quot;</span><span class="p">&gt;</span>{{ t }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"{{ ('/blog@tag/' ~ t)|url }}"</span><span class="p">&gt;</span>{{ t }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
{% endfor %} {% endfor %}
</pre> </pre>
<p>If a blog post <em>draft</em> is not discoverable, and it has any new tags used by no published blog posts, then those tag pages do not yet exist. Turn on <code>ignore_missing</code> to allow such drafts to be built. The tag-page URL path will be the empty string &quot;&quot;, until the draft is published and the tag page is created.</p> <p>If a blog post <em>draft</em> is not discoverable, and it has any new tags used by no published blog posts, then those tag pages do not yet exist. Turn on <code>ignore_missing</code> to allow such drafts to be built. The tag-page URL path will be the empty string "", until the draft is published and the tag page is created.</p>
<h3><code>tags</code></h3> <h3><code>tags</code></h3>
<p>Advanced configuration. An expression for the set of tags. Note that this expression is also useful in a template to get a list of all tags. The default expression is:</p> <p>Advanced configuration. An expression for the set of tags. Note that this expression is also useful in a template to get a list of all tags. The default expression is:</p>
<pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.distinct(&quot;tags&quot;)</span> <pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.distinct("tags")</span>
</pre> </pre>
<p>If you set <code>tags_field</code> to a different field name than &quot;tags&quot;, the default expression uses your custom field name. For example if you have this line in <code>tags.ini</code>:</p> <p>If you set <code>tags_field</code> to a different field name than "tags", the default expression uses your custom field name. For example if you have this line in <code>tags.ini</code>:</p>
<pre lang="ini"><span class="na">tags_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">labels</span> <pre lang="ini"><span class="na">tags_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">labels</span>
</pre> </pre>
<p>Then the default value of <code>tags</code> is:</p> <p>Then the default value of <code>tags</code> is:</p>
<pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.distinct(&quot;labels&quot;)</span> <pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.distinct("labels")</span>
</pre> </pre>
<p>You can use any template expression. For example, if your items have a &quot;published&quot; boolean field, you can select tags of published items:</p> <p>You can use any template expression. For example, if your items have a "published" boolean field, you can select tags of published items:</p>
<pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.filter(F.published).distinct(&quot;tags&quot;)</span> <pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.filter(F.published).distinct("tags")</span>
</pre> </pre>
<p>Or even list your tags manually:</p> <p>Or even list your tags manually:</p>
<pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">[&quot;tag1&quot;, &quot;tag2&quot;]</span> <pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">["tag1", "tag2"]</span>
</pre> </pre>
<p>See <a href="https://www.getlektor.com/docs/api/db/query/" rel="nofollow">the Lektor documentation for queries</a>.</p> <p>See <a href="https://www.getlektor.com/docs/api/db/query/" rel="nofollow">the Lektor documentation for queries</a>.</p>
<p>Tags are always deduplicated. Tags are sorted in the order listed in the contents.lr / admin, allowing you to control their order manually. Since <code>{{ tags }}</code> simply returns a list, you can always apply any Jinja2 filter on that list such as sort, slice, or rejectattr.</p> <p>Tags are always deduplicated. Tags are sorted in the order listed in the contents.lr / admin, allowing you to control their order manually. Since <code>{{ tags }}</code> simply returns a list, you can always apply any Jinja2 filter on that list such as sort, slice, or rejectattr.</p>
@ -280,7 +280,7 @@ tea
<p>This is the basic weight, used as a base for the following tags.</p> <p>This is the basic weight, used as a base for the following tags.</p>
<h4>Example: Tags (with tag count) sorted by tag count (most used first)</h4> <h4>Example: Tags (with tag count) sorted by tag count (most used first)</h4>
<pre lang="jinja"><span class="x">&lt;ul&gt;</span> <pre lang="jinja"><span class="x">&lt;ul&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="o">(</span><span class="nv">tagweights</span><span class="o">()</span> <span class="o">|</span> <span class="nf">dictsort</span><span class="o">(</span><span class="nv">by</span><span class="o">=</span><span class="s1">&#39;value&#39;</span><span class="o">,</span> <span class="nv">reverse</span><span class="o">=</span><span class="kp">true</span><span class="o">))</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="o">(</span><span class="nv">tagweights</span><span class="o">()</span> <span class="o">|</span> <span class="nf">dictsort</span><span class="o">(</span><span class="nv">by</span><span class="o">=</span><span class="s1">'value'</span><span class="o">,</span> <span class="nv">reverse</span><span class="o">=</span><span class="kp">true</span><span class="o">))</span> <span class="cp">%}</span>
<span class="x"> &lt;li&gt;</span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span><span class="x"> (</span><span class="cp">{{</span> <span class="nv">weight.count</span> <span class="cp">}}</span><span class="x"> articles).&lt;/li&gt;</span> <span class="x"> &lt;li&gt;</span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span><span class="x"> (</span><span class="cp">{{</span> <span class="nv">weight.count</span> <span class="cp">}}</span><span class="x"> articles).&lt;/li&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="x">&lt;/ul&gt;</span> <span class="x">&lt;/ul&gt;</span>
@ -297,8 +297,8 @@ tea
<h4>Example: Most used tag is twice as big as least used tag</h4> <h4>Example: Most used tag is twice as big as least used tag</h4>
<pre lang="jinja"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="nv">tagweights</span><span class="o">()|</span><span class="nf">dictsort</span> <span class="cp">%}</span> <pre lang="jinja"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="nv">tagweights</span><span class="o">()|</span><span class="nf">dictsort</span> <span class="cp">%}</span>
<span class="x">&lt;a</span> <span class="x">&lt;a</span>
<span class="x"> href=&quot;</span><span class="cp">{{</span> <span class="o">(</span><span class="s1">&#39;/blog@tag/&#39;</span> <span class="o">~</span> <span class="nv">tag</span><span class="o">)|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&quot;</span> <span class="x"> href="</span><span class="cp">{{</span> <span class="o">(</span><span class="s1">'/blog@tag/'</span> <span class="o">~</span> <span class="nv">tag</span><span class="o">)|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">"</span>
<span class="x"> style=&quot;font-size: </span><span class="cp">{{</span> <span class="nv">weight.log</span><span class="o">(</span><span class="m">100</span><span class="o">,</span> <span class="m">200</span><span class="o">)|</span><span class="nf">round</span><span class="o">|</span><span class="nf">int</span> <span class="cp">}}</span><span class="x">%;&quot;</span> <span class="x"> style="font-size: </span><span class="cp">{{</span> <span class="nv">weight.log</span><span class="o">(</span><span class="m">100</span><span class="o">,</span> <span class="m">200</span><span class="o">)|</span><span class="nf">round</span><span class="o">|</span><span class="nf">int</span> <span class="cp">}}</span><span class="x">%;"</span>
<span class="x"> &gt;</span> <span class="x"> &gt;</span>
<span class="x"> </span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span> <span class="x"> </span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span>
<span class="x"> &lt;/a&gt;</span> <span class="x"> &lt;/a&gt;</span>
@ -314,8 +314,8 @@ tea
<h4>Example: Tags are given CSS classes <code>tagcloud-tiny</code>, <code>tagcloud-small</code>, etc.</h4> <h4>Example: Tags are given CSS classes <code>tagcloud-tiny</code>, <code>tagcloud-small</code>, etc.</h4>
<pre lang="jinja"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="nv">tagweights</span><span class="o">()|</span><span class="nf">dictsort</span> <span class="cp">%}</span> <pre lang="jinja"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="nv">tagweights</span><span class="o">()|</span><span class="nf">dictsort</span> <span class="cp">%}</span>
<span class="x">&lt;a</span> <span class="x">&lt;a</span>
<span class="x"> href=&quot;</span><span class="cp">{{</span> <span class="o">(</span><span class="s1">&#39;/blog@tag/&#39;</span> <span class="o">~</span> <span class="nv">tag</span><span class="o">)|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&quot;</span> <span class="x"> href="</span><span class="cp">{{</span> <span class="o">(</span><span class="s1">'/blog@tag/'</span> <span class="o">~</span> <span class="nv">tag</span><span class="o">)|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">"</span>
<span class="x"> class=&quot;tagcloud-</span><span class="cp">{{</span> <span class="nv">weight.loggroup</span><span class="o">([</span><span class="s2">&quot;tiny&quot;</span><span class="o">,</span> <span class="s2">&quot;small&quot;</span><span class="o">,</span> <span class="s2">&quot;normal&quot;</span><span class="o">,</span> <span class="s2">&quot;big&quot;</span><span class="o">,</span> <span class="s2">&quot;large&quot;</span><span class="o">])</span> <span class="cp">}}</span><span class="x">&quot;</span> <span class="x"> class="tagcloud-</span><span class="cp">{{</span> <span class="nv">weight.loggroup</span><span class="o">([</span><span class="s2">"tiny"</span><span class="o">,</span> <span class="s2">"small"</span><span class="o">,</span> <span class="s2">"normal"</span><span class="o">,</span> <span class="s2">"big"</span><span class="o">,</span> <span class="s2">"large"</span><span class="o">])</span> <span class="cp">}}</span><span class="x">"</span>
<span class="x"> &gt;</span> <span class="x"> &gt;</span>
<span class="x"> </span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span> <span class="x"> </span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span>
<span class="x"> &lt;/a&gt;</span> <span class="x"> &lt;/a&gt;</span>

View File

@ -144,7 +144,7 @@ $<span class="w"> </span>lektor<span class="w"> </span>plugin<span class="w"> </
<p>Configure your template paths</p> <p>Configure your template paths</p>
<p>In <code>tailwindcss.config.js</code>:</p> <p>In <code>tailwindcss.config.js</code>:</p>
<pre lang="javascript"><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span> <pre lang="javascript"><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">content</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s1">&#39;./templates/**/*.{html,j2}&#39;</span><span class="p">],</span> <span class="w"> </span><span class="nx">content</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s1">'./templates/**/*.{html,j2}'</span><span class="p">],</span>
<span class="w"> </span><span class="nx">theme</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">theme</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">extend</span><span class="o">:</span><span class="w"> </span><span class="p">{},</span> <span class="w"> </span><span class="nx">extend</span><span class="o">:</span><span class="w"> </span><span class="p">{},</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>

View File

@ -135,7 +135,7 @@ content, but still want thumbnails to be generated for the link itself. For
example, you may have an image called <code>cat.jpg</code>, and to link to it in the example, you may have an image called <code>cat.jpg</code>, and to link to it in the
<em>content</em> (not the template), but also show a thumbnail.</p> <em>content</em> (not the template), but also show a thumbnail.</p>
<p>You can do that like so:</p> <p>You can do that like so:</p>
<pre><code>&lt;a href=&quot;cat.jpg&quot;&gt;&lt;img src=&quot;cat-small.jpg&quot; /&gt;&lt;/a&gt; <pre><code>&lt;a href="cat.jpg"&gt;&lt;img src="cat-small.jpg" /&gt;&lt;/a&gt;
</code></pre> </code></pre>
<h2>Installation</h2> <h2>Installation</h2>
<p>To install the plugin, just add <code>lektor-thumbnail-generator</code> to your plugins <p>To install the plugin, just add <code>lektor-thumbnail-generator</code> to your plugins

View File

@ -138,34 +138,34 @@
These files will then be copied over to Lektors templates folder so that they can be used by Lektor. These files will then be copied over to Lektors templates folder so that they can be used by Lektor.
This plugin depends on the <a href="https://github.com/lektor/lektor-webpack-support" rel="nofollow">lektor-webpack-support</a> plugin to be really useful.</p> This plugin depends on the <a href="https://github.com/lektor/lektor-webpack-support" rel="nofollow">lektor-webpack-support</a> plugin to be really useful.</p>
<h1>webpack/webpack.config.js</h1> <h1>webpack/webpack.config.js</h1>
<pre lang="js"><span class="kd">const</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;path&quot;</span><span class="p">);</span> <pre lang="js"><span class="kd">const</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">"path"</span><span class="p">);</span>
<span class="kd">const</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;mini-css-extract-plugin&quot;</span><span class="p">);</span> <span class="kd">const</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">"mini-css-extract-plugin"</span><span class="p">);</span>
<span class="kd">const</span><span class="w"> </span><span class="nx">HtmlWebpackPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;html-webpack-plugin&quot;</span><span class="p">);</span> <span class="kd">const</span><span class="w"> </span><span class="nx">HtmlWebpackPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">"html-webpack-plugin"</span><span class="p">);</span>
<span class="kd">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">CleanWebpackPlugin</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;clean-webpack-plugin&quot;</span><span class="p">);</span> <span class="kd">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">CleanWebpackPlugin</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">"clean-webpack-plugin"</span><span class="p">);</span>
<span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span> <span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">mode</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;production&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nx">mode</span><span class="o">:</span><span class="w"> </span><span class="s2">"production"</span><span class="p">,</span>
<span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">main</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./src/index.js&quot;</span> <span class="w"> </span><span class="nx">main</span><span class="o">:</span><span class="w"> </span><span class="s2">"./src/index.js"</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].bundle.js&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">"[name].bundle.js"</span><span class="p">,</span>
<span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="s2">&quot;/assets/generated&quot;</span><span class="w"> </span> <span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="s2">"/assets/generated"</span><span class="w"> </span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">optimization</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">optimization</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">minimizer</span><span class="o">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="nx">minimizer</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">HtmlWebpackPlugin</span><span class="p">({</span> <span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">HtmlWebpackPlugin</span><span class="p">({</span>
<span class="w"> </span><span class="nx">inject</span><span class="o">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span> <span class="w"> </span><span class="nx">inject</span><span class="o">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;layout_generated.html&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">"layout_generated.html"</span><span class="p">,</span>
<span class="w"> </span><span class="nx">template</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./src/layout_template.html&quot;</span> <span class="w"> </span><span class="nx">template</span><span class="o">:</span><span class="w"> </span><span class="s2">"./src/layout_template.html"</span>
<span class="w"> </span><span class="p">})</span> <span class="w"> </span><span class="p">})</span>
<span class="w"> </span><span class="p">],</span> <span class="w"> </span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">CleanWebpackPlugin</span><span class="p">(),</span> <span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">CleanWebpackPlugin</span><span class="p">(),</span>
<span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">({</span> <span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">({</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].css&quot;</span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">"[name].css"</span>
<span class="w"> </span><span class="p">})</span> <span class="w"> </span><span class="p">})</span>
<span class="w"> </span><span class="p">],</span> <span class="w"> </span><span class="p">],</span>
<span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
@ -173,8 +173,8 @@ This plugin depends on the <a href="https://github.com/lektor/lektor-webpack-sup
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span> <span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span>
<span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">"css-loader"</span><span class="p">,</span>
<span class="w"> </span><span class="s2">&quot;sass-loader&quot;</span> <span class="w"> </span><span class="s2">"sass-loader"</span>
<span class="w"> </span><span class="p">]</span> <span class="w"> </span><span class="p">]</span>
<span class="w"> </span><span class="p">}]</span> <span class="w"> </span><span class="p">}]</span>
<span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span>
@ -182,16 +182,16 @@ This plugin depends on the <a href="https://github.com/lektor/lektor-webpack-sup
</pre> </pre>
<h1>webpack/src/layout_template.html</h1> <h1>webpack/src/layout_template.html</h1>
<pre lang="html"><span class="cp">&lt;!DOCTYPE html&gt;</span> <pre lang="html"><span class="cp">&lt;!DOCTYPE html&gt;</span>
<span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">&quot;en&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">"en"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&quot;UTF-8&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">"UTF-8"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;viewport&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;width=device-width, initial-scale=1.0&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">"viewport"</span> <span class="na">content</span><span class="o">=</span><span class="s">"width=device-width, initial-scale=1.0"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;X-UA-Compatible&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;ie=edge&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">"X-UA-Compatible"</span> <span class="na">content</span><span class="o">=</span><span class="s">"ie=edge"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>{{ this.title }} <span class="ni">&amp;middot;</span> {{ config.PROJECT.name }} <span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>{{ this.title }} <span class="ni">&amp;middot;</span> {{ config.PROJECT.name }} <span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span>
<span class="err">&lt;</span>% for (var css in htmlWebpackPlugin.files.css) { %&gt; <span class="err">&lt;</span>% for (var css in htmlWebpackPlugin.files.css) { %&gt;
<span class="p">&lt;</span><span class="nt">link</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{{ &#39;/generated/&lt;%= htmlWebpackPlugin.files.css[css] %&gt;&#39; | asseturl }}&quot;</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">link</span> <span class="na">href</span><span class="o">=</span><span class="s">"{{ '/generated/&lt;%= htmlWebpackPlugin.files.css[css] %&gt;' | asseturl }}"</span> <span class="na">rel</span><span class="o">=</span><span class="s">"stylesheet"</span><span class="p">&gt;</span>
<span class="err">&lt;</span>% } %&gt; <span class="err">&lt;</span>% } %&gt;
<span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span>
@ -202,7 +202,7 @@ This plugin depends on the <a href="https://github.com/lektor/lektor-webpack-sup
<span class="p">&lt;/</span><span class="nt">main</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">main</span><span class="p">&gt;</span>
<span class="err">&lt;</span>% for (var chunk in htmlWebpackPlugin.files.chunks) { %&gt; <span class="err">&lt;</span>% for (var chunk in htmlWebpackPlugin.files.chunks) { %&gt;
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;{{ &#39;/generated/&lt;%= htmlWebpackPlugin.files.chunks[chunk].entry %&gt;&#39; | asseturl }}&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">"{{ '/generated/&lt;%= htmlWebpackPlugin.files.chunks[chunk].entry %&gt;' | asseturl }}"</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="err">&lt;</span>% } %&gt; <span class="err">&lt;</span>% } %&gt;
<span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span>

View File

@ -163,9 +163,9 @@ inside that folder create <code>package.json</code> and a <code>webpack.config.j
start is to create an almost empty file (name and version fields are mandatory start is to create an almost empty file (name and version fields are mandatory
but not important for functionality, change them to suit your own needs):</p> but not important for functionality, change them to suit your own needs):</p>
<pre lang="json"><span class="p">{</span> <pre lang="json"><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;lektor-webpack&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"lektor-webpack"</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;1.0.0&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.0.0"</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;private&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span> <span class="w"> </span><span class="nt">"private"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span>
<span class="p">}</span> <span class="p">}</span>
</pre> </pre>
<p>Now we can <code>npm install</code> (or <code>yarn add</code>) the rest:</p> <p>Now we can <code>npm install</code> (or <code>yarn add</code>) the rest:</p>
@ -182,42 +182,42 @@ setup that's good enough to cover most things you will encounter. The
idea is to build the files from <code>webpack/scss</code> and <code>webpack/js</code> into idea is to build the files from <code>webpack/scss</code> and <code>webpack/js</code> into
<code>assets/static/gen</code> so that we can use it even if we do not have webpack <code>assets/static/gen</code> so that we can use it even if we do not have webpack
installed for as long as someone else ran it before.</p> installed for as long as someone else ran it before.</p>
<pre lang="javascript"><span class="kd">const</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;path&quot;</span><span class="p">);</span> <pre lang="javascript"><span class="kd">const</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">"path"</span><span class="p">);</span>
<span class="kd">const</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;mini-css-extract-plugin&quot;</span><span class="p">);</span> <span class="kd">const</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">"mini-css-extract-plugin"</span><span class="p">);</span>
<span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span> <span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">app</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./js/main.js&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nx">app</span><span class="o">:</span><span class="w"> </span><span class="s2">"./js/main.js"</span><span class="p">,</span>
<span class="w"> </span><span class="nx">styles</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./scss/main.scss&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nx">styles</span><span class="o">:</span><span class="w"> </span><span class="s2">"./scss/main.scss"</span><span class="p">,</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">),</span><span class="w"> </span><span class="s2">&quot;assets&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;static&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;gen&quot;</span><span class="p">),</span> <span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">),</span><span class="w"> </span><span class="s2">"assets"</span><span class="p">,</span><span class="w"> </span><span class="s2">"static"</span><span class="p">,</span><span class="w"> </span><span class="s2">"gen"</span><span class="p">),</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].js&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">"[name].js"</span><span class="p">,</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">devtool</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;source-map&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nx">devtool</span><span class="o">:</span><span class="w"> </span><span class="s2">"source-map"</span><span class="p">,</span>
<span class="w"> </span><span class="nx">mode</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;production&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nx">mode</span><span class="o">:</span><span class="w"> </span><span class="s2">"production"</span><span class="p">,</span>
<span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">rules</span><span class="o">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="nx">rules</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.js$/</span><span class="p">,</span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.js$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">exclude</span><span class="o">:</span><span class="w"> </span><span class="sr">/node_modules/</span><span class="p">,</span> <span class="w"> </span><span class="nx">exclude</span><span class="o">:</span><span class="w"> </span><span class="sr">/node_modules/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;babel-loader&quot;</span><span class="p">],</span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"babel-loader"</span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;sass-loader&quot;</span><span class="p">],</span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"> </span><span class="s2">"css-loader"</span><span class="p">,</span><span class="w"> </span><span class="s2">"sass-loader"</span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.css$/</span><span class="p">,</span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.css$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">],</span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"> </span><span class="s2">"css-loader"</span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/</span><span class="p">,</span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;file&quot;</span><span class="p">],</span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"file"</span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">],</span> <span class="w"> </span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="ow">new</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">({</span><span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;styles.css&quot;</span><span class="w"> </span><span class="p">})],</span> <span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="ow">new</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">({</span><span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">"styles.css"</span><span class="w"> </span><span class="p">})],</span>
<span class="p">};</span> <span class="p">};</span>
</pre> </pre>
<h2>Creating the App</h2> <h2>Creating the App</h2>
@ -238,8 +238,8 @@ Lektor website that uses webpack.</p>
<code>lektor build -f webpack</code>.</p> <code>lektor build -f webpack</code>.</p>
<h2>Including The Files</h2> <h2>Including The Files</h2>
<p>Now you need to include the files in your template. This will do it:</p> <p>Now you need to include the files in your template. This will do it:</p>
<pre lang="html"><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{{ &#39;/static/gen/styles.css&#39;|asseturl }}&quot;</span><span class="p">&gt;</span> <pre lang="html"><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">"stylesheet"</span> <span class="na">href</span><span class="o">=</span><span class="s">"{{ '/static/gen/styles.css'|asseturl }}"</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">text/javascript</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;{{ &#39;/static/gen/app.js&#39;|asseturl }}&quot;</span> <span class="na">charset</span><span class="o">=</span><span class="s">&quot;utf-8&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">text/javascript</span> <span class="na">src</span><span class="o">=</span><span class="s">"{{ '/static/gen/app.js'|asseturl }}"</span> <span class="na">charset</span><span class="o">=</span><span class="s">"utf-8"</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</pre> </pre>