changeset 571:27442a1d95c0

Support Wareki
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 24 Apr 2019 12:27:59 +0900
parents 9328392f7c55
children 95f2b54ea6d5
files s4-blog.sh
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Tue Apr 23 09:56:06 2019 +0900
+++ b/s4-blog.sh	Wed Apr 24 12:27:59 2019 +0900
@@ -278,6 +278,22 @@
 	icon,
 	a.rowid,
 	s.TIME,
+	CASE WHEN s.TIME < '2019-05'
+	     THEN printf('平成%d年%d月%d日',
+			 substr(s.TIME, 1, 4)-1988,
+			 substr(s.TIME, 6, 2),
+			 substr(s.TIME, 9, 2))
+             WHEN s.TIME < '2020'
+	     THEN printf('令和元年%d月%d日',
+			 substr(s.TIME, 6, 2),
+			 substr(s.TIME, 9, 2))
+             WHEN s.TIME < '2050'
+	     THEN printf('令和%d年%d月%d日',
+			 substr(s.TIME, 1, 4)-2018,
+			 substr(s.TIME, 6, 2),
+			 substr(s.TIME, 9, 2))
+             ELSE s.TIME
+	     END reki,
         CASE WHEN s.TIME > '$atime' THEN 'new' ELSE '' END newer,
 	hex(s.TEXT),
 	CASE -- File Accessibility to attached file
@@ -297,7 +313,8 @@
      a_s s
   ON a.id=s.id;
 EOF
-  while IFS='|' read id edit notify uid author uname icon aid tm new hte fa imgids
+  while IFS='|' read id edit notify uid author uname icon aid \
+	   tm reki new hte fa imgids
   do
     cachefile="$td/$id.row.html"
     stampfile="$td/$id.row.stamp"
@@ -333,7 +350,7 @@
 <tr id="$id">
 <td class="$tdcls">${picon}__EDIT__<a href="#$aid">#$aid</a>
 <a href="$hlink+$uid" title="${author%@*}">$uname</a>
-$tm
+<span title="$tm">${reki:-$tm}</span>
 <__NOTIFY__></td>
 EOF
 	echo -n "<td id=\"$aid\" class=\"repl\">"

yatex.org