[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]
| 固定リンク
「CharacterEntity」カテゴリの記事
- [AppleScripts]シングルクオトのエスケープ処理(phpを使う時のお約束)(2013.05.26)
- [AppleScript]ユニコードエスケープをデコードする【その2:pythonを使う】(2013.02.10)
- [AppleScript]ユニコードエスケープをデコードする【その1:phpを使う】(2013.02.10)
- [HTML5]Named character references(2011.01.21)
- これは便利だぁCharacterEntity取得ツール(2011.01.15)
この記事へのコメントは終了しました。
コメント