<!DOCTYPE html>
<html lang='en'>
<head>
<title>releasing version 2.68 - ikiwiki-upstream - Unnamed repository; edit this file to name it for gitweb.</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-css/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-local/local.css'/>
<script type='text/javascript' src='/cgit.js'></script>
<link rel='shortcut icon' href='/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://source.jones.dk/ikiwiki-upstream/atom/.perlcriticrc?h=master' type='application/atom+xml'/>
<link rel='vcs-git' href='https://source.jones.dk/ikiwiki-upstream' title='ikiwiki-upstream Git repository'/>
<link rel='vcs-git' href='user@source.jones.dk:ikiwiki-upstream' title='ikiwiki-upstream Git repository'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='/cgit-css/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/ikiwiki-upstream/'>ikiwiki-upstream</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='2e00af6096b47cff141acc1965d75178471b1878'/><select name='h' onchange='this.form.submit();'>
<option value='layoutgala'>layoutgala</option>
<option value='master' selected='selected'>master</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Unnamed repository; edit this file to name it for gitweb.</td><td class='sub right'>Jonas Smedegaard</td></tr></table>
<table class='tabs'><tr><td>
<a href='/ikiwiki-upstream/'>summary</a><a href='/ikiwiki-upstream/refs/?id=2e00af6096b47cff141acc1965d75178471b1878'>refs</a><a href='/ikiwiki-upstream/log/.perlcriticrc'>log</a><a href='/ikiwiki-upstream/tree/.perlcriticrc?id=2e00af6096b47cff141acc1965d75178471b1878'>tree</a><a class='active' href='/ikiwiki-upstream/commit/.perlcriticrc?id=2e00af6096b47cff141acc1965d75178471b1878'>commit</a><a href='/ikiwiki-upstream/diff/.perlcriticrc?id=2e00af6096b47cff141acc1965d75178471b1878'>diff</a></td><td class='form'><form class='right' method='get' action='/ikiwiki-upstream/log/.perlcriticrc'>
<input type='hidden' name='id' value='2e00af6096b47cff141acc1965d75178471b1878'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/ikiwiki-upstream/commit/?id=2e00af6096b47cff141acc1965d75178471b1878'>root</a>/<a href='/ikiwiki-upstream/commit/.perlcriticrc?id=2e00af6096b47cff141acc1965d75178471b1878'>.perlcriticrc</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='2e00af6096b47cff141acc1965d75178471b1878'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</o<ol class="hl">
<li id="n_1" class="hl"><span class="hl slc">#!/usr/bin/perl</span></li>
<li id="n_2" class="hl"><span class="hl kwa">package&nbsp;</span>IkiWiki<span class="hl opt">::</span>Plugin<span class="hl opt">::</span>progress<span class="hl opt">;</span></li>
<li id="n_3" class="hl"></li>
<li id="n_4" class="hl"><span class="hl kwa">use </span>warnings<span class="hl opt">;</span></li>
<li id="n_5" class="hl"><span class="hl kwa">use </span>strict<span class="hl opt">;</span></li>
<li id="n_6" class="hl"><span class="hl kwa">use </span>IkiWiki <span class="hl num">3.00</span><span class="hl opt">;</span></li>
<li id="n_7" class="hl"></li>
<li id="n_8" class="hl"><span class="hl kwc">my </span><span class="hl kwb">$percentage_pattern </span><span class="hl opt">= </span><span class="hl kwd">qr/[0-9]+\%?/</span><span class="hl opt">; </span><span class="hl slc"># pattern to validate percentages</span></li>
<li id="n_9" class="hl"></li>
<li id="n_10" class="hl"><span class="hl kwa">sub </span>import <span class="hl opt">{</span></li>
<li id="n_11" class="hl">    hook<span class="hl opt">(</span>type <span class="hl opt">=&gt; </span><span class="hl sng">&quot;getsetup&quot;</span><span class="hl opt">, </span>id <span class="hl opt">=&gt; </span><span class="hl sng">&quot;progress&quot;</span><span class="hl opt">, </span>call <span class="hl opt">=&gt; </span>\<span class="hl opt">&amp;</span>getsetup<span class="hl opt">);</span></li>
<li id="n_12" class="hl">    hook<span class="hl opt">(</span>type <span class="hl opt">=&gt; </span><span class="hl sng">&quot;preprocess&quot;</span><span class="hl opt">, </span>id <span class="hl opt">=&gt; </span><span class="hl sng">&quot;progress&quot;</span><span class="hl opt">, </span>call <span class="hl opt">=&gt; </span>\<span class="hl opt">&amp;</span>preprocess<span class="hl opt">);</span></li>
<li id="n_13" class="hl">    hook<span class="hl opt">(</span>type <span class="hl opt">=&gt; </span><span class="hl sng">&quot;format&quot;</span><span class="hl opt">,     </span>id <span class="hl opt">=&gt; </span><span class="hl sng">&quot;progress&quot;</span><span class="hl opt">, </span>call <span class="hl opt">=&gt; </span>\<span class="hl opt">&amp;</span>format<span class="hl opt">);</span></li>
<li id="n_14" class="hl"><span class="hl opt">}</span></li>
<li id="n_15" class="hl"></li>
<li id="n_16" class="hl"><span class="hl kwa">sub </span>getsetup <span class="hl opt">() {</span></li>
<li id="n_17" class="hl">    <span class="hl kwa">return </span></li>
<li id="n_18" class="hl">        plugin <span class="hl opt">=&gt; {</span></li>
<li id="n_19" class="hl">            safe <span class="hl opt">=&gt; </span><span class="hl num">1</span><span class="hl opt">,</span></li>
<li id="n_20" class="hl">            rebuild <span class="hl opt">=&gt; </span><span class="hl kwc">undef</span><span class="hl opt">,</span></li>
<li id="n_21" class="hl">        <span class="hl opt">},</span></li>
<li id="n_22" class="hl"><span class="hl opt">}</span></li>
<li id="n_23" class="hl"></li>
<li id="n_24" class="hl"><span class="hl kwa">sub </span>preprocess <span class="hl opt">(&#64;) {</span></li>
<li id="n_25" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">%params</span><span class="hl opt">=</span><span class="hl kwb">&#64;_</span><span class="hl opt">;</span></li>
<li id="n_26" class="hl">    </li>
<li id="n_27" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$fill</span><span class="hl opt">;</span></li>
<li id="n_28" class="hl">    </li>
<li id="n_29" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">$params</span><span class="hl opt">{</span>percent<span class="hl opt">}) {</span></li>
<li id="n_30" class="hl">        <span class="hl kwb">$fill </span><span class="hl opt">= </span><span class="hl kwb">$params</span><span class="hl opt">{</span>percent<span class="hl opt">};</span></li>
<li id="n_31" class="hl">        <span class="hl opt">(</span><span class="hl kwb">$fill</span><span class="hl opt">) = </span><span class="hl kwb">$fill </span><span class="hl opt">=~ </span><span class="hl kwd">m/($percentage_pattern)/</span><span class="hl opt">; </span><span class="hl slc"># fill is untainted now</span></li>
<li id="n_32" class="hl">        <span class="hl kwb">$fill</span><span class="hl opt">=~</span><span class="hl kwd">s/%$//</span><span class="hl opt">;</span></li>
<li id="n_33" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwc">defined </span><span class="hl kwb">$fill </span><span class="hl opt">|| ! </span><span class="hl kwc">length </span><span class="hl kwb">$fill </span><span class="hl opt">|| </span><span class="hl kwb">$fill </span><span class="hl opt">&gt; </span><span class="hl num">100 </span><span class="hl opt">|| </span><span class="hl kwb">$fill </span><span class="hl opt">&lt; </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_34" class="hl">            error<span class="hl opt">(</span><span class="hl kwc">sprintf</span><span class="hl opt">(</span>gettext<span class="hl opt">(</span><span class="hl sng">&quot;illegal percent value </span><span class="hl ipl">%s</span><span class="hl sng">&quot;</span><span class="hl opt">), </span><span class="hl kwb">$params</span><span class="hl opt">{</span>percent<span class="hl opt">}));</span></li>
<li id="n_35" class="hl">        <span class="hl opt">}</span></li>
<li id="n_36" class="hl">        <span class="hl kwb">$fill</span><span class="hl opt">.=</span><span class="hl sng">&quot;%&quot;</span><span class="hl opt">;</span></li>
<li id="n_37" class="hl">    <span class="hl opt">}</span></li>
<li id="n_38" class="hl">    <span class="hl kwa">elsif </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">$params</span><span class="hl opt">{</span>totalpages<span class="hl opt">} </span><span class="hl kwc">and defined </span><span class="hl kwb">$params</span><span class="hl opt">{</span>donepages<span class="hl opt">}) {</span></li>
<li id="n_39" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$totalcount</span><span class="hl opt">=</span>pagespec_match_list<span class="hl opt">(</span></li>
<li id="n_40" class="hl">            <span class="hl kwb">$params</span><span class="hl opt">{</span>page<span class="hl opt">}, </span><span class="hl kwb">$params</span><span class="hl opt">{</span>totalpages<span class="hl opt">},</span></li>
<li id="n_41" class="hl">            deptype <span class="hl opt">=&gt; </span>deptype<span class="hl opt">(</span><span class="hl sng">&quot;presence&quot;</span><span class="hl opt">));</span></li>
<li id="n_42" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$donecount</span><span class="hl opt">=</span>pagespec_match_list<span class="hl opt">(</span></li>
<li id="n_43" class="hl">            <span class="hl kwb">$params</span><span class="hl opt">{</span>page<span class="hl opt">}, </span><span class="hl kwb">$params</span><span class="hl opt">{</span>donepages<span class="hl opt">},</span></li>
<li id="n_44" class="hl">            deptype <span class="hl opt">=&gt; </span>deptype<span class="hl opt">(</span><span class="hl sng">&quot;presence&quot;</span><span class="hl opt">));</span></li>
<li id="n_45" class="hl">        </li>
<li id="n_46" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$totalcount </span><span class="hl opt">== </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_47" class="hl">            <span class="hl kwb">$fill </span><span class="hl opt">= </span><span class="hl sng">&quot;100%&quot;</span><span class="hl opt">;</span></li>
<li id="n_48" class="hl">        <span class="hl opt">}</span></li>
<li id="n_49" class="hl">        <span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_50" class="hl">            <span class="hl kwc">my </span><span class="hl kwb">$number </span><span class="hl opt">= </span><span class="hl kwb">$donecount/$totalcount*100</span><span class="hl opt">;</span></li>
<li id="n_51" class="hl">            <span class="hl kwb">$fill </span><span class="hl opt">= </span><span class="hl kwc">sprintf</span><span class="hl opt">(</span><span class="hl sng">&quot;</span><span class="hl ipl">%u%%</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl kwb">$number</span><span class="hl opt">);</span></li>
<li id="n_52" class="hl">        <span class="hl opt">}</span></li>
<li id="n_53" class="hl">    <span class="hl opt">}</span></li>
<li id="n_54" class="hl">    <span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_55" class="hl">        error<span class="hl opt">(</span>gettext<span class="hl opt">(</span><span class="hl sng">&quot;need either `percent` or `totalpages` and `donepages` parameters&quot;</span><span class="hl opt">));</span></li>
<li id="n_56" class="hl">    <span class="hl opt">}</span></li>
<li id="n_57" class="hl"></li>
<li id="n_58" class="hl">    <span class="hl kwa">return </span><span class="hl sng">&lt;&lt;EODIV</span></li>
<li id="n_59" class="hl"><span class="hl sng">&lt;div class=&quot;progress&quot;&gt;</span></li>
<li id="n_60" class="hl"><span class="hl sng">  &lt;div class=&quot;progress-done&quot; style=&quot;width: </span><span class="hl ipl">$fill</span><span class="hl sng">&quot;&gt;</span><span class="hl ipl">$fill</span><span class="hl sng">&lt;/div&gt;</span></li>
<li id="n_61" class="hl"><span class="hl sng">&lt;/div&gt;</span></li>
<li id="n_62" class="hl"><span class="hl sng">EODIV</span></li>
<li id="n_63" class="hl"><span class="hl opt">}</span></li>
<li id="n_64" class="hl"></li>
<li id="n_65" class="hl"><span class="hl kwa">sub </span>format<span class="hl opt">(&#64;) {</span></li>
<li id="n_66" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">%params </span><span class="hl opt">= </span><span class="hl kwb">&#64;_</span><span class="hl opt">;</span></li>
<li id="n_67" class="hl"></li>
<li id="n_68" class="hl">    <span class="hl slc"># If HTMLScrubber has removed the style attribute, then bring it back</span></li>
<li id="n_69" class="hl"></li>
<li id="n_70" class="hl">    <span class="hl kwb">$params</span><span class="hl opt">{</span>content<span class="hl opt">} =~ </span><span class="hl kwd">s!&lt;div class=&quot;progress-done&quot;&gt;($percentage_pattern)&lt;/div&gt;!&lt;div class=&quot;progress-done&quot; style=&quot;width: $1&quot;&gt;$1&lt;/div&gt;!g</span><span class="hl opt">;</span></li>
<li id="n_71" class="hl"></li>
<li id="n_72" class="hl">    <span class="hl kwa">return </span><span class="hl kwb">$params</span><span class="hl opt">{</span>content<span class="hl opt">};    </span></li>
<li id="n_73" class="hl"><span class="hl opt">}</span></li>
<li id="n_74" class="hl"></li>
<li id="n_75" class="hl"><span class="hl num">1</span></li>
</ol></code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.46.0</a>) at 2025-06-10 06:44:37 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
