s4

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 diff
     1.1 --- a/s4-funcs.sh	Sat Aug 06 12:20:47 2016 +0859
     1.2 +++ b/s4-funcs.sh	Sat Aug 06 22:39:52 2016 +0859
     1.3 @@ -437,8 +437,24 @@
     1.4    echo  "\">`gecos $1`</a>"
     1.5  }
     1.6  hreflink() {
     1.7 +  # s4 specific notation:
     1.8 +  #   ^href=URL
     1.9 +  #   ^iframe=URL
    1.10 +  # OSM umap Wikistyle Notation:
    1.11 +  #   [[URL]]		- Simle Link
    1.12 +  #   [[URL|Word]]	- Link with anchor word
    1.13 +  #   {{URL}}		- <img src="URL">
    1.14 +  #   {{URL|width}}	- <img src="URL" width="width">
    1.15 +  #   {{{URL}}	}	- <iframe src="URL"></iframe>
    1.16 +  #   {{{URL|height}}	- <iframe src="URL" height="height"></iframe>
    1.17    _hrefptn="[-A-Za-z0-9,.:;/~_%#&+?=@!]*"
    1.18 -  sed -e "s|^href=\($_hrefptn\)|<a &>\1</a>|" \
    1.19 +  sed -e "s|\[\[\($_hrefptn\)\|\(.*\)\]\]|<a href=\"\1\">\2</a>|g" \
    1.20 +      -e "s|\[\[\($_hrefptn\)\]\]|<a href=\"\1\">\1</a>|" \
    1.21 +      -e "s|{{{\($_hrefptn\)\|\(.*\)}}}|<iframe src=\"\1\" height=\"\2\"></iframe>|g" \
    1.22 +      -e "s|{{{\($_hrefptn\)}}}|<iframe src=\"\1\"></iframe>|g" \
    1.23 +      -e "s|{{\($_hrefptn\)\|\(.*\)}}|<img src=\"\1\" width=\"\2\">|g" \
    1.24 +      -e "s|{{\($_hrefptn\)}}|<img src=\"\1\">|g"\
    1.25 +      -e "s|^href=\($_hrefptn\)|<a &>\1</a>|" \
    1.26        -e "s|^iframe=\($_hrefptn\)|<iframe src=\"\1\"></iframe>|"
    1.27  }
    1.28  acclog() (