Delphi-Highlighter für meine Homepage
Hi,
wie kann ich einen Delphi-Highlighter für meine Homepage mit PHP programmieren ? Ich hab schon einen aber der ist schlecht. |
Re: Delphi-Highlighter für meine Homepage
Kennst du die GeSHI Syntaxhighlighter for PHP (der 5te Link glaub ich)?
Das sind leistungsfähige Highlighter, die sogar auf phpBB portiert wurden (Ich wette, Daneil benutzt dass für den Delphi Code hier) |
Re: Delphi-Highlighter für meine Homepage
Zitat:
|
Re: Delphi-Highlighter für meine Homepage
Gut, jetzt habe ich diese Datei.
Delphi-Quellcode:
Und wie wende ich das an ? Mit dem beiliegenden Beispiel kann ich leider nicht viel anfangen.
<?php
$language_data = array ( 'LANG_NAME' => 'Delphi', 'COMMENT_SINGLE' => array(1 => '//'), 'COMMENT_MULTI' => array('(*' => '*)', '{' => '}'), 'CASE_KEYWORDS' => 0, 'QUOTEMARKS' => array("'", '"'), 'ESCAPE_CHAR' => '', 'KEYWORDS' => array( 1 => array( 'And', 'Array', 'As', 'Begin', 'Case', 'Class', 'Constructor', 'Destructor', 'Div', 'Do', 'DownTo', 'Else', 'End', 'Except', 'File', 'Finally', 'For', 'Function', 'Goto', 'If', 'Implementation', 'In', 'Inherited', 'Interface', 'Is', 'Mod', 'Not', 'Object', 'Of', 'On', 'Or', 'Packed', 'Procedure', 'Program', 'Property', 'Raise', 'Record', 'Repeat', 'Set', 'Shl', 'Shr', 'Then', 'ThreadVar', 'To', 'Try', 'Unit', 'Until', 'Uses', 'While', 'With', 'Xor' ), 2 => array( 'nil', 'false', 'true', 'var', 'type', 'const' ), 3 => array( 'Abs', 'Addr', 'AnsiCompareStr', 'AnsiCompareText', 'AnsiContainsStr', 'AnsiEndsStr', 'AnsiIndexStr', 'AnsiLeftStr', 'AnsiLowerCase', 'AnsiMatchStr', 'AnsiMidStr', 'AnsiPos', 'AnsiReplaceStr', 'AnsiReverseString', 'AnsiRightStr', 'AnsiStartsStr', 'AnsiUpperCase', 'ArcCos', 'ArcSin', 'ArcTan', 'Assigned', 'BeginThread', 'Bounds', 'CelsiusToFahrenheit', 'ChangeFileExt', 'Chr', 'CompareStr', 'CompareText', 'Concat', 'Convert', 'Copy', 'Cos', 'CreateDir', 'CurrToStr', 'CurrToStrF', 'Date', 'DateTimeToFileDate', 'DateTimeToStr', 'DateToStr', 'DayOfTheMonth', 'DayOfTheWeek', 'DayOfTheYear', 'DayOfWeek', 'DaysBetween', 'DaysInAMonth', 'DaysInAYear', 'DaySpan', 'DegToRad', 'DeleteFile', 'DiskFree', 'DiskSize', 'DupeString', 'EncodeDate', 'EncodeDateTime', 'EncodeTime', 'EndOfADay', 'EndOfAMonth', 'Eof', 'Eoln', 'Exp', 'ExtractFileDir', 'ExtractFileDrive', 'ExtractFileExt', 'ExtractFileName', 'ExtractFilePath', 'FahrenheitToCelsius', 'FileAge', 'FileDateToDateTime', 'FileExists', 'FilePos', 'FileSearch', 'FileSetDate', 'FileSize', 'FindClose', 'FindCmdLineSwitch', 'FindFirst', 'FindNext', 'FloatToStr', 'FloatToStrF', 'Format', 'FormatCurr', 'FormatDateTime', 'FormatFloat', 'Frac', 'GetCurrentDir', 'GetLastError', 'GetMem', 'High', 'IncDay', 'IncMinute', 'IncMonth', 'IncYear', 'InputBox', 'InputQuery', 'Int', 'IntToHex', 'IntToStr', 'IOResult', 'IsInfinite', 'IsLeapYear', 'IsMultiThread', 'IsNaN', 'LastDelimiter', 'Length', 'Ln', 'Lo', 'Log10', 'Low', 'LowerCase', 'Max', 'Mean', 'MessageDlg', 'MessageDlgPos', 'MonthOfTheYear', 'Now', 'Odd', 'Ord', 'ParamCount', 'ParamStr', 'Pi', 'Point', 'PointsEqual', 'Pos', 'Pred', 'Printer', 'PromptForFileName', 'PtInRect', 'RadToDeg', 'Random', 'RandomRange', 'RecodeDate', 'RecodeTime', 'Rect', 'RemoveDir', 'RenameFile', 'Round', 'SeekEof', 'SeekEoln', 'SelectDirectory', 'SetCurrentDir', 'Sin', 'SizeOf', 'Slice', 'Sqr', 'Sqrt', 'StringOfChar', 'StringReplace', 'StringToWideChar', 'StrToCurr', 'StrToDate', 'StrToDateTime', 'StrToFloat', 'StrToInt', 'StrToInt64', 'StrToInt64Def', 'StrToIntDef', 'StrToTime', 'StuffString', 'Succ', 'Sum', 'Tan', 'Time', 'TimeToStr', 'Tomorrow', 'Trunc', 'UpCase', 'UpperCase', 'VarType', 'WideCharToString', 'WrapText', 'Yesterday', 'Append', 'AppendStr', 'Assign', 'AssignFile', 'AssignPrn', 'Beep', 'BlockRead', 'BlockWrite', 'Break', 'ChDir', 'Close', 'CloseFile', 'Continue', 'DateTimeToString', 'Dec', 'DecodeDate', 'DecodeDateTime', 'DecodeTime', 'Delete', 'Dispose', 'EndThread', 'Erase', 'Exclude', 'Exit', 'FillChar', 'Flush', 'FreeAndNil', 'FreeMem', 'GetDir', 'GetLocaleFormatSettings', 'Halt', 'Inc', 'Include', 'Insert', 'MkDir', 'Move', 'New', 'ProcessPath', 'Randomize', 'Read', 'ReadLn', 'ReallocMem', 'Rename', 'ReplaceDate', 'ReplaceTime', 'Reset', 'ReWrite', 'RmDir', 'RunError', 'Seek', 'SetLength', 'SetString', 'ShowMessage', 'ShowMessageFmt', 'ShowMessagePos', 'Str', 'Truncate', 'Val', 'Write', 'WriteLn' ), 4 => array( 'AnsiChar', 'AnsiString', 'Boolean', 'Byte', 'Cardinal', 'Char', 'Comp', 'Currency', 'Double', 'Extended', 'Int64', 'Integer', 'LongInt', 'LongWord', 'PAnsiChar', 'PAnsiString', 'PChar', 'PCurrency', 'PDateTime', 'PExtended', 'PInt64', 'Pointer', 'PShortString', 'PString', 'PVariant', 'PWideChar', 'PWideString', 'Real', 'Real48', 'ShortInt', 'ShortString', 'Single', 'SmallInt', 'String', 'TBits', 'TConvType', 'TDateTime', 'Text', 'TextFile', 'TFloatFormat', 'TFormatSettings', 'TList', 'TObject', 'TOpenDialog', 'TPoint', 'TPrintDialog', 'TRect', 'TReplaceFlags', 'TSaveDialog', 'TSearchRec', 'TStringList', 'TSysCharSet', 'TThreadFunc', 'Variant', 'WideChar', 'WideString', 'Word' ), ), 'CASE_SENSITIVE' => array( GESHI_COMMENTS => true, 1 => false, 2 => false, 3 => false, 4 => false, ), 'STYLES' => array( 'KEYWORDS' => array( 1 => 'color: #000000; font-weight: bold;', 2 => 'color: #000000; font-weight: bold;', 3 => 'color: #000066;', 4 => 'color: #993333;' ), 'COMMENTS' => array( 1 => 'color: #808080; font-style: italic;', 'MULTI' => 'color: #808080; font-style: italic;' ), 'ESCAPE_CHAR' => array( ), 'BRACKETS' => array( 0 => 'color: #66cc66;' ), 'STRINGS' => array( 0 => 'color: #ff0000;' ), 'NUMBERS' => array( 0 => 'color: #cc66cc;' ), 'METHODS' => array( 1 => 'color: #006600;' ), 'REGEXPS' => array( 0 => 'color: #9ac;', 1 => 'color: #ff0000;' ), 'SYMBOLS' => array( 0 => 'color: #66cc66;' ), 'SCRIPT' => array( ) ), 'URLS' => array( 1 => '', 2 => '', 3 => '', 4 => '' ), 'OOLANG' => true, 'OBJECT_SPLITTERS' => array( 1 => '.' ), 'REGEXPS' => array( 0 => '\$[0-9a-fA-F]+', 1 => '\#\$?[0-9]{1,3}' ), 'STRICT_MODE_APPLIES' => GESHI_NEVER, 'SCRIPT_DELIMITERS' => array( ), 'HIGHLIGHT_STRICT_BLOCK' => array( ) ); ?> |
Re: Delphi-Highlighter für meine Homepage
|
Re: Delphi-Highlighter für meine Homepage
Zitat:
@s2b: nicht sauer sein, den hatte ich schon :mrgreen: |
Re: Delphi-Highlighter für meine Homepage
Zitat:
|
Re: Delphi-Highlighter für meine Homepage
Zitat:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 //EN">
<html> <head> <title></title> <meta name="author" content="NILS1"> <meta name="generator" content="Ulli Meybohms HTML EDITOR"> </head> <body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000"> <?php // // Include the GeSHi library // include_once('geshi.php'); // // Define some source to highlight, a language to use // and the path to the language files // $code = geshi_highlight($source, 'java', $path, true) //(* $source = '$foo = 45; for ( $i = 1; $i < $code; $i++ ) { echo "$foo \n"; --$foo; }'; $language = 'php'; // // Create a GeSHi object // $geshi =& new GeSHi($source, $language); // // And echo the result! // echo $geshi->parse_code(); ?> </body> </html> |
Re: Delphi-Highlighter für meine Homepage
Wo hakt's denn?
Ich hab es mal eben installiert, funktioniert einwandfrei. Live-Demo Quell-Datei GeSHi selbst liegt im gleichen Ordner inkl. geshi-Unterordner. // Edit: Hab mir Deinen Code mal angeschaut, änder mal die Zeilen 19 und 20 ab:
Code:
Und hier nochmal die Live-Demo und dieQuelle.
// alt:
19: $code = geshi_highlight($source, 'java', $path, true) 20: //(* $source = '$foo = 45; // neu 19: $code = geshi_highlight($source, 'java', $path, true); 20: $source = '$foo = 45; Daniel |
Re: Delphi-Highlighter für meine Homepage
Also angezeigt wird der Code ja, aber nicht gehighlighted :gruebel:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:09 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz