From a0a422bd6b776962d31642662d15064e45f278c7 Mon Sep 17 00:00:00 2001 From: takezoe Date: Sat, 30 Jul 2011 19:44:51 +0000 Subject: [PATCH] =?utf8?q?ref=5Fimage=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4?= =?utf8?q?=E3=83=B3=E3=81=A7=E7=94=BB=E5=83=8F=E3=81=AE=E5=B9=85=E3=81=A8?= =?utf8?q?=E9=AB=98=E3=81=95=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=A7=E3=81=8D?= =?utf8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/Wiki/HTMLParser.pm | 15 +++++++++++---- plugin/attach/RefImage.pm | 24 ++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/lib/Wiki/HTMLParser.pm b/lib/Wiki/HTMLParser.pm index 926ff54..397e212 100644 --- a/lib/Wiki/HTMLParser.pm +++ b/lib/Wiki/HTMLParser.pm @@ -514,9 +514,11 @@ sub l_plugin { # ¥¤¥á¡¼¥¸ #============================================================================== sub l_image { - my $self = shift; - my $page = shift; - my $file = shift; + my $self = shift; + my $page = shift; + my $file = shift; + my $width = shift; + my $height = shift; my $wiki = $self->{wiki}; if($self->{para}==1){ @@ -529,7 +531,12 @@ sub l_image { $self->end_table; $self->end_quote; - $self->{html} .= "
create_url({action=>"ATTACH",page=>$page,file=>$file})."\">
\n"; + $self->{html} .= "
"; + $self->{html} .= "create_url({action=>"ATTACH",page=>$page,file=>$file})."\""; + $self->{html} .= " width=\"$width\"" if ($width ne ""); + $self->{html} .= " height=\"$height\"" if ($height ne ""); + $self->{html} .= "/>"; + $self->{html} .= "
\n"; } #============================================================================== diff --git a/plugin/attach/RefImage.pm b/plugin/attach/RefImage.pm index a144540..001bbce 100644 --- a/plugin/attach/RefImage.pm +++ b/plugin/attach/RefImage.pm @@ -4,6 +4,13 @@ #
 # {{ref_image ¥Õ¥¡¥¤¥ë̾}}
 # 
+#

+# ¥ª¥×¥·¥ç¥ó¤Ç²èÁü¤Î¥µ¥¤¥º¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ +# °Ê²¼¤ÎÎã¤Ç¤ÏÉý650¥Ô¥¯¥»¥ë¡¢¹â¤µ400¥Ô¥¯¥»¥ë¤Ç²èÁü¤òɽ¼¨¤·¤Þ¤¹¡£ +#

+#
+# {{ref_image ¥Õ¥¡¥¤¥ë̾,w650,h400}}
+# 
#

Ê̤Υڡ¼¥¸¤ËźÉÕ¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤ò»²¾È¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£

#
 # {{ref_image ¥Õ¥¡¥¤¥ë̾,¥Ú¡¼¥¸Ì¾}}
@@ -28,11 +35,24 @@ sub paragraph {
 	my $self = shift;
 	my $wiki = shift;
 	my $file = shift;
-	my $page = shift;
+	my $page = "";
+	
+	my @options = @_;
+	my $width  = "";
+	my $height = "";
 	
 	if($file eq ""){
 		return &Util::paragraph_error("¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£","WIKI");
 	}
+	foreach my $option (@options){
+		if($option =~ /^w([0-9]+)$/){
+			$width = $1;
+		} elsif($option =~ /^h([0-9]+)$/){
+			$height = $1;
+		} else {
+			$page = $option;
+		}
+	}
 	if($page eq ""){
 		$page = $wiki->get_CGI()->param("page");
 	}
@@ -45,7 +65,7 @@ sub paragraph {
 		return &Util::paragraph_error("¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤»¤ó¡£","WIKI");
 	}
 	
-	$wiki->get_current_parser()->l_image($page,$file);
+	$wiki->get_current_parser()->l_image($page, $file, $width, $height);
 	return undef;
 }
 
-- 
2.11.0