changeset 34:77e2aeb2d7ad

autolink by "href=..."
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 22 Jul 2015 13:25:22 +0900
parents 54dba4c5e61d
children 894f93ef24fe
files s4-blog.sh
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Wed Jul 22 13:14:06 2015 +0900
+++ b/s4-blog.sh	Wed Jul 22 13:25:22 2015 +0900
@@ -119,7 +119,7 @@
 # LEFT JOIN (select name,val as gecos from user_s where key='gecos') b
 # on a.author=b.name where blogid='$id'";`
   arts=`query "select rowid,id,author from $at where blogid='$id';"`
-err  arts="[$arts]"
+# err  arts="[$arts]"
   number=0
   hrefhome0="<a href=\"?home"
   for a in $arts; do
@@ -128,7 +128,7 @@
     # name=''	# Get gecos??
     td=$(echo $tmpd/`echo $a|md5`)
     val=`getvalbyid article image $arid $td`
-err val="[$val]" and td as follows:
+# err val="[$val]" and td as follows:
     
     if true; then
       if [ -n "$val" ]; then
@@ -139,7 +139,7 @@
 		       #data=`percenthex $td/$fn`
 		       #ct=`cat $td/$fn.content-type`
 		       ri=`cat $td/$fn.rowid`
-err fn=$fn ct=$ct ri=$ri; ls -lF $td/ 1>&3
+### err fn=$fn ct=$ct ri=$ri; ls -lF $td/ 1>&3
 		       #case $ct in
 		#	 [Ii]mage*) anch="<img src=\"data:$ct,$data\">$fn" ;;
 		#	 *) anch=$fn ;;
@@ -164,6 +164,7 @@
 	      -e 's|,\[/a\],|</a>|' \
 	      -e 's/,n,/<br>/g' -e "s|,i,|$imgs|" \
 	      -e "s|<TR>\(<TD>\)|<TR id=\"$aid\">\1|" \
+	      -e "s|^href=\([-A-Za-z0-9,.:/~_%#&+?]*\)|<a &>\1</a>|g" \
 	      -e "s|\(<TR.*>\)\(<TD>\),e,|\1\2$link|"
 select
   coalesce((select ",e," from article where id='$aid' and author='$user'),"")

yatex.org