IPB

Willkommen, Gast ( Anmelden | Registrierung )

> Plugins mit Free-Pascal erstellen
meybohm
Beitrag 16.03.2004 - 10:28
Beitrag #1


is getting harder


Gruppe: User
Beiträge: 12
Mitglied seit: 31.10.2001
Mitglieds-Nr.: 6



QUELLTEXT
{
delete_html_tags.pas


Dieses Plugin löscht alle HTML-Tags innerhalb des geöffneten
Proton-Dokuments bzw. innerhalb des markierten Textes.


Beispielplugin
Proton Plugins mit dem Free Pascal Compiler erstellen.
Zum kompilieren folgenden Befehl aufrufen:
c:ppbinwin32ppc386 -Sd delete_html_tags.pas


Hinweis:
Um Proton als Free-Pascal IDE zu nutzen, einfach
folgenden Shortcut in den Programmeinstellungen
definieren:
command.com /k c:ppbinwin32ppc386 -Sd %A%
}


library delete_html_tags;


uses
 regexpr;


const KEINE_RUECKGABE=0;
     RUECKGABE_ERSETZT_MARKIERUNG = 1;
     RUECKGABE_ERSETZT_EDITORTEXT = 2;


var RUECKGABETYP:integer;


function pluginStart(text:pchar; selstart,sellength:integer) : pchar;  export;stdcall;
var
  r : tregexprengine;
  i,len : longint;
  s:string;
begin
r:=GenerateRegExprEngine('<[^>]+>',[]);
SetString(s,text,strlen(text));
if (sellength=0) then
 RUECKGABETYP:=RUECKGABE_ERSETZT_EDITORTEXT
else
    begin
 s:=copy(s,selstart+1,sellength);
 RUECKGABETYP:=RUECKGABE_ERSETZT_MARKIERUNG;
    end;
while RegExprPos(r,pchar(s),i,len) do
    begin
 delete(s,i+1,len);
    end;
DestroyregExprEngine(r);
pluginStart := pchar(s);
end;


function pluginRueckgabetyp:Integer;export;stdcall;
begin
 pluginRueckgabetyp :=RUECKGABETYP;
end;

function pluginInterfaceVersion: integer; export;stdcall;
begin
 pluginInterfaceVersion := 1;
end;

exports
pluginRueckgabetyp,
pluginStart,
pluginInterfaceVersion;


end.
Go to the top of the page
 
+Quote Post
 
Start new topic
Antworten
meybohm
Beitrag 21.03.2004 - 11:04
Beitrag #2


is getting harder


Gruppe: User
Beiträge: 12
Mitglied seit: 31.10.2001
Mitglieds-Nr.: 6



QUELLTEXT
{
html__generate_bullet_list.pas

Dieses Plugin erstellt aus dem markierten Zeilen bzw. aus dem
Proton-Dokument eine HTML-Bulletliste

<ul>
<li>line[0..n]</li>
</ul>

Beispielplugin
Proton Plugins mit dem Free Pascal Compiler erstellen.
Zum kompilieren folgenden Befehl aufrufen:
c:ppbinwin32ppc386 -Sd delete_html_tags.pas

Hinweis:
Um Proton als Free-Pascal IDE zu nutzen, einfach
folgenden Shortcut in den Programmeinstellungen
definieren:
command.com /k c:ppbinwin32ppc386 -Sd %A%
}

library html__generate_bullet_list;
uses classes;

const KEINE_RUECKGABE=0;
     RUECKGABE_ERSETZT_MARKIERUNG = 1;
     RUECKGABE_ERSETZT_EDITORTEXT = 2;

var RUECKGABETYP:integer;

function pluginStart(text:pchar; selstart,sellength:integer) : pchar;  export;stdcall;
var
  s:string;
  list:TStrings;
  i:integer;
begin
SetString(s,text,strlen(text));
if (sellength=0) then
 RUECKGABETYP:=RUECKGABE_ERSETZT_EDITORTEXT
else
    begin
 s:=copy(s,selstart+1,sellength);
 RUECKGABETYP:=RUECKGABE_ERSETZT_MARKIERUNG;
    end;
list:=TStringlist.create;
list.text:=s;
for i:=0 to list.count-1 do
    begin
 list[i]:='<li>'+list[i]+'</li>';
    end;
pluginStart := pchar('<ul>'+#10+list.text+#10+'</ul>');
end;

function pluginRueckgabetyp:Integer;export;stdcall;
begin
 pluginRueckgabetyp :=RUECKGABETYP;
end;

function pluginInterfaceVersion: integer; export;stdcall;
begin
 pluginInterfaceVersion := 1;
end;

exports
pluginRueckgabetyp,
pluginStart,
pluginInterfaceVersion;

end.
Go to the top of the page
 
+Quote Post

Beiträge in diesem Thema


Reply to this topicStart new topic
1 Besucher lesen dieses Thema (Gäste: 1 | Anonyme Besucher: 0)
0 Mitglieder:

 



RSS Vereinfachte Darstellung Aktuelles Datum: 28.03.2024 - 13:13

taschenkalender
expertise-panel IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here