Sophie

Sophie

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

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>unixrelpagespec (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" />










</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">
unixrelpagespec (third party plugin)

</span>
</span>



</div>









</div>





<div id="pagebody">

<div id="content" role="main">
<p><span class="infobox">
Plugin: unixrelpagespec<br />
Author: <span class="createlink">Jogo</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>

<p>I don't understand why <code>./*</code> correspond to siblings and not subpages.
This is probably only meaningfull with <a href="../autoindex.html">autoindex</a> turned on.</p>

<p>Here is a small plugin wich follow usual Unix convention :</p>

<ul>
<li><code>./*</code> expand to subpages</li>
<li><code>../*</code> expand to siblings</li>
</ul>

<hr />

<pre><code>#!/usr/bin/perl
# UnixRelPageSpec plugin.
# by Joseph Boudou &lt;jogo at matabio dot net&gt;

package IkiWiki::Plugin::unixrelpagespec;

use warnings;
use strict;
use IkiWiki 3.00;

sub import {
    inject(
        name =&gt; 'IkiWiki::PageSpec::derel',
        call =&gt; \&amp;unix_derel
    );
}

sub unix_derel (&#036;&#036;) {
    my &#036;path = shift;
    my &#036;from = shift;

    if (&#036;path =~ m!^\.{1,2}/!) {
        &#036;from =~ s#/?[^/]+&#036;## if (defined &#036;from and &#036;path =~ m/^\.{2}/);
        &#036;path =~ s#^\.{1,2}/##;
        &#036;path = "&#036;from/&#036;path" if length &#036;from;
    }

    return &#036;path;
}

1;
</code></pre>

</div>







</div>

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

<div id="pageinfo">











<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>