diff s4-funcs.sh @ 485:021e7943fd99

Emphasis pattern *word*, _word_ and strong pattern **word**, __word__
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 06 Feb 2018 11:06:10 +0900
parents be821d63848c
children 44b4a45e2617
line wrap: on
line diff
--- a/s4-funcs.sh	Fri Feb 02 10:09:49 2018 +0900
+++ b/s4-funcs.sh	Tue Feb 06 11:06:10 2018 +0900
@@ -468,6 +468,12 @@
   #   {{URL|width}}	- <img src="URL" width="width">
   #   {{{URL}}	}	- <iframe src="URL"></iframe>
   #   {{{URL|height}}	- <iframe src="URL" height="height"></iframe>
+  # Other Style
+  #   ----		- <hr> (In the beginning of line)
+  #   *Word*		- <em>Word</em>
+  #   _Word_		- <em>Word</em>
+  #   **Word**		- <strong>Word</strong>
+  #   __Word__		- <strong>Word</strong>
   _hrefptn="[-A-Za-z0-9,.:;/~_%#&+?=@!]*"
   _hrefptn="[A-Za-z0-9/~%+?=@!.][^][()<> ]*"	# URL should start with ASCII
   sed -e "s|\[\[\#\([0-9][0-9]*\)\]\]|<a href=\"?aid\1\">#\1</a>|g" \
@@ -483,7 +489,11 @@
       -e "s,^#### *\(.*\),<h4>\1</h4>," \
       -e "s,^### *\(.*\),<h3>\1</h3>," \
       -e "s,^## *\(.*\),<h2>\1</h2>," \
-      -e 's,^----*$,<hr>,'
+      -e 's,^----*$,<hr>,' \
+      -e 's,\*\*\([^* |][^*|]*[^ |]\)\*\*,<strong>\1</strong>,g' \
+      -e 's,__\([^_ |][^_]*[^ ]\)__,<strong>\1</strong>,g' \
+      -e 's,\*\([^* |][^*|]*[^ |]\)\*,<em>\1</em>,g' \
+      -e 's,_\([^_ ][^_]*[^ ]\)_,<em>\1</em>,g'
 }
 minitbl() {
   sed -n '

yatex.org