III. Exemple de coloration des codes▲
III-A. CSS▲
Sélectionnez
/*
définition
du
style
de
la
police,
et
largeur
du
select
*/
select {
font-family :
Courier ;
font-size :
10px
;
width :
200px
;
}
/*
élément
de
couleur
bleu
*/
option.bl_eu
{
color :
#
0000FF
;
background-color :
#
00CCFF
;
background :
blue
url
(img
.
png
) ;
background-color :
blue
;
background-image :
url
(img
.
png
) ;
}
III-B. Delphi et Delphi pour .NET▲
Sélectionnez
//
commentaire
{
Un
commentaire
sur
plusieurs
lignes
}
{$
une
directive
}
Var
i:Integer
;
<a href="lien.html?parametre1=valeur1&parametre2=valeur2">test</a>
(*
Et
un
autre
*)
begin
For
i:=Onglet.PageCount-1
DownTo
0
Do
Begin
Onglet.ActivePageIndex:=i;
//
En
commentaire
d
ON
'
euuuuuu
ShowMessage('
Truc
muche
!
'
kqjhsd'
jhkjh
'
'
'
'
'
'
hghg
'
'
'
'
hg
'
); //
c'est
un
comment
!
{
et
un
autre
}
FileName:= '
Document.doc
'
; //
ou
'Document.rtf'
URL ='
http://toto.com
'
;
End
;
end
;
III-C. JAVA▲
Sélectionnez
//
un
comment
en
deb
public
class
MaClasse{
public
static
Map uneVariableStatique =
new
HashMap
();
static
{
/*
uneVariableStatique.put("une
clef","une
valeur");
uneVariableStatique.put("une
autre
clef","une
autre
http://
jshdjshd");
*/
//
etc
un
comment
et
import
uneVariableStatique.put
("
une
clef
"
,"
une
http://valeur
"
);
uneVariableStatique.put
("
une
autre
clef
"
,"
une
autr\"e
valeur\\\"
"
);
qal.declareImports
("
import
com.unilog.data.Track
"
);
import
toto;
}
}
III-D. Perl▲
III-E. PHP▲
III-F. XML▲
Sélectionnez
<?
xml
version="1.0"
encoding="ISO-8859-1"?
>
<
document
>
<
xiti
>
<!--
compteur
Dotnet
-->
<
alias
>
Dotnet<
/
alias
>
<
logg_er
>
logv99<
/
logg_er
>
<
id
>
12345<
/
id
>
<
/
xiti
>
<
/
document
>
III-G. HTML▲
III-H. PYTHON▲
Sélectionnez
class
Personne:
def
__init__
(self, nom, prenom):
self.nom =
nom
self.prenom =
prenom
def
presenter
(self) :
return
self.nom +
"
"
+
self.prenom
class
Etudiant
(Personne):
def
__init__
(self, niveau, nom, prenom):
Personne.__init__
(self, nom, prenom)
self.niveau =
niveau
def
presenter
(self):
return
self.niveau +
"
"
+
Personne.presenter
(self)
e =
Etudiant
("
Licence
INFO
"
, "
Dupontel
"
, "
Albert
"
)
assert
e.nom =
=
"
Dupontel
"
III-I. DELPHI▲
Sélectionnez
unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class
(TForm)
private
{
Déclarations
privées
}
public
{
Déclarations
publiques
}
end
;
var
Form1: TForm1;
implementation
{$
R
*.dfm
}
end
.
III-J. PASCAL▲
Sélectionnez
unit
Unit1;
{$
mode
objfpc
}
{$
H+
}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{
TForm1
}
TForm1 = class
(TForm)
Label1: TLabel; {
le
label
"Hello
world!"
posé
sur
la
fenêtre
}
private
{
private
declarations
}
public
{
public
declarations
}
end
;
var
Form1: TForm1;
implementation
initialization
{$
I
unit1.lrs
}
end
.