changeset 489:075897fee2c0

minitbl() includes mini-ul translation
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 28 May 2018 10:39:32 +0900
parents 9f5b08b205bf
children e4b929e40fa8
files examples/common/default/default.css s4-funcs.sh
diffstat 2 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/examples/common/default/default.css	Thu Feb 15 12:24:39 2018 +0859
+++ b/examples/common/default/default.css	Mon May 28 10:39:32 2018 +0900
@@ -97,6 +97,10 @@
     border: 1px solid black; border-collapse: collapse;
     white-space: pre-wrap;
 }
+table.bloghead tr.preface td,
+table.blog_replies ul, .blog_replies tr ul, .blog_replies td ul {
+    text-align: left; white-space: normal; margin: 1ex 0;
+}
 table.blog_replies p.proficon {
     float: right; margin: 0 1ex 0 0;
 }
--- a/s4-funcs.sh	Thu Feb 15 12:24:39 2018 +0859
+++ b/s4-funcs.sh	Mon May 28 10:39:32 2018 +0900
@@ -518,7 +518,37 @@
 	  x; s|^|</table>|; x;		# Preppend /table to the next line
 	}
 	x;				# Back to the newest line
-	p;				# Print rest'
+	p;				# Print rest' | miniul
+}
+miniul() {
+  sed -e '
+	/^\* / {;			# 行頭 "* "
+	 x; s,^,<ul>,; x;		# 1週目: ホールドスペース先頭に <ul> を
+	:top
+	 s/\n//;
+	 s/^  *//;			# 2周目以降: 行頭空白削除
+	 s,\* ,,;			# まず行頭の "* " を消しておく
+	 H;				# 置き換え結果をホールドスペースに追加
+	 s/.*//;			# パターンスペースは消しておく
+	 # ↓最終行なら残ったホールドスペース処理のため :cont へ
+	 $ b cont
+	 N;				# 次の行を読む
+	 s/\n//;			# 空白始まりは継続行
+	 /^ /b top
+	 x; s/\n/<li>/; s,$,</li>,;	# 継続行でなければ <li></li> で囲む
+	 p; s/.*//;
+	 x;				# 次も "* " ならループを抜けない
+	 /^\* /b top
+	 s,^,</ul>,;			# 次が一般行なら箇条書終わり
+	}
+
+	:cont
+	x;				# 行頭| 以外の行:
+	/./ {;				# ホールドスペースに文字列があれば
+	  s/^\n/<li>/; s,$,</li></ul>,;	# 箇条書を書き切って終わり
+	  H; x
+	}
+	x'
 }
 acclog() (
   # $1=table, $2=rowid

yatex.org