« START | トップページ | [AppleScript]urlencode変換【TextEdit版】 »

[AppleScript]htmlentities変換【TextEdit版】

こちらの記事
[AppleScript]htmlentities変換: [FORCE][LINK]新しいウィンドで開きます

テキストエディット版


 

OSX内蔵?phpを使います

■【htmlentities】
適用可能な文字を全て HTML エンティティに変換する
html_entity_decode
htmlentities

■【htmlspecialchars】
特殊文字を HTML エンティティに変換する
htmlspecialchars_decode
htmlspecialchars

 

■【htmlentities】
適用可能な文字を全て HTML エンティティに変換する


htmlentities

tell application "TextEdit"
tell front document
set TheTextToEncode to every paragraph
set theResult to my encodeURL(TheTextToEncode)
set every paragraph to theResult
end tell
end tell

on encodeURL(str)
set scpt to "php -r 'echo htmlentities(\"" & str & "\");'"
return do shell script scpt
end encodeURL


html_entity_decode

tell application "TextEdit"
tell front document
set TheTextToEncode to every paragraph
set theResult to my encodeURL(TheTextToEncode)
set every paragraph to theResult
end tell
end tell

on encodeURL(str)
set scpt to "php -r 'echo html_entity_decode(\"" & str & "\");'"
return do shell script scpt
end encodeURL

 
■【htmlspecialchars】
特殊文字を HTML エンティティに変換する


htmlspecialchars_decode

tell application "TextEdit"
tell front document
set TheTextToEncode to every paragraph
set theResult to my encodeURL(TheTextToEncode)
set every paragraph to theResult
end tell
end tell

on encodeURL(str)
set scpt to "php -r 'echo htmlspecialchars_decode(\"" & str & "\");'"
return do shell script scpt
end encodeURL


htmlspecialchars

tell application "TextEdit"
tell front document
set TheTextToEncode to every paragraph
set theResult to my encodeURL(TheTextToEncode)
set every paragraph to theResult
end tell
end tell

on encodeURL(str)
set scpt to "php -r 'echo htmlspecialchars(\"" & str & "\");'"
return do shell script scpt
end encodeURL

「htmlentities.zip」をダウンロード[Download]新しいウィンドで開きます

 
PHP: htmlspecialchars - Manual[LINK]新しいウィンドで開きます
PHP: htmlspecialchars_decode - Manual[LINK]新しいウィンドで開きます
PHP: html_entity_decode - Manual[LINK]新しいウィンドで開きます
PHP: htmlentities - Manual[LINK]新しいウィンドで開きます

  

|

« START | トップページ | [AppleScript]urlencode変換【TextEdit版】 »

CharacterEntity」カテゴリの記事

コメント

この記事へのコメントは終了しました。