parameters: (target,txt)
return_statement: return txt
docstring: Target-specific special escapes. Apply *before* insert any tag.
docstring_summary: Target-specific special escapes. Apply *before* insert any tag.
docstring_tokens: Target - specific special escapes . Apply * before * insert any tag .
function: def doEscape(target,txt):
  	"Target-specific special escapes. Apply *before* insert any tag."
  	tmpmask = 'vvvvThisEscapingSuxvvvv'
  	if target in ('html','sgml','xhtml','dbk'):
  		txt = re.sub('&','&amp;',txt)
  		txt = re.sub('<','&lt;',txt)
  		txt = re.sub('>','&gt;',txt)
  		if target == 'sgml':
  			txt = re.sub('\xff','&yuml;',txt)  # "+y
  	elif target == 'pm6':
  		txt = re.sub('<','<\#60>',txt)
  	elif target == 'mgp':
  		txt = re.sub('^%',' %',txt)  # add leading blank to avoid parse
  	elif target == 'man':
  		txt = re.sub("^([.'])", '\\&\\1',txt)		# command ID
  		txt = txt.replace(ESCCHAR, ESCCHAR+'e')		# \e
  	elif target == 'lout':
  		# TIP: / moved to FinalEscape to avoid //italic//
  		# TIP: these are also converted by lout:  ...  ---  --
  		txt = txt.replace(ESCCHAR, tmpmask)		# \
  		txt = txt.replace('"', '"%s""'%ESCCHAR)		# "\""
  		txt = re.sub('([|&{}@#^~])', '"\\1"', txt)	# "@"
  		txt = txt.replace(tmpmask, '"%s"'%(ESCCHAR*2))	# "\\"
  	elif target == 'tex':
  		# Mark literal \ to be changed to $\backslash$ later
  		txt = txt.replace(ESCCHAR, tmpmask)
  		txt = re.sub('([#$&%{}])', ESCCHAR+r'\1'  , txt)  # \%
  		txt = re.sub('([~^])'	 , ESCCHAR+r'\1{}', txt)  # \~{}
  		txt = re.sub('([<|>])'	 ,	   r'$\1$', txt)  # $>$
  		txt = txt.replace(tmpmask, maskEscapeChar(r'$\backslash$'))
  		# TIP the _ is escaped at the end
  	return txt
function_tokens: def doEscape ( target , txt ) : tmpmask = 'vvvvThisEscapingSuxvvvv' if target in ( 'html' , 'sgml' , 'xhtml' , 'dbk' ) : txt = re . sub ( '&' , '&amp;' , txt ) txt = re . sub ( '<' , '&lt;' , txt ) txt = re . sub ( '>' , '&gt;' , txt ) if target == 'sgml' : txt = re . sub ( '\xff' , '&yuml;' , txt ) # "+y elif target == 'pm6' : txt = re . sub ( '<' , '<\#60>' , txt ) elif target == 'mgp' : txt = re . sub ( '^%' , ' %' , txt ) # add leading blank to avoid parse elif target == 'man' : txt = re . sub ( "^([.'])" , '\\&\\1' , txt ) # command ID txt = txt . replace ( ESCCHAR , ESCCHAR + 'e' ) # \e elif target == 'lout' : # TIP: / moved to FinalEscape to avoid //italic// # TIP: these are also converted by lout:  ...  ---  -- txt = txt . replace ( ESCCHAR , tmpmask ) # \ txt = txt . replace ( '"' , '"%s""' % ESCCHAR ) # "\"" txt = re . sub ( '([|&{}@#^~])' , '"\\1"' , txt ) # "@" txt = txt . replace ( tmpmask , '"%s"' % ( ESCCHAR * 2 ) ) # "\\" elif target == 'tex' : # Mark literal \ to be changed to $\backslash$ later txt = txt . replace ( ESCCHAR , tmpmask ) txt = re . sub ( '([#$&%{}])' , ESCCHAR + r'\1' , txt ) # \% txt = re . sub ( '([~^])' , ESCCHAR + r'\1{}' , txt ) # \~{} txt = re . sub ( '([<|>])' , r'$\1$' , txt ) # $>$ txt = txt . replace ( tmpmask , maskEscapeChar ( r'$\backslash$' ) ) # TIP the _ is escaped at the end return txt