Quantcast
Channel: 簡睿隨筆
Viewing all articles
Browse latest Browse all 897

讓WordPress SyntaxHighlighter Evolved外掛能顯示Lua語法

$
0
0

前幾天因為分享《擴充彈性十足的滑鼠手勢軟體:StrokesPlus》發現我的WordPress無法以SyntaxHighlighter顯示Lua程式語言,搜尋後修改檔案後,才能新增Lua Brush到SyntaxHighlighter Evolved外掛;操作步驟如下:

  1. http://ikpil.com/1191下載sbBrushLua.js並上傳到/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts資料夾。
  2. 編輯/wp-content/plugins/syntaxhighlighter/syntaxhighlighter.php:
    • 找下列敘述:
 
wp_register_script( 'syntaxhighlighter-brush-java',       plugins_url('syntaxhighlighter/' . $this->shfolder . '/scripts/shBrushJava.js'),       array('syntaxhighlighter-core'), $this->agshver );
  • 找到後在其上插入下列敘述:
 
wp_register_script( 'syntaxhighlighter-brush-lua',       plugins_url('syntaxhighlighter/' . $this->shfolder . '/scripts/shBrushLua.js'),       array('syntaxhighlighter-core'), $this->agshver );
  • 再搜尋下列敘述:
 
    'java'          => 'java',
  • 在其上插入下列敘述:
 
    'lua'          => 'lua',

這樣就能正確顯示Lua的高亮度外觀了:

-- this code sends the CTRL+W key combination, which 
-- will usually close a window or tab within an application
-- 取得有焦點的視窗
local handle = acGetForegroundWindow()
--acMessageBox(handle,"ActiveWindow",1)

local handleTaskman = acFindWindowByTitleRegex("工作管理員")
local handleEvernote = acFindWindow("ENMainFrame")
local handleConEmu = acFindWindow("VirtualConsoleClass")
local handleIDEA = acFindWindow("SunAwtFrame")
-- acMessageBox(handleEvernote,"handle Evernote",1)

if (handle == handleTaskman) or (handle == handleEvernote)
then
  acSendKeys("%{F_4}")
elseif (handle == handleConEmu) then
  acSendKeys("@%{DELETE}")
elseif (handle == handleIDEA) then
  acSendKeys("^{F_4}")
else
  acSendKeys("^w")
end


##

您可能也會有興趣的類似文章

PDF Plurk Google Bookmarks del.icio.us Live Add to favorites email

The post 讓WordPress SyntaxHighlighter Evolved外掛能顯示Lua語法 appeared first on 簡睿隨筆.


Viewing all articles
Browse latest Browse all 897

Trending Articles