[TxMt] Again: Text to HTML translation

José Campos jose.campos+tm at galacsys.com
Fri Nov 26 18:13:39 UTC 2004


Detlef Hoge <info at detlefhoge.de> wrote:

> Hi there,
> 
> Is there a translationscript for Text to HTML like in BBEdit 
> (Translate) and ignore < and /> ? Example: ö -> ö

    If this can help you : years ago, I was using this AppleScript
(Copy-Launch Script-Paste)

8<--
considering case

    set Original to {"à", "À", "á", "Á", "â", "Â", "ä", "Ä", "ã", "Ã",
"å", "Å", "æ", "Æ", "ç", "Ç", "è", "È", "é", "É", "ê", "Ê", "ë", "Ë",
"ì", "Ì", "í", "Í", "î", "Î", "ï", "Ï", "ñ", "Ñ", "Ò", "Ò", "ó", "Ó",
"ô", "Ô", "ø", "Ø", "œ", "Œ", "ù", "Ù", "ú", "Ú", "û", "Û", "ü", "Ü",
"ÿ", "Ÿ", "ß", "€", "©", "®"}
    
    set Modifie to {"à", "À", "á", "Á",
"â", "Â", "ä", "Ä", "ã", "Ã",
"å", "Å", "æ", "Æ", "ç", "Ç",
"è", "È", "é", "É", "ê", "Ê",
"ë", "Ë", "ì", "Ì", "í", "Í",
"î", "Î", "ï", "Ï", "ñ", "Ñ",
"Ò", "Ò", "ó", "Ó", "ô", "Ô",
"ø", "Ø", "œ", "Œ", "ù", "Ù",
"ú", "Ú", "û", "Û", "ü", "Ü",
"ÿ", "Ÿ", "ß", "€", "©", "®}

    set ull1 to the clipboard
    
    set ull2 to ""
    repeat with i from 1 to (the number of characters of ull1)
        set mychar to character i of ull1
        repeat with j from 1 to (count items of Original)
            if item j of Original = character i of ull1 then
                set mychar to (item j of Modifie)
            end if
        end repeat
        set ull2 to ull2 & mychar
    end repeat
    
    set the clipboard to ull2 as text
end considering

8<--


-- 
  Jo                                         <W:00°04'37" ; N:47°15'36">

1....'....12.....'....24.....'....36.....'....48.....'....60.....'....72



More information about the textmate mailing list