mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>beforeRunningCommand</key>
|
|
<string>nop</string>
|
|
<key>command</key>
|
|
<string>#!/usr/bin/env ruby
|
|
$KCODE = 'U'
|
|
|
|
$entity_to_char = { }
|
|
File.open("#{ENV['TM_BUNDLE_SUPPORT']}/entities.txt").read.scan(/^(\d+)\t(.+)$/) do |key, value|
|
|
$entity_to_char[value] = [key.to_i].pack('U')
|
|
end
|
|
|
|
res = STDIN.read.gsub(/&(?:([a-z0-9]+)|#([0-9]+)|#x([0-9A-F]+));/i) do |m|
|
|
if $1 then
|
|
$entity_to_char[$1] || m
|
|
else
|
|
[$2 ? $2.to_i : $3.hex].pack("U")
|
|
end
|
|
end
|
|
|
|
print res
|
|
</string>
|
|
<key>fallbackInput</key>
|
|
<string>line</string>
|
|
<key>input</key>
|
|
<string>selection</string>
|
|
<key>keyEquivalent</key>
|
|
<string>@&</string>
|
|
<key>name</key>
|
|
<string>Decode Entities in Line / Selection</string>
|
|
<key>output</key>
|
|
<string>replaceSelectedText</string>
|
|
<key>scope</key>
|
|
<string>text.html</string>
|
|
<key>uuid</key>
|
|
<string>C183920D-A126-11D9-A5A2-000D93C8BE28</string>
|
|
</dict>
|
|
</plist>
|