Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Delphi-Highlighter für meine Homepage (https://www.delphipraxis.net/58124-delphi-highlighter-fuer-meine-homepage.html)

Nils_13 1. Dez 2005 16:59


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.

noHuman 1. Dez 2005 17:16

Re: Delphi-Highlighter für meine Homepage
 
Kennst du die Bei Google suchenGeSHI 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)

Daniel Schuhmann 1. Dez 2005 17:28

Re: Delphi-Highlighter für meine Homepage
 
Zitat:

Zitat von noHuman
Kennst du die Bei Google suchenGeSHI Syntaxhighlighter for PHP (der 5te Link glaub ich)?

http://qbnz.com/highlighter/

Nils_13 1. Dez 2005 17:31

Re: Delphi-Highlighter für meine Homepage
 
Gut, jetzt habe ich diese Datei.
Delphi-Quellcode:
<?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(
      )
);

?>
Und wie wende ich das an ? Mit dem beiliegenden Beispiel kann ich leider nicht viel anfangen.

Hador 1. Dez 2005 17:35

Re: Delphi-Highlighter für meine Homepage
 
Den hier gibt es auch noch:
(ungetestet)
http://www.s2b-project.de/

Nils_13 1. Dez 2005 17:37

Re: Delphi-Highlighter für meine Homepage
 
Zitat:

Zitat von Hador
Den hier gibt es auch noch:
(ungetestet)
http://www.s2b-project.de/

@Hador: den hatte ich gerade eben läuft nicht so.
@s2b: nicht sauer sein, den hatte ich schon :mrgreen:

Daniel Schuhmann 1. Dez 2005 17:40

Re: Delphi-Highlighter für meine Homepage
 
Zitat:

Zitat von Nils_13
Und wie wende ich das an?

Punkt 2.3 in der Dokumentation sollte weiterhelfen.

Nils_13 1. Dez 2005 17:49

Re: Delphi-Highlighter für meine Homepage
 
Zitat:

Zitat von Daniel Schuhmann
Zitat:

Zitat von Nils_13
Und wie wende ich das an?

Punkt 2.3 in der Dokumentation sollte weiterhelfen.

Nicht wirklich.
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>

Daniel Schuhmann 1. Dez 2005 20:42

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:
// 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;
Und hier nochmal die Live-Demo und dieQuelle.

Daniel

Nils_13 3. Dez 2005 16:33

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.
Seite 1 von 2  1 2      

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