changeset 293:6c281c9899e5

Allow WikiStyle notation in blog heading
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 23 Aug 2016 10:02:31 +0859
parents 3866eb7c2a23
children 7f63a9424410
files examples/common/default/default.css s4-blog.sh
diffstat 2 files changed, 25 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/examples/common/default/default.css	Tue Aug 23 09:19:41 2016 +0859
+++ b/examples/common/default/default.css	Tue Aug 23 10:02:31 2016 +0859
@@ -69,7 +69,7 @@
     border: 1px solid black; border-collapse: collapse;
     min-width: 30em;
 }
-table.bloghead tr:nth-child(2) {
+table.bloghead tr.preface {
     font-size: 150%; background: yellow; text-align: center;
     white-space: pre-wrap;
 }
@@ -97,7 +97,7 @@
     vertical-align: top; width: auto; height: 1em;
 }
 table.mini th {text-align: justify;}
-table.mini td, table.mini th {padding: 1px 1ex;}
+table.mini td, table.mini th {padding: 1px 1ex; min-width: 1em;}
 table.mini {margin-left: 1em; border-left: 2px solid #686;}
 
 p.profimg {float: left; max-width: 400px; max-height: 400px;
--- a/s4-blog.sh	Tue Aug 23 09:19:41 2016 +0859
+++ b/s4-blog.sh	Tue Aug 23 10:02:31 2016 +0859
@@ -118,27 +118,30 @@
     href3="(<a href=\"?gethandout+$rowid\">ファイル取得</a>)"
   fi
   href4='<a href="#bottom"> 末尾へ</a>'
-  cat<<EOF | sq -html $db \
-      | sed -e "s|\(<TR><TD>\),e,|\1 $href |" \
-	    -e "s|,s,|$href2$href3|" \
-	    -e "s|,t,\(</TD>\)|$href4\1|"
--- select val from $ts where key="title" and id="$id";
-select
- coalesce((select ",e," from blog where rowid=$rowid and author='$user'),'')
-||val||" "
-||case (select val from $ts where key="mode" and id="$id")
-  when 'report-closed' then "レポート提出用(自身のファイルのみ参照可),s,"
-  when 'report-open' then "レポート提出用,s,"
-  else ""
-  end || ',t,'
- from $ts where key="ctime" and id="$id";
-select val from $ts where key="heading" and id="$id";
-EOF
-  cat<<EOF
-</table>
-<table class="blog_replies">
-EOF
 
+  query<<-EOF |
+	SELECT coalesce((SELECT "yes" FROM blog
+			 WHERE rowid=$rowid AND author='$user'),
+			 ''),
+	       max(CASE key WHEN 'ctime' THEN val END) ctime,
+	       max(CASE key WHEN 'heading' THEN hex(val) END) heading,
+	       CASE (SELECT val FROM $ts WHERE key="mode" AND id="$id")
+	       WHEN 'report-closed' THEN 'レポート提出用(closed)'
+	       WHEN 'report-open' THEN 'レポート提出用(open)'
+	       ELSE ''
+	       END
+	FROM $ts WHERE id='$id' GROUP BY id;
+	EOF
+  { IFS='|' read edit ctime hexhead blogtype
+    cat<<-EOF
+	<tr><td>${edit:+$href }$ctime $blogtype $href2$href3 $href4</td></tr>
+	<tr class="preface">
+	 <td>`echo "$hexhead"|unhexize|hreflink|minitbl`</td></tr>
+	</table>
+
+	<table class="blog_replies">
+	EOF
+  }
   lkhome="<a href=\"$myname?home" lke='">'
   lkedit="<a href=\"$myname?editart"
   hlink="$myname?home" elink="$myname?editart"

yatex.org