;+
; NAME:
; www_help_mailto
; PURPOSE:
; Encode emai address for insertion in web page
; CATEGORY:
; gen/idl
; CALLING SEQUENCE:
FUNCTION www_help_mailto, email, href=href, title=title, subject=subject
; INPUTS:
; email scalar; type: string; default: none
; if no email address is specified then the
; null string is returned
; OPTIONAL INPUT PARAMETERS:
; /href if set, return full HTML mailto string, i.e.
; title
;
; Only used if /href is set:
;
; title=title scalar; type: string
; text to be used in HTML mailto string
; subject=subject scalar; type: string; default: none
; text for email subject field
; OUTPUTS:
; mailto scalar; type: string encoded email address
; INCLUDE:
@compile_opt.pro ; On error, return to caller
; CALLS:
; IsType, InitVar
; PROCEDURE:
; Email address is replaced by sequence of HTML special chars (using
; ascii codes).
; MODIFICATION HISTORY:
; DEC-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
;-
mailto = ''
IF IsType(email,/string) THEN BEGIN
mailto = ''+strjoin(string(byte(email),format='(I3.3)'),';')+';'
InitVar, title, mailto
InitVar, href , /key
mailto = ''+strjoin(string(byte(email),format='(I3.3)'),';')+';'
IF href THEN BEGIN
mailto = ''+title+''
ENDIF
ENDIF
RETURN, mailto & END