Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
98 lines (94 sloc) 3.2 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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>bundlePath</key>
<string>/Users/kumar/Library/Application Support/TextMate/Bundles/Custom.tmbundle</string>
<key>command</key>
<string>#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] &amp;&amp; . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
if grep &lt;&lt;&lt;${TM_CURRENT_WORD:-!} -Esq '^[a-zA-Z0-9_]+$'
then
if URL=`grep -i "^$TM_CURRENT_WORD=" "$TM_BUNDLE_SUPPORT/documentation.txt"`
then
URL=${URL:${#TM_CURRENT_WORD}+1}
else
URL="function.${TM_CURRENT_WORD//_/-}"
fi
if [[ "$PHP_MANUAL_LOCATION" ]]
then
if [[ ! -d "$PHP_MANUAL_LOCATION" ]]
then
exit_show_tool_tip "Your PHP_MANUAL_LOCATION directory ($PHP_MANUAL_LOCATION) does not exist. See the bundle Help for setup instructions."
fi
if [[ ! -f "$PHP_MANUAL_LOCATION/$URL.html" ]]
then
exit_show_tool_tip "No documentation found for '$TM_CURRENT_WORD'"
fi
. "$TM_SUPPORT_PATH/lib/webpreview.sh"
html_header "PHP Help" "${TM_FILENAME:-}"
cat &lt;&lt;-'HTML'
&lt;script type="text/javascript" charset="utf-8"&gt;
function jump(page) {
TextMate.isBusy = true;
res = TextMate.system('cat "$PHP_MANUAL_LOCATION"/' + page, null).outputString;
document.getElementById('php_help').innerHTML = res;
TextMate.isBusy = false;
setupLinks();
historyList = document.getElementById('history_list');
TextMate.log(historyList);
item = document.createElement('option');
TextMate.log(item);
item.value = page;
TextMate.log(page);
item.innerText = res.match(/&gt;(.+?)&lt;\/TITLE/i)[1];
historyList.appendChild(item);
item.selected = true;
}
function setupLinks() {
var link, links = document.links;
for (i = 0; i &lt; links.length; i++) {
link = links[i];
if (matches = link.href.match(/^x-txmt-command:.+\/(.+.html)$/)) {
link.href = 'javascript:jump("' + matches[1] + '")';
}
}
}
&lt;/script&gt;
HTML
echo '&lt;select id="history_list" onchange="jump(this.options[this.selectedIndex].value)"&gt;&lt;/select&gt;'
echo '&lt;div id="php_help"&gt;&lt;/div&gt;'
echo '&lt;script&gt;jump("'"$URL"'.html");&lt;/script&gt;'
html_footer
exit_show_html
else URL="http://php.net/manual/en/$URL.php"
fi
exit_show_html "&lt;meta http-equiv='Refresh' content='0;URL=$URL'&gt;"
else echo "Nothing to lookup (hint: place the caret on a function name)"
fi</string>
<key>input</key>
<string>none</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>^h</string>
<key>name</key>
<string>Documentation for Word</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>toolTip</string>
<key>scope</key>
<string>source.php</string>
<key>semanticClass</key>
<string>lookup.define.php</string>
<key>uuid</key>
<string>412481DC-89B7-11D9-9FE3-000A9584EC8C</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>