s4

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 diff
     1.1 --- a/examples/common/default/default.css	Thu Feb 15 12:24:39 2018 +0859
     1.2 +++ b/examples/common/default/default.css	Mon May 28 10:39:32 2018 +0900
     1.3 @@ -97,6 +97,10 @@
     1.4      border: 1px solid black; border-collapse: collapse;
     1.5      white-space: pre-wrap;
     1.6  }
     1.7 +table.bloghead tr.preface td,
     1.8 +table.blog_replies ul, .blog_replies tr ul, .blog_replies td ul {
     1.9 +    text-align: left; white-space: normal; margin: 1ex 0;
    1.10 +}
    1.11  table.blog_replies p.proficon {
    1.12      float: right; margin: 0 1ex 0 0;
    1.13  }
     2.1 --- a/s4-funcs.sh	Thu Feb 15 12:24:39 2018 +0859
     2.2 +++ b/s4-funcs.sh	Mon May 28 10:39:32 2018 +0900
     2.3 @@ -518,7 +518,37 @@
     2.4  	  x; s|^|</table>|; x;		# Preppend /table to the next line
     2.5  	}
     2.6  	x;				# Back to the newest line
     2.7 -	p;				# Print rest'
     2.8 +	p;				# Print rest' | miniul
     2.9 +}
    2.10 +miniul() {
    2.11 +  sed -e '
    2.12 +	/^\* / {;			# 行頭 "* "
    2.13 +	 x; s,^,<ul>,; x;		# 1週目: ホールドスペース先頭に <ul> を
    2.14 +	:top
    2.15 +	 s/\n//;
    2.16 +	 s/^  *//;			# 2周目以降: 行頭空白削除
    2.17 +	 s,\* ,,;			# まず行頭の "* " を消しておく
    2.18 +	 H;				# 置き換え結果をホールドスペースに追加
    2.19 +	 s/.*//;			# パターンスペースは消しておく
    2.20 +	 # ↓最終行なら残ったホールドスペース処理のため :cont へ
    2.21 +	 $ b cont
    2.22 +	 N;				# 次の行を読む
    2.23 +	 s/\n//;			# 空白始まりは継続行
    2.24 +	 /^ /b top
    2.25 +	 x; s/\n/<li>/; s,$,</li>,;	# 継続行でなければ <li></li> で囲む
    2.26 +	 p; s/.*//;
    2.27 +	 x;				# 次も "* " ならループを抜けない
    2.28 +	 /^\* /b top
    2.29 +	 s,^,</ul>,;			# 次が一般行なら箇条書終わり
    2.30 +	}
    2.31 +
    2.32 +	:cont
    2.33 +	x;				# 行頭| 以外の行:
    2.34 +	/./ {;				# ホールドスペースに文字列があれば
    2.35 +	  s/^\n/<li>/; s,$,</li></ul>,;	# 箇条書を書き切って終わり
    2.36 +	  H; x
    2.37 +	}
    2.38 +	x'
    2.39  }
    2.40  acclog() (
    2.41    # $1=table, $2=rowid