On Nov 26, 2004, at 18:38, Detlef Hoge wrote:
Is there a translationscript for Text to HTML like in BBEdit (Translate) and ignore < and /> ? Example: ö -> ö
Here's a command that will convert the TM_SELECTED_TEXT variable to entities but leave the lower-than/greater-than symbols:
php -r '$a1 = array(); foreach(explode("<", stripslashes($_ENV["TM_SELECTED_TEXT"])) as $s1) { $a2 = array(); foreach(explode(">", $s1) as $s2) array_push($a2, htmlentities($s2, 0, "UTF-8")); array_push($a1, implode(">", $a2)); } echo implode("<", $a1);'
Go to Commands -> Edit Commands… press the + symbol, give it a name (and possible hotkey) and paste the string above -- it must be one long line w/o line breaks.
Then selecting text and choosing this new command from the menu will convert the selection as requested.