<!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 <jogo at matabio dot net> package IkiWiki::Plugin::unixrelpagespec; use warnings; use strict; use IkiWiki 3.00; sub import { inject( name => 'IkiWiki::PageSpec::derel', call => \&unix_derel ); } sub unix_derel ($$) { my $path = shift; my $from = shift; if ($path =~ m!^\.{1,2}/!) { $from =~ s#/?[^/]+$## if (defined $from and $path =~ m/^\.{2}/); $path =~ s#^\.{1,2}/##; $path = "$from/$path" if length $from; } return $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>