I think (untested) a major issue is that the URLs for the built-in variables are of the format http://www.auto-hotkey.com/docs/Variables.htm#Space instead of http://www.auto-hotkey.com/docs/Variables.htm#A_Space. So the "A_" will need to be removed if we want to link to each specific variable instead of http://www.auto-hotkey.com/docs/Variables.htm#BuiltIn for all the BIVs. I could remove the "A_" from all the variables in group 2, but that would mean that the "A_" would not be highlighted. Any suggestions?
Code: Select all
<?php
/*************************************************************************************
* autohotkey.php
* --------
* Author: Naveen Garg (naveen.garg@gmail.com)
* Copyright: (c) 2009 Naveen Garg and GeSHi and some parts kon
* Release Version: N/A (Edited version of 1.0.8.11)
* Date Started: 2009/06/11
*
* Autohotkey language file for GeSHi.
*
* CHANGES
* Editor: kon
* Revised: Oct. 9, 2013
*
* Release 1.0.8.5 (2009/06/11)
* - First Release
*
* TODO
* Update BIVs to link to the exact var
*
* Reference: http://www.auto-hotkey.com/docs/
*************************************************************************************
*
* The original file was part of GeSHi.
*
* GeSHi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GeSHi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GeSHi; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
************************************************************************************/
$language_data = array (
'LANG_NAME' => 'Autohotkey',
'COMMENT_SINGLE' => array(
1 => ';'
),
'COMMENT_MULTI' => array('/*' => '*/'),
'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
'QUOTEMARKS' => array('"'),
'ESCAPE_CHAR' => '',
'KEYWORDS' => array(
1 => array(
'and','else','false','if',
'in','is','not','or',
'return','true'
),
2 => array(
// built in variables
'A_AhkPath','A_AhkVersion','A_AppData','A_AppDataCommon',
'A_AutoTrim','A_BatchLines','A_CaretX','A_CaretY',
'A_ComputerName','A_ControlDelay','A_Cursor','A_DD',
'A_DDD','A_DDDD','A_DefaultMouseSpeed','A_Desktop',
'A_DesktopCommon','A_DetectHiddenText','A_DetectHiddenWindows','A_EndChar',
'A_EventInfo','A_ExitReason','A_FormatFloat','A_FormatInteger',
'A_Gui','A_GuiControl','A_GuiControlEvent','A_GuiEvent',
'A_GuiHeight','A_GuiWidth','A_GuiX','A_GuiY',
'A_Hour','A_IconFile','A_IconHidden','A_IconNumber',
'A_IconTip','A_Index','A_IPAddress1','A_IPAddress2',
'A_IPAddress3','A_IPAddress4','A_Is64bitOS','A_ISAdmin',
'A_IsCompiled','A_IsCritical','A_IsPaused','A_IsSuspended',
'A_IsUnicode','A_KeyDelay','A_Language','A_LastError',
'A_LineFile','A_LineNumber','A_LoopField','A_LoopFileAttrib',
'A_LoopFileDir','A_LoopFileExt','A_LoopFileFullPath','A_LoopFileLongPath',
'A_LoopFileName','A_LoopFileShortName','A_LoopFileShortPath','A_LoopFileSize',
'A_LoopFileSizeKB','A_LoopFileSizeMB','A_LoopFileTimeAccessed','A_LoopFileTimeCreated',
'A_LoopFileTimeModified','A_LoopReadLine','A_LoopRegKey','A_LoopRegName',
'A_LoopRegSubkey','A_LoopRegTimeModified','A_LoopRegType','A_MDAY',
'A_Min','A_MM','A_MMM','A_MMMM',
'A_Mon','A_MouseDelay','A_MSec','A_MyDocuments',
'A_Now','A_NowUTC','A_NumBatchLines','A_OSType',
'A_OSVersion','A_PriorHotkey','A_ProgramFiles','A_Programs',
'A_ProgramsCommon','A_PtrSize','A_RegView','A_ScreenDPI',
'A_ScreenHeight','A_ScreenWidth','A_ScriptDir','A_ScriptFullPath',
'A_ScriptHwnd','A_ScriptName','A_Sec','A_Space',
'A_StartMenu','A_StartMenuCommon','A_Startup','A_StartupCommon',
'A_StringCaseSense','A_Tab','A_Temp','A_ThisFunc',
'A_ThisHotkey','A_ThisLabel','A_ThisMenu','A_ThisMenuItem',
'A_ThisMenuItemPos','A_TickCount','A_TimeIdle','A_TimeIdlePhysical',
'A_TimeSincePriorHotkey','A_TimeSinceThisHotkey','A_TitleMatchMode','A_TitleMatchModeSpeed',
'A_UserName','A_WDay','A_WinDelay','A_WinDir',
'A_WorkingDir','A_YDay','A_YEAR','A_YWeek',
'A_YYYY','Clipboard','ClipboardAll','ComSpec',
'ErrorLevel','ProgramFiles'
),
3 => array(
// Commands
'AutoTrim','BlockInput','Break','Catch',
'Click','ClipWait','ComObjActive','ComObjArray',
'ComObjConnect','ComObjCreate','ComObjError','ComObjFlags',
'ComObjGet','ComObjQuery','ComObjType','ComObjValue',
'Continue','Control','ControlClick','ControlFocus',
'ControlGet','ControlGetFocus','ControlGetPos','ControlGetText',
'ControlMove','ControlSend','ControlSendRaw','ControlSetText',
'CoordMode','Critical','DetectHiddenText','DetectHiddenWindows',
'DllCall','Drive','DriveGet','DriveSpaceFree',
'Else','EnvAdd','EnvDiv','EnvGet',
'EnvMult','EnvSet','EnvSub','EnvUpdate',
'Exit','ExitApp','FileAppend','FileCopy',
'FileCopyDir','FileCreateDir','FileCreateShortcut','FileDelete',
'FileEncoding','FileGetAttrib','FileGetShortcut','FileGetSize',
'FileGetTime','FileGetVersion','FileInstall','FileMove',
'FileMoveDir','FileOpen','FileRead','FileReadLine',
'FileRecycle','FileRecycleEmpty','FileRemoveDir','FileSelectFile',
'FileSelectFolder','FileSetAttrib','FileSetTime','For',
'FormatTime','Gosub','Goto','GroupActivate',
'GroupAdd','GroupClose','GroupDeactivate','Gui',
'GuiControl','GuiControlGet','Hotkey','IfExist',
'IfInString','IfMsgBox','IfNotExist','IfNotInString',
'ImageSearch','IniDelete','IniRead','IniWrite',
'Input','InputBox','KeyHistory','KeyWait',
'ListHotkeys','ListLines','ListVars','Loop',
'Menu','MouseClick','MouseClickDrag','MouseGetPos',
'MouseMove','MsgBox','OnExit','OnMessage',
'OutputDebug','PixelGetColor','PixelSearch','PostMessage',
'Process','Progress','Random','RegDelete',
'RegExMatch','RegExReplace','RegisterCallback','RegRead',
'RegWrite','Reload','Repeat','Return',
'Run','RunAs','RunWait','SendLevel',
'SendMessage','SendMode','SetBatchLines','SetCapslockState',
'SetControlDelay','SetDefaultMouseSpeed','SetEnv','SetFormat',
'SetKeyDelay','SetMouseDelay','SetNumlockState','SetRegView',
'SetScrollLockState','SetStoreCapslockMode','SetStoreCapslockMode','SetTimer',
'SetTitleMatchMode','SetWinDelay','SetWorkingDir','Shutdown',
'Sleep','Sort','SoundBeep','SoundGet',
'SoundGetWaveVolume','SoundPlay','SoundSet','SoundSetWaveVolume',
'SplashImage','SplashTextOff','SplashTextOn','SplitPath',
'StatusBarGetText','StatusBarWait','StringCaseSense','StringGetPos',
'StringLeft','StringLen','StringLower','StringMid',
'StringReplace','StringRight','StringSplit','StringTrimLeft',
'StringTrimRight','StringUpper','Suspend','SysGet',
'Thread','Throw','ToolTip','Transform',
'TrayTip','Trim','Try','Until',
'URLDownloadToFile','VarSetCapacity','While','WinActivate',
'WinActivateBottom','WinClose','WinGet','WinGetActiveStats',
'WinGetActiveTitle','WinGetClass','WinGetPos','WinGetText',
'WinGetTitle','WinHide','WinKill','WinMaximize',
'WinMenuSelectItem','WinMinimize','WinMinimizeAll','WinMinimizeAllUndo',
'WinMove','WinRestore','WinSet','WinSetTitle',
'WinShow','WinWait','WinWaitActive','WinWaitClose',
'WinWaitNotActive'
),
4 => array(
// Built in functions
'Abs','ACos','Asc','ASin',
'ATan','Ceil','Chr','Cos',
'Exp','FileExist','Floor','Func',
'GetKeyName','GetKeyState','InStr','IsByRef',
'IsFunc','IsLabel','IsObject','Ln',
'Log','Mod','NumGet','NumPut',
'Round','SB_SetIcon','SB_SetParts','SB_SetText',
'Sin','Sqrt','StrLen','StrSplit',
'SubStr','Tan','WinActive','WinExist'
),
5 => array(
// #Directives
'AllowSameLineComments','ClipboardTimeout','CommentFlag','ErrorStdOut',
'EscapeChar','HotkeyInterval','HotkeyModifierTimeout','Hotstring',
'If','IfTimeout','InputLevel','InstallKeybdHook',
'InstallMouseHook','KeyHistory','LTrim','MaxHotkeysPerInterval',
'MaxMem','MaxThreads','MaxThreadsBuffer','MaxThreadsPerHotkey',
'MenuMaskKey','NoEnv','NoTrayIcon','Persistent',
'SingleInstance','UseHook','Warn','WinActivateForce'
),
6 => array(
// Keys
'Alt','AltDown','AltUp','AppsKey',
'BackSpace','Browser_Back','Browser_Favorites','Browser_Forward',
'Browser_Home','Browser_Refresh','Browser_Search','Browser_Stop',
'BS','CapsLock','Ctrl','CtrlBreak',
'CtrlDown','CtrlUp','Del','Delete',
'Down','End','Enter','Esc',
'Escape','F1','F10','F11',
'F12','F13','F14','F15',
'F16','F17','F18','F19',
'F2','F20','F21','F22',
'F23','F24','F3','F4',
'F5','F6','F7','F8',
'F9','Home','Ins','Insert',
'Joy1','Joy10','Joy11','Joy12',
'Joy13','Joy14','Joy15','Joy16',
'Joy17','Joy18','Joy19','Joy2',
'Joy20','Joy21','Joy22','Joy23',
'Joy24','Joy25','Joy26','Joy27',
'Joy28','Joy29','Joy3','Joy30',
'Joy31','Joy32','Joy4','Joy5',
'Joy6','Joy7','Joy8','Joy9',
'JoyAxes','JoyButtons','JoyInfo','JoyName',
'JoyPOV','JoyR','JoyU','JoyV',
'JoyX','JoyY','JoyZ','LAlt',
'Launch_App1','Launch_App2','Launch_Mail','Launch_Media',
'LButton','LControl','LCtrl','Left',
'LShift','LWin','LWinDown','LWinUp',
'MButton','Media_Next','Media_Play_Pause','Media_Prev',
'Media_Stop','NumLock','Numpad0','Numpad1',
'Numpad2','Numpad3','Numpad4','Numpad5',
'Numpad6','Numpad7','Numpad8','Numpad9',
'NumpadAdd','NumpadClear','NumpadDel','NumpadDiv',
'NumpadDot','NumpadDown','NumpadEnd','NumpadEnter',
'NumpadHome','NumpadIns','NumpadLeft','NumpadMult',
'NumpadPgdn','NumpadPgup','NumpadRight','NumpadSub',
'NumpadUp','Pause','PGDN','PGUP',
'PrintScreen','RAlt','RButton','RControl',
'RCtrl','Right','RShift','RWin',
'RWinDown','RWinUp','ScrollLock','Shift',
'ShiftDown','ShiftUp','Space','Tab',
'Up','Volume_Down','Volume_Mute','Volume_Up',
'WheelDown','WheelLeft','WheelRight','WheelUp',
'XButton1','XButton2'
),
7 => array(
// Gui commands
'Add','Cancel','Color','Default',
'Destroy','Flash','Flash','Font',
'GuiClose','GuiContextMenu','GuiDropFiles','GuiEscape',
'GuiSize','Margin','Menu','New',
'Show','Submit'
),
8 => array(
// Gui Controls
'ActiveX','Button','Checkbox','ComboBox',
'Custom','DateTime','DDL','DropDownList',
'Edit','GroupBox','Hotkey','Link',
'ListBox','ListView','MonthCal','Picture',
'Progress','Radio','Slider','StatusBar',
'Tab','Text','TreeView','UpDown'
),
9 => array(
// List View Functions
'IL_Add','IL_Create','IL_Destroy','LV_Add',
'LV_Delete','LV_DeleteCol','LV_GetCount','LV_GetNext',
'LV_GetText','LV_Insert','LV_InsertCol','LV_Modify',
'LV_ModifyCol','LV_SetImageList'
),
10 => array(
// Tree View Functions
'TV_Add','TV_Delete','TV_Get','TV_GetChild',
'TV_GetCount','TV_GetNext','TV_GetParent','TV_GetPrev',
'TV_GetSelection','TV_GetText','TV_Modify','TV_SetImageList'
),
11 => array(
'StrGet','StrPut'
),
12 => array(
'IfWinActive','IfWinExist','IfWinNotActive','IfWinNotExist'
),
13 => array(
'Include','IncludeAgain'
),
14 => array(
'IfEqual','IfGreater','IfGreaterOrEqual','IfLess',
'IfLessOrEqual','IfNotEqual'
),
15 => array(
'IfWinActive','IfWinNotActive'
),
16 => array(
'IfWinExist','IfWinNotExist'
),
17 => array(
'Send','SendEvent','SendInput','SendPlay',
'SendRaw'
)
),
'SYMBOLS' => array(
'(',')','[',']',
'+','-','*','/','&','^',
'=','+=','-=','*=','/=','&=',
'==','<','<=','>','>=',':=',
',','.'
),
'CASE_SENSITIVE' => array(
GESHI_COMMENTS => false,
1 => false,
2 => false,
3 => false,
4 => false,
5 => false,
6 => false,
7 => false,
8 => false,
9 => false,
10 => false,
11 => false,
12 => false,
13 => false,
14 => false,
15 => false,
16 => false,
17 => false
),
'STYLES' => array(
'KEYWORDS' => array(
1 => 'color: #AAAAFF; font-weight: bold;', // reserved #blue
2 => 'color: #88FF88;', // BIV yellow
3 => 'color: #FF00FF; font-style: italic;', // commands purple
4 => 'color: #888844; font-weight: bold;', // functions #0080FF
5 => 'color: #000000; font-style: italic;', // directives #black
6 => 'color: #FF0000; font-style: italic;', // hotkeys #red
7 => 'color: #000000; font-style: italic;', // gui commands #black
8 => 'color: #000000; font-style: italic;', // gui controls
9 => 'color: #888844; font-weight: bold;', // list view functions #0080FF
10 => 'color: #888844; font-weight: bold;', // tree view functions #0080FF
11 => 'color: #888844; font-weight: bold;', // StrPut/StrGet functions #0080FF
12 => 'color: #000000; font-style: italic;', // IfWin directives #black
13 => 'color: #000000; font-style: italic;', // Include directives #black
14 => 'color: #FF00FF; font-style: italic;', // commands purple
15 => 'color: #FF00FF; font-style: italic;', // commands purple
16 => 'color: #FF00FF; font-style: italic;', // commands purple
17 => 'color: #FF00FF; font-style: italic;' // commands purple
),
'COMMENTS' => array(
'MULTI' => 'font-style: italic; color: #669900;',
1 => 'font-style: italic; color: #009933;'
),
'ESCAPE_CHAR' => array(
0 => ''
),
'BRACKETS' => array(
0 => 'color: #00FF00; font-weight: bold;'
),
'STRINGS' => array(
0 => 'font-weight: bold; color: #008080;'
),
'NUMBERS' => array(
0 => 'color: #0000dd;'
),
'METHODS' => array(
1 => 'color: #0000FF; font-style: italic; font-weight: italic;'
),
'SYMBOLS' => array(
0 => 'color: #000000; font-weight: italic;'
),
'REGEXPS' => array(
0 => 'font-weight: italic; color: #A00A0;',
1 => 'color: #CC0000; font-style: italic;',
2 => 'color: #DD0000; font-style: italic;',
3 => 'color: #88FF88;'
),
'SCRIPT' => array(
)
),
'OOLANG' => false,
'OBJECT_SPLITTERS' => array(
1 => '_'
),
'REGEXPS' => array(
//Variables
0 => '%[a-zA-Z_][a-zA-Z0-9_]*%',
//hotstrings
1 => '::[\w\d]+::',
//labels
2 => '\w[\w\d]+:\s',
//Built-in Variables
3 => '\bA_\w+\b(?![^<]*>)'
),
'URLS' => array(
1 => '',
2 => 'http://www.auto-hotkey.com/docs/Variables.htm#BuiltIn',
3 => 'http://www.auto-hotkey.com/docs/commands/{FNAME}.htm',
4 => 'http://www.auto-hotkey.com/docs/Functions.htm#{FNAME}',
5 => 'http://www.auto-hotkey.com/docs/commands/_{FNAME}.htm',
6 => 'http://www.auto-hotkey.com/docs/KeyList.htm',
7 => 'http://www.auto-hotkey.com/docs/commands/Gui.htm#{FNAME}',
8 => 'http://www.auto-hotkey.com/docs/commands/GuiControls.htm#{FNAME}',
9 => 'http://www.auto-hotkey.com/docs/commands/ListView.htm#{FNAME}',
10 => 'http://www.auto-hotkey.com/docs/commands/TreeView.htm#{FNAME}',
11 => 'http://www.auto-hotkey.com/docs/commands/StrPutGet.htm',
12 => 'http://www.auto-hotkey.com/docs/commands/_IfWinActive.htm',
13 => 'http://www.auto-hotkey.com/docs/commands/_Include.htm',
14 => 'http://www.auto-hotkey.com/docs/commands/IfEqual.htm',
15 => 'http://www.auto-hotkey.com/docs/commands/IfWinActive.htm',
16 => 'http://www.auto-hotkey.com/docs/commands/IfWinExist.htm',
17 => 'http://www.auto-hotkey.com/docs/commands/Send.htm'
),
'STRICT_MODE_APPLIES' => GESHI_MAYBE,
'SCRIPT_DELIMITERS' => array(
),
'HIGHLIGHT_STRICT_BLOCK' => array(
0 => true,
1 => true,
2 => true,
3 => true
),
'PARSER_CONTROL' => array(
'KEYWORDS' => array(
5 => array(
'DISALLOWED_BEFORE' => '(?<!\w)\#'
)
)
)
);
?>
Spoiler
Edit: Everything following has been resolved:Here is another untested thought, this time on the font size. I posted this in another topic, but this thread is more appropriate:
The GeSHi docs say that GeSHi outputs code that is either in a <div> or a <pre> container. <div> typically results in text which is bigger than <pre>, hence the larger font we are seeing in codeboxes unless we add size tags to compensate.
Calling the set_overall_style method should adjust the font size and type. Something like this:
Code: Select all
$geshi->set_overall_style('font-family:Consolas; font-size: 68%;')