Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > d8544620e4ac7bee48ddb48c85d55709 > files > 241

ikiwiki-3.20190228-1.mga7.noarch.rpm

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>datetime_cmp (third party plugin)</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="../../style.css" type="text/css" />

<link rel="stylesheet" href="../../local.css" type="text/css" />






<meta name="author" content="spalax" />



</head>
<body>

<div class="page">

<div class="pageheader">
<div class="header">
<span>
<span class="parentlinks">

<a href="../../index.html">ikiwiki</a>/ 

<a href="../../plugins.html">plugins</a>/ 

<a href="../contrib.html">contrib</a>/ 

</span>
<span class="title">
datetime_cmp (third party plugin)

</span>
</span>



</div>









</div>





<div id="pagebody">

<div id="content" role="main">
<p><span class="infobox">
Plugin: datetime_cmp<br />
Author: <span class="createlink">Louis</span><br />
Included in ikiwiki: no<br />
Enabled by default: no<br />
Included in <a href="../goodstuff.html">goodstuff</a>: no<br />
Currently enabled: no<br />
</span></p>

<h1>Datetime_cmp</h1>

<p>This plugin provides a family of
<a href="http://ikiwiki.info/ikiwiki/pagespec/">pagespec</a> matching pages according to
creation or modification times.</p>

<p>It also sets the date of the next modification of the page on relevant date, so
that the page will be rebuilt if the condition changes.</p>

<p>It requires the DateTime::Format::Duration perl module (on Debian : <code>apt-get install libdatetime-format-duration-perl</code>).</p>

<h2>List of functions</h2>

<p>The list of functions is given by the following regexp:</p>

<pre><code>[ct](date|time)_(lt|gt|leq|geq|eq|neq)_(abs|page|now|today)(|_delta)
</code></pre>

<p>where:</p>

<ul>
<li><code>[ct]</code>: compare creation or modification time or date:
<ul>
<li><code>c</code>reation time;</li>
<li><code>m</code>odification time.</li>
</ul></li>
<li><code>(date|time)</code>: compare full date and time, or only date (useful when time is irrelevant):
<ul>
<li><code>time</code>: compare full date and time;</li>
<li><code>date</code>: compare only date.</li>
</ul></li>
<li><code>(lt|gt|leq|geq|eq|neq)</code>: operator of comparison:
<ul>
<li><code>lt</code>: less than;</li>
<li><code>gt</code>: greater than;</li>
<li><code>leq</code>: less or equal than;</li>
<li><code>geq</code>: greater or equal than;</li>
<li><code>eq</code>: equal;</li>
<li><code>neq</code>: not equal.</li>
</ul></li>
<li><code>(abs|page|now|today)</code>: element to compare to:
<ul>
<li><code>abs</code>: absolute date or time (given in argument);</li>
<li><code>page</code>: other page (given in argument);</li>
<li><code>now</code>: date or time of compilation;</li>
<li><code>today</code>: same meaning as <code>now</code>.</li>
</ul></li>
<li><code>(|_delta)</code>: used to add a time delta (to use comparisons such as <em>created at least two days after <code>some_page</code></em>):
<ul>
<li><em>empty</em>: no delta;</li>
<li><code>_delta</code>: delta (given in argument).</li>
</ul></li>
</ul>

<h3>Number of arguments</h3>

<table>
        <tr>
            <td>
</td>
            <td><code>now</code> <code>today</code>  </td>
            <td><code>page</code>            </td>
            <td><code>abs</code></td>
        </tr>
        <tr>
            <td>no delta </td>
            <td><em>no arguments</em> </td>
            <td><code>pagename</code>        </td>
            <td><code>date</code></td>
        </tr>
        <tr>
            <td>delta    </td>
            <td><code>delta</code>        </td>
            <td><code>pagename, delta</code> </td>
            <td><code>date, delta</code></td>
        </tr>
</table>

<h3>Format of arguments</h3>

<ul>
<li><em>date</em> or <em>time</em>: anything that can be recognized by perl <a href="http://search.cpan.org/~rse/lcwa-1.0.0/lib/lwp/lib/HTTP/Date.pm">str2time</a> function, <em>without any comma</em>.</li>
<li><em>delta</em>: One of the following patterns:
<ul>
<li><code>Y-M-D</code>: positive date;</li>
<li><code>H:M:S</code>: positive time;</li>
<li><code>Y-M-D H:M:S</code>: positive date and time;</li>
<li>Add <code>-</code> at the beginning of the string to make durations negative.</li>
</ul></li>
<li>several arguments: when two arguments are provided, they are passed as one string, which is then split according to the last comma.</li>
</ul>

<h2>Time zones</h2>

<p>Key <code>timezone</code> in the setup file is used to define time zone. If not set, we
try to guess the local time zone.</p>

<h2>Examples</h2>

<h3>Some functions</h3>

<ul>
<li><code>ctime_gt_page(foo)</code>: match pages created after page <code>foo</code>.</li>
<li><code>cdate_eq_today()</code>: match pages created the day the wiki is compiled.</li>
<li><code>mtime_eq_now()</code>: match pages modified the time the wiki is compiled (likely no page, since comparison is done up to the milisecond).</li>
<li><code>cdate_geq_page_delta(foo, 00-00-01)</code>: match pages created at least one day after page <code>foo</code>.</li>
<li><code>cdate_gt_page(foo)</code>: same as the previous one.</li>
<li><code>mdate_gt_today_delta(-00-01-00)</code>: match pages modified one month ago, or later (can be used to display recent changes).</li>
</ul>

<h3>Use case</h3>

<p>It can be used to display a list of upcoming events.</p>

<pre><code>[[!inline  pages="events/* and cdate_geq_today()" reverse=yes sorted=meta(date)]]
</code></pre>

<h2>Code</h2>

<p>Code and documentation this way: <a href="https://atelier.gresille.org/projects/gresille-ikiwiki/wiki/datetime_cmp">https://atelier.gresille.org/projects/gresille-ikiwiki/wiki/datetime_cmp</a>.</p>

</div>







</div>

<div id="footer" class="pagefooter" role="contentinfo">

<div id="pageinfo">




<div class="tags">
Tags:

<span class="createlink">type/pagespec</span>

</div>



<div id="backlinks">
Links:

<a href="./created_in_future.html">created in future</a>


</div>






<div class="pagedate">
Last edited <span class="date">Tue Feb 26 23:01:54 2019</span>
<!-- Created <span class="date">Tue Feb 26 23:01:54 2019</span> -->
</div>

</div>


<!-- from ikiwiki -->
</div>

</div>

</body>
</html>