changeset 284:28284f903ddc

Allow OSM Wikistyle notation in hreflink()
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 06 Aug 2016 22:39:52 +0859
parents fe73fb3f9f35
children e87d6bc1e62a
files s4-funcs.sh
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Sat Aug 06 12:20:47 2016 +0859
+++ b/s4-funcs.sh	Sat Aug 06 22:39:52 2016 +0859
@@ -437,8 +437,24 @@
   echo  "\">`gecos $1`</a>"
 }
 hreflink() {
+  # s4 specific notation:
+  #   ^href=URL
+  #   ^iframe=URL
+  # OSM umap Wikistyle Notation:
+  #   [[URL]]		- Simle Link
+  #   [[URL|Word]]	- Link with anchor word
+  #   {{URL}}		- <img src="URL">
+  #   {{URL|width}}	- <img src="URL" width="width">
+  #   {{{URL}}	}	- <iframe src="URL"></iframe>
+  #   {{{URL|height}}	- <iframe src="URL" height="height"></iframe>
   _hrefptn="[-A-Za-z0-9,.:;/~_%#&+?=@!]*"
-  sed -e "s|^href=\($_hrefptn\)|<a &>\1</a>|" \
+  sed -e "s|\[\[\($_hrefptn\)\|\(.*\)\]\]|<a href=\"\1\">\2</a>|g" \
+      -e "s|\[\[\($_hrefptn\)\]\]|<a href=\"\1\">\1</a>|" \
+      -e "s|{{{\($_hrefptn\)\|\(.*\)}}}|<iframe src=\"\1\" height=\"\2\"></iframe>|g" \
+      -e "s|{{{\($_hrefptn\)}}}|<iframe src=\"\1\"></iframe>|g" \
+      -e "s|{{\($_hrefptn\)\|\(.*\)}}|<img src=\"\1\" width=\"\2\">|g" \
+      -e "s|{{\($_hrefptn\)}}|<img src=\"\1\">|g"\
+      -e "s|^href=\($_hrefptn\)|<a &>\1</a>|" \
       -e "s|^iframe=\($_hrefptn\)|<iframe src=\"\1\"></iframe>|"
 }
 acclog() (

yatex.org