Mercurial > hgrepos > hgweb.cgi > s4
comparison s4-blog.sh @ 34:77e2aeb2d7ad
autolink by "href=..."
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 22 Jul 2015 13:25:22 +0900 |
parents | 7ae119a14613 |
children | 894f93ef24fe |
comparison
equal
deleted
inserted
replaced
33:54dba4c5e61d | 34:77e2aeb2d7ad |
---|---|
117 #-- coalesce(b.gecos, a.author) | 117 #-- coalesce(b.gecos, a.author) |
118 # a.author from $at a | 118 # a.author from $at a |
119 # LEFT JOIN (select name,val as gecos from user_s where key='gecos') b | 119 # LEFT JOIN (select name,val as gecos from user_s where key='gecos') b |
120 # on a.author=b.name where blogid='$id'";` | 120 # on a.author=b.name where blogid='$id'";` |
121 arts=`query "select rowid,id,author from $at where blogid='$id';"` | 121 arts=`query "select rowid,id,author from $at where blogid='$id';"` |
122 err arts="[$arts]" | 122 # err arts="[$arts]" |
123 number=0 | 123 number=0 |
124 hrefhome0="<a href=\"?home" | 124 hrefhome0="<a href=\"?home" |
125 for a in $arts; do | 125 for a in $arts; do |
126 arid=${a%%|*} aid=`echo "$a"|cut -d'|' -f2` author=${a##*|} imgs="" | 126 arid=${a%%|*} aid=`echo "$a"|cut -d'|' -f2` author=${a##*|} imgs="" |
127 ### err a=$a, aid=$aid, author=$author | 127 ### err a=$a, aid=$aid, author=$author |
128 # name='' # Get gecos?? | 128 # name='' # Get gecos?? |
129 td=$(echo $tmpd/`echo $a|md5`) | 129 td=$(echo $tmpd/`echo $a|md5`) |
130 val=`getvalbyid article image $arid $td` | 130 val=`getvalbyid article image $arid $td` |
131 err val="[$val]" and td as follows: | 131 # err val="[$val]" and td as follows: |
132 | 132 |
133 if true; then | 133 if true; then |
134 if [ -n "$val" ]; then | 134 if [ -n "$val" ]; then |
135 hrfb="$myname?showattc+article_m" | 135 hrfb="$myname?showattc+article_m" |
136 imgs="<br>"$(echo "$val"\ | 136 imgs="<br>"$(echo "$val"\ |
137 |while read fn; do | 137 |while read fn; do |
138 | 138 |
139 #data=`percenthex $td/$fn` | 139 #data=`percenthex $td/$fn` |
140 #ct=`cat $td/$fn.content-type` | 140 #ct=`cat $td/$fn.content-type` |
141 ri=`cat $td/$fn.rowid` | 141 ri=`cat $td/$fn.rowid` |
142 err fn=$fn ct=$ct ri=$ri; ls -lF $td/ 1>&3 | 142 ### err fn=$fn ct=$ct ri=$ri; ls -lF $td/ 1>&3 |
143 #case $ct in | 143 #case $ct in |
144 # [Ii]mage*) anch="<img src=\"data:$ct,$data\">$fn" ;; | 144 # [Ii]mage*) anch="<img src=\"data:$ct,$data\">$fn" ;; |
145 # *) anch=$fn ;; | 145 # *) anch=$fn ;; |
146 # esac | 146 # esac |
147 # Should not contain newlines for sed argument | 147 # Should not contain newlines for sed argument |
162 cat<<EOF | sq -html $db \ | 162 cat<<EOF | sq -html $db \ |
163 | sed -e "s|,n,\([0-9]*\):|,n,$hrefhome0+\1\">|" \ | 163 | sed -e "s|,n,\([0-9]*\):|,n,$hrefhome0+\1\">|" \ |
164 -e 's|,\[/a\],|</a>|' \ | 164 -e 's|,\[/a\],|</a>|' \ |
165 -e 's/,n,/<br>/g' -e "s|,i,|$imgs|" \ | 165 -e 's/,n,/<br>/g' -e "s|,i,|$imgs|" \ |
166 -e "s|<TR>\(<TD>\)|<TR id=\"$aid\">\1|" \ | 166 -e "s|<TR>\(<TD>\)|<TR id=\"$aid\">\1|" \ |
167 -e "s|^href=\([-A-Za-z0-9,.:/~_%#&+?]*\)|<a &>\1</a>|g" \ | |
167 -e "s|\(<TR.*>\)\(<TD>\),e,|\1\2$link|" | 168 -e "s|\(<TR.*>\)\(<TD>\),e,|\1\2$link|" |
168 select | 169 select |
169 coalesce((select ",e," from article where id='$aid' and author='$user'),"") | 170 coalesce((select ",e," from article where id='$aid' and author='$user'),"") |
170 || | 171 || |
171 max(case key when 'ctime' then ",n,"||val|| | 172 max(case key when 'ctime' then ",n,"||val|| |