attachment: When inserting links, insert img directives for images, if that plugin...
authorJoey Hess <joey@kitenet.net>
Sun, 13 Jun 2010 03:00:30 +0000 (23:00 -0400)
committerJoey Hess <joey@kitenet.net>
Sun, 13 Jun 2010 03:00:30 +0000 (23:00 -0400)
IkiWiki/Plugin/attachment.pm
debian/changelog

index 53a65236cadbadb8ef7f7f40ac098590a31f2a0f..9c774557fdbb649b010da4f899d6089f943b5337 100644 (file)
@@ -195,7 +195,14 @@ sub formbuilder (@) {
                foreach my $f ($q->param("attachment_select")) {
                        $f=Encode::decode_utf8($f);
                        $f=~s/^$page\///;
-                       $add.="[[$f]]\n";
+                       if (IkiWiki::isinlinableimage($f) &&
+                           UNIVERSAL::can("IkiWiki::Plugin::img", "import")) {
+                               $add.='[[!img '.$f.' align="right" size="" alt=""]]';
+                       }
+                       else {
+                               $add.="[[$f]]";
+                       }
+                       $add.="\n";
                }
                $form->field(name => 'editcontent',
                        value => $form->field('editcontent')."\n\n".$add,
index 07b349c57d4a3d7a405741b7b1013978adbdd3a9..fd7d1569e1cc235e3d618599f89b54602414cb23 100644 (file)
@@ -10,6 +10,8 @@ ikiwiki (3.20100611) UNRELEASED; urgency=low
     page does not exist, so it can be easily created.
   * edittemplate: Look for template pages under templates/ like everything
     else (still looks in old location for backwards compatability).
+  * attachment: When inserting links, insert img directives for images,
+    if that plugin is enabled.
 
  -- Joey Hess <joeyh@debian.org>  Fri, 11 Jun 2010 13:39:15 -0400