Mkphotohtml Ver.2.1
山田邦博です。
Mkphothhtml Version 2.1(バージョン アップ)の投稿です。
ディジタルカメラ(Digital Camera)で多量に撮った写真を簡単に整理し、
Netscape や Mozilla 等の一般的なブラウザ(Web browser) で見れるようにする
ものです。 Network photo album としての機能も持っています。
Unix ユーザ(Unix user)向けです。
今回の目玉:
・写真のコメント中にリンクを仕込むことができます。
$href(url文字列)(text文字列)
を
<a href="url文字列">text文字列</a>
に変換します。
・タイムスタンプを日本語やその他の locale に合わせた形式で出力できま
す。 Time zone 表示も付けられます。(この機能を働かせるには GNU
date コマンドが必要)
-...-
Mkphotohtml Ver.2.1 の全てのファイルは
ftp://ftp.tksa.gr.jp/king/image/Mkphotohtml_2.1.tgz
にあります。
これには、インストーラ、小さな関連プログラム(便利グッズ)、設定例、細か
いドキュメント等が含まれています。
最新の Mkphotohtml (ドキュメントを含む)については
http://www.tksa.gr.jp/king/Software/Mkphotohtml/index.html
を参照して下さい。
そこに実例も示しておきました。
-...-
以下に Ver.2.0 に対する diff を最後に添付します。
文書(doc)は diff だけ、プログラム(bin)と設定ファイル(etc)は diff+shar
です。
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##### (BEGIN) cut here for documents #####
diff -urN Mkphotohtml_2.0/doc/BUGS.jp.txt Mkphotohtml_2.1/doc/BUGS.jp.txt
--- Mkphotohtml_2.0/doc/BUGS.jp.txt 2003-11-11 13:45:51.000000000 +0900
+++ Mkphotohtml_2.1/doc/BUGS.jp.txt 2004-03-04 19:46:23.000000000 +0900
@@ -3,7 +3,7 @@
Problems and Bugs
-----------------
-Mkphotohtml Ver.2.0 におけるこれまでに分かっている問題点とバグおよび使
+Mkphotohtml Ver.2.1 におけるこれまでに分かっている問題点とバグおよび使
用上の注意を以下に記しておきます。
-...-
@@ -24,9 +24,9 @@
"Option: Scale-Directory=" による、画像収容ディレクトリ名の変更はデフォー
ルト オプションの変更指示に留まる、というのが作者の考えです。
-"Comment=", "Image=", "Prologue=" および "Epilogue=" の各項は継続行が
-許されているが、継続行の最初の(空白以外の)文字列に "[\w.-]+\s*=" のパ
-ターンがあってはいけない。
+"Comment=", "Image=", "Prologue=", "Epilogue=" および "Postscript"の各
+項は継続行が許されているが、継続行の最初の(空白以外の)文字列に
+"[\w.-]+\s*=" のパターンがあってはいけない。
設定ファイル中の文字列内に "\s#" が入っていてはいけない。 コメントとし
て "\s+#" 以降が切り捨てられる。
@@ -41,7 +41,7 @@
.-.-.
-11 Nov.2003
+4 Mar.2004
山田邦博
YAMADA Kunihiro <king@tksa.gr.jp>
diff -urN Mkphotohtml_2.0/doc/Change.log Mkphotohtml_2.1/doc/Change.log
--- Mkphotohtml_2.0/doc/Change.log 2003-11-11 13:44:15.000000000 +0900
+++ Mkphotohtml_2.1/doc/Change.log 2004-03-05 00:18:29.000000000 +0900
@@ -1,3 +1,27 @@
+5 Mar.2004
+ Version 2.1 : Released
+
+4 Mar.2004
+ Documents modified for ver.2.1.
+
+1 Mar.2004
+ changed default of option Refer from Denied to Allowed.
+ applied $uname,$copyright,$refer,$mail/$Mail and $href(url)(text)
+ to option prolog, epilog and postscript.
+
+15 Feb.2004
+ introduced format "$href(url)(text)" to Postscript and Comment.
+ permitted "Denied" instead "Deny" and "Allowed" instead Allow for
+ option Refer.
+
+7 Feb.2004
+ added option Postscript.
+
+2 Feb.2004
+ starting Version 2.1.
+ added option Date-Command.
+ Bug fixed for option -o.
+
11 Nov.2003
Bug fixed for displaying usable languages in HELP (-h).
diff -urN Mkphotohtml_2.0/doc/Format.txt Mkphotohtml_2.1/doc/Format.txt
--- Mkphotohtml_2.0/doc/Format.txt 2003-10-17 13:10:45.000000000 +0900
+++ Mkphotohtml_2.1/doc/Format.txt 2004-03-04 19:55:43.000000000 +0900
@@ -1,5 +1,5 @@
# This is the format of "Contents.conf" and "Contents.db" of
-# mkphtohtml version 2.
+# mkphtohtml version 2.1.
#
@@ -29,9 +29,12 @@
Start=Yes|No # Default: Yes
Top=url of top page # Default: /index.html
Check-Web=No|Yes # Default: No
- Refer=Deny|Allow # Default: Deny
+ Refer=Allowed|Denied # Default: Allowed
Prologue=any-string # Default: $copyright: $uname <$Mail>
Epilogue=any-string # Default: ""
+ Postscript=any-string # Default:
+# "This was created by Mkphotohtml. Reference/Link to this webpage is $refer."
+ Date-Command=external-date-command-string # Default: ""
Theme:
Theme=themestring or name of dir # Default: Name of the dir
diff -urN Mkphotohtml_2.0/doc/INSTALL.jp.txt Mkphotohtml_2.1/doc/INSTALL.jp.txt
--- Mkphotohtml_2.0/doc/INSTALL.jp.txt 2003-11-11 15:31:21.000000000 +0900
+++ Mkphotohtml_2.1/doc/INSTALL.jp.txt 2004-03-03 14:01:07.000000000 +0900
@@ -2,7 +2,7 @@
--------------
動作に必要な環境:
- Perl-5 : 5.8.0, および 5.6.1 で動作確認されています。
+ Perl-5 : 5.8.3, および 5.6.1 で動作確認されています。
djpeg,cjpeg : Jpeg ファイルを縮小するのに使用する。
Scale(縮小率)が 1/n (n=2,4,8) の時に使用される。
jpegtopnm,pnmscale,pnmtojpeg : Jpeg ファイルを縮小するのに使用する。
@@ -19,7 +19,7 @@
他の Unix でも問題は少ないでしょう。(付録のプログラムを使う場合は、
比較的最近の GNU ツール等を揃える必要があるかも知れません。)
- Windows での使用は考えていません。 Sygwin での動作可能性はあるでしょ
+ Windows での使用は考えていません。 Cygwin での動作可能性はあるでしょ
うが、ソースを少し修正する必要があるでしょう。
@@ -54,7 +54,7 @@
テーマ オプションがデフォールトとして設定されます。
.-.-.
-11 Nov.2003
+3 Mar.2004
山田邦博
YAMADA Kunihiro <king@tksa.gr.jp>
diff -urN Mkphotohtml_2.0/doc/README.jp.txt Mkphotohtml_2.1/doc/README.jp.txt
--- Mkphotohtml_2.0/doc/README.jp.txt 2003-11-11 18:20:21.000000000 +0900
+++ Mkphotohtml_2.1/doc/README.jp.txt 2004-03-05 00:19:03.000000000 +0900
@@ -5,7 +5,7 @@
山田邦博
YAMADA Kunihiro <king@tksa.gr.jp>
- 11 Nov.2003 (Release 2.0)
+ 5 Mar.2004 (Release 2.1)
Copyright policy: GNU GPL Ver.2
@@ -34,8 +34,8 @@
実際にどういう形で表示されるかは、以下の URL を参照して下さい。
http://www.tksa.gr.jp/cats/photo.html
- 最新の mkphotohtml は以下の URL に用意しておきます。 この文書に書か
-れていない使用例等もあります。
+ 最新の mkphotohtml の情報は以下の URL に用意しておきます。 この文書
+に書かれていない使用例等もあります。
http://www.tksa.gr.jp/king/Software/Mkphotohtml/index.html
@@ -129,6 +129,10 @@
Contents.conf を記述した文字コードのデフォールトを
characterset とする。
このオプションは "-o Charset=characterset" と同一である。
+ -d date-command-string :
+ 外部の date コマンドを使用する。
+ このオプションは "-o Date-Command=date-command-string" と同一
+ である。
-D : Debug.
-e string :
文字列 "string" を photo.html の終りに付け加える。(Epilogue)
@@ -307,6 +311,7 @@
Refer=...
Prologue=...
Epilogue=...
+ Date-Command=...
Theme:
Theme=テーマ名
@@ -340,6 +345,8 @@
Comment=テーマの概要を示すコメント
# HTML で使用できる任意の文字列。
# HTMLメタ文字があれば文字実体参照に変換される。
+ # "$href(url)(text) フォーマットがあれば後述の変換が行
+ # われる。
# この項は継続行が可能。 各行は <br> で改行される。
# ここで指定した文字列は photo.html に挿入される。
# default: なし
@@ -701,20 +708,20 @@
Refer : (Ref)
Network Photo Album として他サーバからリンクされること
を認めるかどうかを指定する。
- 認可 : Allow (All)
+ 認可 : Allowed (Allow,All) ... Default
リンクを認める。
- Deny (Den) ... Default
+ Denied (Deny,Den)
リンクを認めない。
Prologue=文字列
Prologue : (Prolog,Pro)
もし、ナル文字列以外が指定されていれば photo.html のテー
マ画像の後にその文字列を表示する。
+ 文字列はセンターリングされる。
Copyright の表示を想定しているが、それ以外の用途も可能。
文字列 :
任意の文字列。 オプションファイル中では継続行が可能。
(コマンドオプション、環境変数では一行のみ)
- 文字列はセンターリングされる。
文字列中に $copyright (または ${copyright}) があると、
言語指定に対応するメッセージファイルから "Copyright="
項目の文字列に置き換えられる。
@@ -725,17 +732,78 @@
の際、元の文字列が $Mail の場合は、Prologue 全体が
Mailto: となる。 (ただし、"Mail-Address=" オプション
の内容が "" の場合は Mailto: にならない。)
+ 文字列中に $refer (または ${refer}) があると、
+ "Refer=" オプションの値(Allowed/Denied) に置き換えられ
+ る。
+ "$href(url)(text)" なるフォーマットは後述する変換が行わ
+ れる。
デフォールト値は "$copyright $uname <$Mail>" である。
Epilogue=文字列
Epilogue : (Epilog,Epi)
もし、ナル文字列以外が指定されていれば photo.html のサ
ムネイル画像の後にその文字列を表示する。
+ 文字列はセンターリングされる。
Copyright の表示を想定しているが、それ以外の用途も可能。
文字列 :
"Prologue=" に同じ。
デフォールト値は "" である。
+ Postscript=文字列
+ Postscript : (Post,Pos,PS)
+ もし、ナル文字列以外が指定されていれば photo.html の最
+ 後に(Eplilogue の直後に)その文字列を表示する。
+ 文字列は左寄せで、また目立たないように 小さめの文字で
+ 表示される。
+ ウェブ サーチロボットにキーワードを収集させる目的を想
+ 定しているが、それ以外の用途も可能。
+ 文字列:
+ "Prologue=" に同じ。
+ デフォールト値は
+ "This was created by Mkphotohtml. Reference/Link to this webpage is $refer."
+ である。
+
+ Date-Command=コマンド文字列
+ Date-Command : (Date,Dat,Dat-Com,...)
+ もし、ナル文字列以外が指定されていれば、そのコマンドを
+ 使用する。 指定した locale, timezone の日時に変換する
+ 場合に使用できる。
+ コマンド文字列 :
+ 例としては
+ 'LANG=ja_JP.UTF-8 /bin/date -d $date'
+ が挙げられる。 $date は "Mon Feb 2 09:38:51 UTC 2004"
+ の形式の日時に置き換えた上で上記文字列がシェルコマンド
+ として引き渡され、変換結果が取り込まれ、新たな日時とし
+ て使用される。 変換結果は、UTF-8 または ASCII でなけれ
+ ばならない。
+ 上記の例では "2004年 2月 2日 月曜日 18:38:51 JST" に
+ 変換される。
+ この例においては、date コマンドに比較的新しい GNU の
+ coreutils あるいは sh-utils が必要です。
+ Locale に ja_JP.eucJP しかない場合は、
+ '/bin/date -d $date | nkf -w'
+ という方法が使えます。
+ デフォールト値は "" であり、これは外部コマンドを使用し
+ ない。 この場合、perl library の ctime を使用して
+ local time に変換するが、timezone を表す文字列が付かな
+ い。
+
+
+$href(url)(text) フォーマット:
+----------------------------
+
+ このフォーマットは、テーマ、サブテーマ、ウェブテーマおよび画像のコメ
+ント中にリンクを仕込むために使用される。 また Prologue, Epilogue 及び
+Postscript 文字列中にも同様にリンクを仕込むことができる。
+
+ $href(url文字列)(text文字列)
+は
+ <a href="url文字列">text文字列</a>
+に変換される。
+
+この変換に先立って、HTMLメタ文字を文字実体参照に変換し、継続行があれば
+<br> が挿入される。 このフォーマット中に改行があってはならない。
+
メッセージファイル:
------------------
@@ -912,17 +980,17 @@
とを想定しています。
Mkphotohtml(ver.2) はリモートサイト上の Contents.db を参照し、そこに
-許可(Refef=Allow)が明示してあれば、ウェブテーマとして取り込み、
-photo.html 上でリンクする事ができます。 デフォールトは "Refer=Deny" と
-してあります。 必要に応じて Refer=Allow を設定して下さい。
+許可(Refef=Allowed)が明示してあれば、ウェブテーマとして取り込み、
+photo.html 上でリンクする事ができます。 デフォールトは "Refer=Allowed"
+としてあります。 必要に応じて "Refer=Denied" を設定して下さい。
リモートのサイトから mkphotohtml によってリンクされたくない時は、ウェ
ブサーバが Contents.db をアクセスできないように owner と permission を
調整するのも良いでしょう。
リモートからあなたの Contents.db にアクセスでき、かつそこで
-"Refer=Allow" を設定してあれば、この Mkphotohtml の性格上、リンクされ
-る事を認めたものと解釈されます。
+"Refer=Allowed" を設定してあれば、この Mkphotohtml の性格上、リンクさ
+れる事を認めたものと解釈されます。
Mkphotohtml は許可された Contents.db から先の情報を探し回るような
はしたない事はしません。
@@ -930,7 +998,8 @@
あなたのアルバムのトップテーマにリンクするのは良いが、途中のサブテー
マにリンクするのを認めたくないなら、トップテーマの Contents.conf にの
-み "Refer=Allow" を設定してください。
+み "Refer=Allowed" を、下位テーマのそれらには "Refer=Denied" を設定し
+てください。
おまけ:
diff -urN Mkphotohtml_2.0/doc/TODO.jp.txt Mkphotohtml_2.1/doc/TODO.jp.txt
--- Mkphotohtml_2.0/doc/TODO.jp.txt 2003-10-17 17:37:06.000000000 +0900
+++ Mkphotohtml_2.1/doc/TODO.jp.txt 2004-03-03 14:08:09.000000000 +0900
@@ -3,11 +3,12 @@
Mkphotohtml は Version 2.0 で、私が当初目論んでいた機能は全て入ったよ
うに思います。
-後は見栄えを良くする事と、バグを取り除く事位です。
-Version 3 の予定はありません。
+後はバグを取り除く事、見栄えを良くする事、細かい機能修正・追加位で、マ
+イナーバージョンアップで対処します。
+基本機能の変更予定はないので、現在の所 Version 3 の予定はありません。
.-.-.
-17 Oct.2003
+3 Mar.2004
山田邦博
YAMADA Kunihiro <king@tksa.gr.jp>
##### (END) cut here for documents #####
-...-
##### (BEGIN) cut here for binaries #####
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2004-03-05 00:43 JST by <king@owlin>.
# Source directory was `/home/king/tmp'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 20010 -rw-r--r-- mkphotohtml.bin.etc.patch
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh04688; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= mkphotohtml.bin.etc.patch ==============
if test -f 'mkphotohtml.bin.etc.patch' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'mkphotohtml.bin.etc.patch' '(file already exists)'
else
$echo 'x -' extracting 'mkphotohtml.bin.etc.patch' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'mkphotohtml.bin.etc.patch' &&
diff -urN Mkphotohtml_2.0/bin/mkphotohtml Mkphotohtml_2.1/bin/mkphotohtml
--- Mkphotohtml_2.0/bin/mkphotohtml 2003-11-11 15:49:09.000000000 +0900
+++ Mkphotohtml_2.1/bin/mkphotohtml 2004-03-05 00:16:21.000000000 +0900
@@ -72,7 +72,8 @@
X # 8 Oct.2003 Ver.2.0-pre.02 : Released
X # 11 Oct.2003 Ver.2.0-pre.03 : Released
X # 18 Oct.2003 Ver.2.0-pre.04 : Released
-# 11 Nov.2003 ver.2.0 : Released
+# 11 Nov.2003 Ver.2.0 : Released
+# 5 Mar.2004 Ver.2.1 : Released
X #
X
X no lib qw(:ALL .);
@@ -82,14 +83,15 @@
X use File::Basename;
X use File::stat;
X use Time::localtime;
+use Time::gmtime;
X use HTTP::Date;
X use LWP::Simple;
X use IPC::Open2;
X use Net::Domain qw(hostfqdn hostdomain);
X use Image::Size 'html_imgsize';
X use Unicode::MapUTF8 qw(to_utf8 utf8_supported_charset);
-use vars qw($opt_b $opt_c $opt_C $opt_D $opt_e $opt_f $opt_h $opt_l $opt_m
- $opt_o $opt_p $opt_r $opt_s $opt_t $opt_u $opt_v $opt_w);
+use vars qw($opt_b $opt_c $opt_C $opt_d $opt_D $opt_e $opt_f $opt_h $opt_l
+ $opt_m $opt_o $opt_p $opt_r $opt_s $opt_t $opt_u $opt_v $opt_w);
X
X die "$0 : \"Root user or group\" is prohibitted, sorry.\n"
X if $< == 0 or $> == 0 or $( == 0 or $) == 0; # uid,euid,gid,egid : root?
@@ -120,7 +122,7 @@
X my $MAXWEBDOCLENGTH = 1000000; # Maximum allowed size for web page
X
X ## default for option -o ##
-## These options can be changed by option -o or system and user option file,
+## These options can be changed by option -o or system or user option file,
X ## and can be overlayed temporaly by $CONFIG file on each theme directory.
X ## Caution: These default options are not checked these validity,
X ## so take care when you change these default values!
@@ -143,13 +145,19 @@
X $::opt_start = "Yes"; # or No (start page added in HTML header)
X $::opt_top = "/index.html"; # link to Top page or URL
X $::opt_ckweb = "No"; # or Yes (Check Web theme page)
-$::opt_refer = "Deny"; # or Allow (refer for photo album)
+$::opt_refer = "Allowed"; # or Denied (refer for photo album)
X $::opt_prolog = '$copyright: $uname <$Mail>';
X # Any string for prolog clause
X # $copyrigh := $html_message{$::opt_lang}->{Copyright}
X # $uname := $::opt_uname
X # $Mail := $::opt_mail
-$::opt_epilog = ""; # Any string for epilog clause
+$::opt_epilog = ''; # Any string for epilog clause like as prolog clause
+#$::opt_epilog = '$copyright: $uname <$Mail>';
+$::opt_ps = 'This was created by Mkphotohtml. Reference/Link to this webpage is $refer.';
+$::opt_date = ''; # filter from UTF to Local time with locale
+#$::opt_date = 'LANG=ja_JP.UTF-8 /bin/date -d $date'; # for Japanese
+#$::opt_date = 'LANG=C /bin/date -d $date'; # for English
+
X
X #############################
X ### End of Configuration ###
@@ -157,7 +165,7 @@
X
X
X ### Constants ###
-my $VERSION = "2.0";
+my $VERSION = "2.1";
X my $WEBINFO = "http://www.tksa.gr.jp/king/Software/Mkphothtml/";
X
X my $PFIRST = "[-_]?(?:First|1st|Fir)";
@@ -183,7 +191,7 @@
X
X my ($CLEAN,$DEBUG,$FORCEUPDATE,$HELP,$RECURSIVE,$VERBOSE);
X
-getopts('bcC:De:fhl:m:op::rst:u:vw');
+getopts('bcC:d:De:fhl:m:o:p::rst:u:vw');
X $CLEAN = $opt_c;
X $DEBUG = $opt_D;
X $FORCEUPDATE = $opt_f;
@@ -198,6 +206,7 @@
X sub makephoto ( @ );
X sub set_charset ( $ );
X sub sanitize_meta ( $;$ );
+sub expand_href ( $;$ );
X
X
X if (-r "/etc/$PNAME/option") {
@@ -231,7 +240,7 @@
X
X This is Mkphotohtml version $VERSION
X
-Copyright 2001-2003, YAMADA Kunihiro <king\@tksa.gr.jp>
+Copyright 2001-2004, YAMADA Kunihiro <king\@tksa.gr.jp>
X
X You can get the latest version from
X \t$WEBINFO
@@ -246,6 +255,9 @@
X -C characterset :
X Specify charset to characterset for Contents.conf
X (same as -o Charset=characterset)
+ -d Date-Command :
+ Shell date command with options and parameter \$date.
+ (same as -o Date-Command=shell-command-string)
X -D : Debug
X -e string :
X add string as epilog to photo.html
@@ -274,13 +286,15 @@
X Size-of-Picture=(display1=scale1)(display2=scale2)....
X (Size of Picture for Normal, Header and Indices display)
X Default : $::opt_size
- Back=No|Yes (Default : No)
- Start=Yes|No (Default : Yes)
- Top=url of top page (Default : /index.html)
- Check-Web=No|Yes (Default : No)
- Refer=Deny|Allow (Default : Deny)
- Prologue=any-string (Default : "$::opt_prolog")
- Epilogue=any-string (Defualt : "$::opt_epilog")
+ Back=No|Yes (Default : No)
+ Start=Yes|No (Default : Yes)
+ Top=url of top page (Default : /index.html)
+ Check-Web=No|Yes (Default : No)
+ Refer=Denid|Allowed (Default : Denied)
+ Prologue=any-string (Default : "$::opt_prolog")
+ Epilogue=any-string (Default : "$::opt_epilog")
+ Postscript=any-string (Default : "$::opt_ps")
+ Date-Command=date-command-string (Default : "$::opt_date")
X -p string :
X add string as prolog to photo.html
X -r : Recursive
@@ -341,8 +355,9 @@
X set_option("sh","Epilog=$opt_e") if $opt_e; # Add epilog clause to photo.html
X $::opt_start = "No" if $opt_s; # Start page info. into HTML header
X $::opt_top = $opt_t if $opt_t; # address or URL of Top page
-set_option("sh","User-Name=$opt_u") if $opt_u; #User Name
+set_option("sh","User-Name=$opt_u") if $opt_u; # User Name
X $::opt_ckweb = "Yes" if $opt_w; # check web theme page
+set_option("sh","Date-Command=$opt_d") if $opt_d; # date command with options
X if ($opt_o) { # Option -o (from sh command)
X foreach (split m/,/,$opt_o) {
X set_option("sh",$_);
@@ -466,7 +481,6 @@
X sub set_option_from_file ( $;$ ) {
X my $file = shift;
X my $only_scale_size = shift;
-# my $save_ILN = $::ILN;
X local $::ILN;
X local $_;
X print "#",__LINE__,"# set_option_from_file, (",cwd,")($file) ",($only_scale_size?"ONLY":"ALL"),"\n" if $DEBUG;
@@ -484,8 +498,16 @@
X while ($_ = get_config(*INF,$file)) {
X last OUTER if /^\S/;
X unless ($only_scale_size) {
- if (s/^\s+(Pro|Epi)(?:log|logue)?\s*=\s*//i) {
- my $pt = ($1 =~ /Pro/i ? \$::opt_prolog : \$::opt_epilog);
+ my $pt;
+ s/^\s+//;
+ if (s/^Pro(log|logue)?\s*=\s*//i) {
+ $pt = \$::opt_prolog;
+ } elsif (s/^Epi(log|logue)?\s*=\s*//i) {
+ $pt = \$::opt_epilog;
+ } elsif (s/^(Postscript|Post|Pos|PS)\s*=\s*//i) {
+ $pt = \$::opt_ps;
+ }
+ if ($pt) {
X print "#",__LINE__,"# SETOPTF: ProEpi ($_)\n" if $DEBUG;
X $$pt = $_;
X while ($_ = get_config(*INF,$file)) {
@@ -502,7 +524,6 @@
X }
X }
X close(INF);
-# $::ILN = $save_ILN;
X }
X
X sub set_option ( $$;$ ) {
@@ -730,24 +751,25 @@
X EOF
X }
X } elsif (s/^Ref(er)?\s*=\s*//i) {
- if (/^All(ow)?$/i) {
- $::opt_refer = "Allow";
- } elsif (/^Deny?$/i) {
- $::opt_refer = "Deny";
+ if (/^All(ow|owed)?$/i) {
+ $::opt_refer = "Allowed";
+ } elsif (/^Den(y|ied)?$/i) {
+ $::opt_refer = "Denied";
X } else {
X die <<EOF;
X $errmes
-\t"Option: Refer=" should be "Allow" or "Deny".
+\t"Option: Refer=" should be "Allowed" or "Denied".
X EOF
X }
- } elsif (s/^(Pro|Epi)(?:log|logue)?\s*=\s*//i) {
- # from Command line option or Environment
- my $pe = $1;
- if ($pe =~ /Pro/i) {
- $::opt_prolog = $_;
- } else {
- $::opt_epilog = $_;
- }
+ } elsif (s/^(Pro|Prolog|Prologue)?\s*=\s*//i) {
+ $::opt_prolog = $_;
+ } elsif (s/^(Epi|Epilog|Epilogue)?\s*=\s*//i) {
+ $::opt_epilog = $_;
+ } elsif (s/^(Postscript|Post|Pos|PS)\s*=\s*//i) {
+ $::opt_ps =$_;
+ } elsif (s/^Date?([-_]?Com(mand)?)?\s*=\s*//i) {
+ s/^['\"]//; s/['\"]$//;
+ $::opt_date = $_;
X } elsif (/^$/) {
X # skip
X } else {
@@ -765,7 +787,6 @@
X return unless $msgfile;
X $msgfile =~ /\.([^.]+)$/;
X my $fext = $1;
-# my $save_ILN = $::ILN;
X local $::ILN;
X local $::opt_charset = "";
X local $_;
@@ -830,7 +851,6 @@
X }
X }
X close(INMES);
-# $::ILN = $save_ILN;
X die "Language should be defined in message file \"$msgfile\"\n"
X unless $lang;
X $html_message{$lang} = {} unless $html_message{$lang};
@@ -894,7 +914,8 @@
X print "#",__LINE__,"# check_version : file=($file)\n" if $DEBUG;
X $file = cwd . "/$file" unless $file =~ m!/!;
X my $db = ($file =~ /\.db$/ ? 1 : 0);
- my $recommended = ($db ? "\"$PNAME -fr\" is recommended."
+ my $w = ($http ? "w" : "");
+ my $recommended = ($db ? "\"$PNAME -fr$w\" is recommended."
X : "Config-file should be corrected.");
X my $version;
X if ($pname_version =~ /^\s+(\S+)\s+(\d+)\.(\d+)(-[a-z][.\w]*)?$/) {
@@ -957,7 +978,6 @@
X
X sub getTheme ( $;$ ) {
X my ($file,$http) = @_; # Contents-File, url
-# my $save_ILN = $::ILN;
X local $::opt_charset = "";
X local $::ILN;
X local $_;
@@ -1022,8 +1042,6 @@
X } elsif (/^\s+Latest\s*=(\d+)/) {
X $mtime = $1;
X $time_locale = $1 if /\((.+)\)/;
-# } elsif (/^\s+Mtime=(\d+)/) {
-# $w_mtime = $1;
X } elsif (/^\S|^$/) {
X last;
X } else {
@@ -1049,7 +1067,9 @@
X \t$file
X "$PNAME -fr" is recommended.
X EOF
-# $::ILN = $save_ILN;
+ if ($http) {
+ $comment = expand_href($comment,$http);
+ }
X return ($theme,$image,$comment,$mtime,$time_locale);
X } # end of getTheme
X
@@ -1057,11 +1077,9 @@
X my $dbf = shift;
X print "#",__LINE__,"# get_theme_image: dbf=($dbf)\n" if $DEBUG;
X die "!!BUG!! \"$dbf\" : not found : " unless -r $dbf;
-# my $save_ILN = $::ILN;
X local $::ILN;
X local $_;
X my ($theme,$image,$comment,$mtime,$time_locale) = getTheme($dbf);
-# $::ILN = $save_ILN;
X return $image;
X }
X
@@ -1299,6 +1317,47 @@
X return $_;
X }
X
+sub expand_href ( $;$ ) {
+ local $_ = shift;
+ my $http = shift;
+ print "#",__LINE__,"# expand_href: ($_)\n" if $DEBUG;
+ if (/\$href\b|\$\{href\}/) {
+ if ($http) {
+ s/(\$href\b|\$\{href\})\s*\((.*?)\)\s*\((.*?)\)/$3/ig;
+ if (s/\$href\b|\$\{href\}/ /) {
+ warn "Warning!! Bad \"\$href(url)(text) format\" at\n\t"
+ . cwd() . "/$http line $::ILN.\n"
+ . "\t\t... ignored.\n";
+ }
+ } else {
+ s/(\$href\b|\$\{href\})\s*\((.*?)\)\s*\((.*?)\)/<a href="$2">$3<\/a>/ig;
+ if (/\$href\b|\$\{href\}/) {
+ die "Bad \"\$href(url)(text) format\" at\n\t"
+ . cwd() . "/$CONFIG line $::ILN.\n";
+ }
+ }
+ }
+ return $_;
+}
+
+sub local_time ( ;$ ) {
+ my $mtime = shift;
+ if ($::opt_date) {
+ my $time = (defined $mtime ? gmctime($mtime) : gmctime());
+ $time =~ s/(\d+:\d+:\d+)/$1 UTC/;
+ my $date_command = $::opt_date;
+ $date_command =~ s/\$date\b/\'$time\'/;
+ my $date = qx($date_command);
+ die "Error on Date-Command :\n\t\"$date_command\"\n\t\t$!\n" if $?;
+ chomp $date;
+ die "Non UTF-8 found in string from Date-Command :\n\t\"$date_command\"\n"
+ unless is_utf8($date);
+ return $date;
+ } else {
+ return (defined $mtime ? ctime($mtime) : ctime());
+ }
+}
+
X ######################################################################
X
X my $depth = 0;
@@ -1477,23 +1536,25 @@
X ### $CONENT and $HTML should be updated. ###
X
X my $option_on;
- local $::opt_lang = $::opt_lang;
- local $::opt_order = $::opt_order;
- local $::opt_image = $::opt_image;
- local $::opt_theme = $::opt_theme;
- local $::opt_config = $::opt_config;
- local $::opt_mail = $::opt_mail;
- local $::opt_uname = $::opt_uname;
- local $::opt_charset = $::opt_charset;
- local $::opt_scale = $::opt_scale;
- local $::opt_size = $::opt_size;
- local $::opt_back = $::opt_back;
- local $::opt_start = $::opt_start;
- local $::opt_top = $::opt_top;
- local $::opt_ckweb = $::opt_ckweb;
- local $::opt_refer = $::opt_refer;
- local $::opt_prolog = $::opt_prolog;
- local $::opt_epilog = $::opt_epilog;
+ local $::opt_lang = $::opt_lang;
+ local $::opt_order = $::opt_order;
+ local $::opt_image = $::opt_image;
+ local $::opt_theme = $::opt_theme;
+ local $::opt_config = $::opt_config;
+ local $::opt_mail = $::opt_mail;
+ local $::opt_uname = $::opt_uname;
+ local $::opt_charset = $::opt_charset;
+ local $::opt_scale = $::opt_scale;
+ local $::opt_size = $::opt_size;
+ local $::opt_back = $::opt_back;
+ local $::opt_start = $::opt_start;
+ local $::opt_top = $::opt_top;
+ local $::opt_ckweb = $::opt_ckweb;
+ local $::opt_refer = $::opt_refer;
+ local $::opt_prolog = $::opt_prolog;
+ local $::opt_epilog = $::opt_epilog;
+ local $::opt_ps = $::opt_ps;
+ local $::opt_date = $::opt_date;
X
X my $theTheme_on;
X my $theTheme_theme = get_default_theme();
@@ -1683,7 +1744,6 @@
X $ignore = 1;
X }
X print "#",__LINE__,"# w_mtime=($w_mtime) modified_time=($modified_time)\n" if $DEBUG;
-# if (defined $w_mtime and ($w_mtime == str2time($modified_time))) {
X if (defined $w_mtime and ($w_mtime == $modified_time)) {
X warn "Content of Web page ($http) is not changed.\n"
X if $VERBOSE;
@@ -1692,7 +1752,6 @@
X if ($content_type and $content_type =~ m(text/plain)i) {
X $document_length = 0 unless defined $document_length;
X if ($document_length <= $MAXWEBDOCLENGTH) {
-# $w_mtime = str2time($modified_time);
X $w_mtime = $modified_time;
X } else {
X warn "Document length on Web page ($http) is too long.\n";
@@ -1722,7 +1781,7 @@
X local $_;
X while ($_ = get_config(*FHTTP,$fhttp)) {
X if (s/^\s+Ref(er)?\s*=\s*//i) {
- $allowed = 1 if /^All(ow)?$/i;
+ $allowed = 1 if /^All(ow|owed)?$/i;
X last;
X }
X }
@@ -1736,7 +1795,7 @@
X warn <<EOF;
X Web-theme ($url) is specified at
X \t\t$pwd/$CONFIG line $::ILN.
-\tBut denied to refer for Network Photo Album.
+\tBut denied to refer for the Network Photo Album.
X \t.... skipped.
X EOF
X }
@@ -1744,6 +1803,7 @@
X unless ($ignore) {
X my ($w_theme,$w_image,$w_comment,$mtime,$time_locale)
X = getTheme($fhttp,$http);
+ print "#",__LINE__,"# webpage: ($w_comment)\n" if $DEBUG;
X $theme = $w_theme unless $theme;
X $image = $w_image; #unless $image;
X $comment = $w_comment unless $comment;
@@ -1838,7 +1898,7 @@
X my $mtime = get_mtime_of_original_file($image_file);
X if (defined $mtime) {
X $name = $image_file unless $name;
- $date = ctime($mtime) unless $date;
+ $date = local_time($mtime) unless $date;
X push @contents,{ "ImageFile" => $image_file,
X "Name" => $name,
X "Date" => $date,
@@ -1887,7 +1947,7 @@
X my @here_f;
X while (my $f = shift @images) { # add new Image entries to here_f
X my $mtime = get_mtime_of_original_file($f);
- my $date = ctime($mtime);
+ my $date = local_time($mtime);
X push @here_f,{ "ImageFile" => $f,
X "Name" => $f,
X "Date" => $date,
@@ -1910,7 +1970,7 @@
X push @here_d,$_;
X } else {
X $_->{Mtime} = get_mtime_of_original_file($_->{ImageFile});
- $_->{Date} = ctime($_->{Mtime}) unless $_->{Date};
+ $_->{Date} = local_time($_->{Mtime}) unless $_->{Date};
X push @here_f, $_;
X }
X print "#",__LINE__,"# \@contents: Mtime=($_->{Mtime})\n" if $DEBUG;
@@ -1976,10 +2036,6 @@
X }
X $theTheme_comment = $c->{Comment} unless $theTheme_comment;
X }
-# unless ($theTheme_image =~ /\S+\s+(.+)/) {
-## if ($theTheme_image =~ m(http://)) {
-## }
-# }
X
X ### Generate Contents file ###
X print "#",__LINE__,"# Generate Contents: $pwd/$CONTENT\n" if $DEBUG;
@@ -1988,8 +2044,9 @@
X foreach my $c (@contents) {
X $max_mtime = $c->{Mtime} if $max_mtime < $c->{Mtime};
X }
- my $ctime = ctime();
- my $latestdate = ($theTheme_latest ? $theTheme_latest : ctime($max_mtime));
+ my $ctime = local_time();
+ my $latestdate = ($theTheme_latest ? $theTheme_latest
+ : local_time($max_mtime));
X my ($titleimage_N,$size_titleimage_N,$t_info_N)
X = image_path("Normal",$theTheme_image,"size-required");
X my ($titleimage_H,$size_titleimage_H,$t_info_H)
@@ -2024,6 +2081,8 @@
X \tRefer=$::opt_refer
X \tPrologue=$::opt_prolog
X \tEpilogue=$::opt_epilog
+\tPostscript=$::opt_ps
+\tDate-Command=$::opt_date
X
X Theme:
X \tTheme=$theTheme_theme
@@ -2070,7 +2129,7 @@
X my $hml = $html_message{$::opt_lang};
X
X foreach my $c (@contents) {
- $c->{Comment} = sanitize_meta($c->{Comment})
+ $c->{Comment} = expand_href(sanitize_meta($c->{Comment}))
X if exists $c->{Comment};
X foreach my $item (qw(ThemeWeb Theme Image URL Mtime Ltime
X theme_dir ImageFile Name Date)) {
@@ -2121,13 +2180,14 @@
X $::opt_uname = $_;
X
X
- for my $pe (\$::opt_prolog,\$::opt_epilog) {
+ for my $pe (\$::opt_prolog,\$::opt_epilog,\$::opt_ps) {
X next unless $$pe;
X $$pe =~ s/\$uname\b|\${uname}/$::opt_uname/ig;
X $$pe =~ s/\$copyright\b|\${copyright}/$hml->{Copyright}/ig;
+ $$pe =~ s/\$refer\b|\${refer}/$::opt_refer/ig;
X if ($::opt_mail
X and $$pe =~ s(\$mail\b|\${mail})($::opt_mail)ig
- and $& eq '$Mail') {
+ and ($& eq '$Mail' or $& eq '${Mail}')) {
X $$pe = sanitize_meta($$pe);
X $$pe =~ s/^\s+/\t /mg;
X $$pe = <<EOF;
@@ -2138,15 +2198,17 @@
X </a></address>
X EOF
X } else {
- $$pe =~ s/\s*<?\s*(\$Mail\b|\${Mail})\s*>?\s*/ /g;
+ $$pe =~ s/\s*<?\s*(\$mail\b|\${mail})\s*>?\s*/ /ig;
X $$pe = sanitize_meta($$pe);
X $$pe = " <small>\n\t$$pe\n </small>";
X }
+ $$pe = expand_href($$pe);
X }
X
X for my $p (\$theTheme_theme,\$theTheme_comment,\$theTheme_latest) {
- $$p = sanitize_meta($$p);
+ $$p = sanitize_meta($$p) if $$p;
X }
+ $theTheme_comment = expand_href($theTheme_comment) if $theTheme_comment;
X
X print "#",__LINE__,"# Generate $HTML\n" if $DEBUG;
X print "#",__LINE__,"# \$theTheme_image=`$theTheme_image'\n" if $DEBUG;
@@ -2209,7 +2271,7 @@
X if (exists $c->{ThemeDir}) { # SubThemeDir
X my ($subtheme_image,$size_image,$info_dummy)
X = image_path("Index","$c->{ThemeDir}/$c->{Image}","size_required");
- my $date = ($c->{Ltime} ? $c->{Ltime} : ctime($c->{Mtime}));
+ my $date = ($c->{Ltime} ? $c->{Ltime} : local_time($c->{Mtime}));
X print "#",__LINE__,"# \$subtheme_image=$subtheme_image\n" if $DEBUG;
X $html .= <<EOF;
X <a href="$c->{ThemeDir}/$HTML">
@@ -2226,7 +2288,7 @@
X }
X my ($web_image,$size_image)
X = image_path("Index",$c->{Image},"size-required");
- my $date = ($c->{Ltime} ? $c->{Ltime} : ctime($c->{Mtime}));
+ my $date = ($c->{Ltime} ? $c->{Ltime} : local_time($c->{Mtime}));
X $html .= <<EOF;
X <a href="$c->{URL}$HTML">
X <img src="$web_image"
@@ -2268,7 +2330,7 @@
X }
X }
X
- my $time = ctime();
+ my $time = local_time();
X
X $html .= <<EOF;
X <hr>
@@ -2289,8 +2351,17 @@
X </a></address>
X EOF
X }
+ if ($::opt_ps) {
X $html .= <<EOF;
- Last modified: $time
+ <br>
+$::opt_ps
+ <br>
+EOF
+ }
+ $html .= <<EOF;
+ <small>
+ Last modified: $time
+ </small>
X </body>
X </html>
X EOF
@@ -2302,4 +2373,4 @@
X }
X chdir $oldpwd;
X --$depth;
-}
+} ### end of makephoto
diff -urN Mkphotohtml_2.0/etc/option.sample Mkphotohtml_2.1/etc/option.sample
--- Mkphotohtml_2.0/etc/option.sample 2003-11-11 15:11:33.000000000 +0900
+++ Mkphotohtml_2.1/etc/option.sample 2004-03-05 00:20:02.000000000 +0900
@@ -14,6 +14,7 @@
X # 8 Oct.2003 Version 2.0-pre.02 : Released
X # 18 Oct.2003 Version.2.0-pre.04 : Released
X # 11 Nov.2003 Version 2.0 : Released
+# 5 Mar.2004 Version 2.1 : Released
X #
X
X #
@@ -40,4 +41,5 @@
X Check-Web = No
X Refer = Deny
X Prologue = "$copyright: $uname <$Mail>"
- epilogue = ""
+ Epilogue = ""
+ Date-Command = ""
SHAR_EOF
(set 20 04 03 05 00 27 29 'mkphotohtml.bin.etc.patch'; eval "$shar_touch") &&
chmod 0644 'mkphotohtml.bin.etc.patch' ||
$echo 'restore of' 'mkphotohtml.bin.etc.patch' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'mkphotohtml.bin.etc.patch:' 'MD5 check failed'
2bbe92530487fa8454456146f6736b94 mkphotohtml.bin.etc.patch
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'mkphotohtml.bin.etc.patch'`"
test 20010 -eq "$shar_count" ||
$echo 'mkphotohtml.bin.etc.patch:' 'original size' '20010,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh04688
exit 0
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735