;;; Licence: GPL 
;;; Authors: Vincent Danjean

<define-tag mailto whitespace=delete>
  <preserve email text notext>
  <set-var %attributes>
  <preserve name host>

  <set-var name=<subst-in-string <get-var email> "@.*$">>
  <set-var host=<subst-in-string <get-var email> "^.*@">>

  <if <not <or <get-var text> <get-var notext>>>
    <set-var text="<get-var name>@<get-var host>">
  />

  <a href="mailto:<get-var
 name>@<get-var host>" <attributes-quote <attributes-remove 
 email,text,notext %attributes>>><get-var text></a>

  <restore name host>
  <restore email text notext>
</define-tag>
  
<define-tag email whitespace=delete>
  <preserve email>
  <set-var <attributes-extract email %attributes>>
  <preserve name host>

  <set-var name=<subst-in-string <get-var email> "@.*$">>
  <set-var host=<subst-in-string <get-var email> "^.*@">>
  <get-var name>@<get-var host>

  <restore name host>
  <restore email>
</define-tag>