[pmwiki-users] small patch for empty attachlists
Mikael Nilsson
mini at nada.kth.se
Mon Dec 11 12:49:18 CST 2006
Sorry, should have been
--- upload.php.orig 2006-12-11 19:41:02.737488225 +0100
+++ upload.php 2006-12-11 19:49:11.709547361 +0100
@@ -92,7 +92,7 @@
Markup('attachlist', 'directives',
'/\\(:attachlist\\s*(.*?):\\)/ei',
- "Keep('<ul>'.FmtUploadList('$pagename',PSS('$1')).'</ul>')");
+ "Keep(FmtUploadList('$pagename',PSS('$1')))");
SDV($GUIButtons['attach'], array(220, 'Attach:', '', '$[file.ext]',
'$GUIButtonDirUrlFmt/attach.gif"$[Attach file]"'));
SDV($LinkFunctions['Attach:'], 'LinkUpload');
@@ -270,6 +270,8 @@
$filelist[$file] = $file;
}
closedir($dirp);
+ if(!count($filelist))
+ return "";
$out = array();
natcasesort($filelist);
$overwrite = '';
@@ -284,7 +286,7 @@
number_format($stat['size']) . " bytes ... " .
strftime($TimeFmt, $stat['mtime']) . "</li>";
}
- return implode("\n",$out);
+ return "<ul>".implode("\n",$out)."</ul>";
}
# this adds (:if [!]attachments:) to the markup
On mån, 2006-12-11 at 19:45 +0100, Mikael Nilsson wrote:
> in XHTML, <ul></ul> is not permitted, so empty (:attachlist:) will make
> a page not compliant.
>
> As I include (:attachlist:) in the GroupFooter, many of my pages won't
> validate. Yes, I will use (:if !attachments:), but still....
>
> A simple fix:
>
> --- upload.php.orig 2006-12-11 19:41:02.737488225 +0100
> +++ upload.php 2006-12-11 19:43:59.522055339 +0100
> @@ -92,7 +92,7 @@
>
> Markup('attachlist', 'directives',
> '/\\(:attachlist\\s*(.*?):\\)/ei',
> - "Keep('<ul>'.FmtUploadList('$pagename',PSS('$1')).'</ul>')");
> + "Keep(FmtUploadList('$pagename',PSS('$1')))");
> SDV($GUIButtons['attach'], array(220, 'Attach:', '', '$[file.ext]',
> '$GUIButtonDirUrlFmt/attach.gif"$[Attach file]"'));
> SDV($LinkFunctions['Attach:'], 'LinkUpload');
> @@ -270,6 +270,8 @@
> $filelist[$file] = $file;
> }
> closedir($dirp);
> + if(!count($filelist))
> + return "";
> $out = array();
> natcasesort($filelist);
> $overwrite = '';
> @@ -284,7 +286,7 @@
> number_format($stat['size']) . " bytes ... " .
> strftime($TimeFmt, $stat['mtime']) . "</li>";
> }
> - return implode("\n",$out);
> + return implode("\n","<ul>".$out."</ul>");
> }
>
> # this adds (:if [!]attachments:) to the markup
>
--
Plus ça change, plus c'est la même chose
More information about the pmwiki-users
mailing list