Différences entre les versions de « Modèle:CodeTr »
De Paint
m (1 révision importée) |
toross>Atoross |
||
Ligne 1 : | Ligne 1 : | ||
<includeonly>{{#tag: | <includeonly>{{#tag:truncHtml| | ||
{{#tag: source|{{{code|}}} | |||
|lang={{{lang|text}}} | |||
|line={{{line|}} | |||
|start={{{start|}}} | |||
|style=width:{{{width|70}}}ch;{{{style|}}} | |||
}}|width={{{width|70}}} }} | |||
</includeonly> | |||
<noinclude> | |||
{{Model | {{Model | ||
|class=lang | |class=lang | ||
|texte=Ce modèle sert présenter un code programmation. | |texte=Ce modèle sert présenter un code programmation. | ||
|auteurs= | |auteurs= | ||
|syntaxe=<nowiki>{{codeTr|lang=|code=}}</nowiki> | |syntaxe=<nowiki>{{codeTr|lang=|code=}}</nowiki> | ||
|specification= | |specification= | ||
Ligne 10 : | Ligne 18 : | ||
; code= | ; code= | ||
: le code (text) | : le code (text) | ||
; line=1 | |||
: | |||
; start=100 | |||
: | |||
; width | ; width | ||
: largeur en nombre de caractères, défaut : | : largeur en nombre de caractères, défaut : 70 | ||
; style=border:3px dashed blue; | |||
: | |||
}} | }} | ||
Exemple : | Exemple : | ||
<pre><nowiki>{{parW|{{codeTr|width=75|lang=text|style=border:3px dashed blue;|code= | |||
item1 | #23456789 123456789 123456789 123456789 1234567890123456789 123456789 12345 | ||
# 1 2 3 4 5 6 7 | |||
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 | |||
item2 | item2 | ||
}} }} | }}}} | ||
{{codeTr|lang= | {{parW|{{codeTr|line=1|Start=100|width=50|lang=text|code= | ||
# | #23456789 123456789 123456789 123456789 1234567890123456789 123456789 123456789 | ||
# 1 2 3 4 5 6 7 8 | # 1 2 3 4 5 6 7 8 | ||
#include <time.h> | item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 | ||
item2 | |||
}}}} | |||
{{parW| | |||
{{codeTr|lang=cpp|start=300|line=1|width=70|style=border:3px dashed red;|code= | |||
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 | |||
# 1 2 3 4 5 6 7 | |||
#include <time.h> | |||
#include <stdio.h> | #include <stdio.h> | ||
void sleep( time_t nb_sec | void sleep( time_t nb_sec ) | ||
{ | { | ||
time_t limit, top; time(&top); limit = top + nb_sec ; | time_t limit, top; time(&top); limit = top + nb_sec ; | ||
Ligne 33 : | Ligne 56 : | ||
int main( int argc, char * argv[] ) | int main( int argc, char * argv[] ) | ||
{ | { | ||
time_t start, stop; time(&start); sleep( 5 ) ; time(&stop); printf("start : %ld\n",start ); printf("stop : %ld\n",stop ); printf("in seconds: %f\n",difftime(stop,start)); | time_t start, stop; time(&start); sleep( 5 ) ; time(&stop); printf("start :%ld\n",start ); printf("stop : %ld\n",stop ); printf("in seconds: %f\n",difftime(stop,start)); | ||
} | } | ||
}}</nowiki> | }} | ||
}}</nowiki></pre> | |||
donnera : | donnera : | ||
{{parW|{{codeTr|width=75|lang=text|style=border:3px dashed blue;|code= | |||
{{parW|{{codeTr | #23456789 123456789 123456789 123456789 1234567890123456789 123456789 12345 | ||
item1 | # 1 2 3 4 5 6 7 | ||
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 | |||
item2 | item2 | ||
}}}} | }}}} | ||
{{codeTr|width= | {{parW|{{codeTr|line=1|Start=100|width=50|lang=text|code= | ||
# | #23456789 123456789 123456789 123456789 1234567890123456789 123456789 123456789 | ||
# 1 2 3 4 5 6 7 8 | # 1 2 3 4 5 6 7 8 | ||
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 | |||
item2 | |||
}}}} | |||
{{parW| | |||
{{codeTr|lang=cpp|start=300|line=1|width=70|style=border:3px dashed red;|code= | |||
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 | |||
# 1 2 3 4 5 6 7 | |||
#include <time.h> | #include <time.h> | ||
#include <stdio.h> | #include <stdio.h> | ||
Ligne 58 : | Ligne 90 : | ||
int main( int argc, char * argv[] ) | int main( int argc, char * argv[] ) | ||
{ | { | ||
time_t start, stop; time(&start); sleep( 5 ) ; time(&stop); printf("start : %ld\n",start ); printf("stop : %ld\n",stop ); printf("in seconds: %f\n",difftime(stop,start)); | time_t start, stop; time(&start); sleep( 5 ) ; time(&stop); printf("start :%ld\n",start ); printf("stop : %ld\n",stop ); printf("in seconds: %f\n",difftime(stop,start)); | ||
} | } | ||
}} | }} | ||
}} | |||
</noinclude> | </noinclude> |
Version du 13 mars 2021 à 20:12
Version : 1.36.1 1702 (2021-03-13) 20210313201218
Résumé :
Ce modèle sert présenter un code programmation.
{{codeTr|lang=|code=}}
- lang=
- c++ php …
- code=
- le code (text)
- line=1
- start=100
- width
- largeur en nombre de caractères, défaut : 70
- style=border
- 3px dashed blue;
Exemple :
{{parW|{{codeTr|width=75|lang=text|style=border:3px dashed blue;|code= #23456789 123456789 123456789 123456789 1234567890123456789 123456789 12345 # 1 2 3 4 5 6 7 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item2 }}}} {{parW|{{codeTr|line=1|Start=100|width=50|lang=text|code= #23456789 123456789 123456789 123456789 1234567890123456789 123456789 123456789 # 1 2 3 4 5 6 7 8 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item2 }}}} {{parW| {{codeTr|lang=cpp|start=300|line=1|width=70|style=border:3px dashed red;|code= #23456789 123456789 123456789 123456789 1234567890123456789 123456789 # 1 2 3 4 5 6 7 #include <time.h> #include <stdio.h> void sleep( time_t nb_sec ) { time_t limit, top; time(&top); limit = top + nb_sec ; while (top < limit) { time(&top); } }; int main( int argc, char * argv[] ) { time_t start, stop; time(&start); sleep( 5 ) ; time(&stop); printf("start :%ld\n",start ); printf("stop : %ld\n",stop ); printf("in seconds: %f\n",difftime(stop,start)); } }} }}
donnera :
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 12345
# 1 2 3 4 5 6 7
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1
item2
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 123456789
# 1 2 3 4 5 6 7 8
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1
item2
#23456789 123456789 123456789 123456789 1234567890123456789 123456789
# 1 2 3 4 5 6 7
#include <time.h>
#include <stdio.h>
void sleep( time_t nb_sec )
{
time_t limit, top; time(&top); limit = top + nb_sec ;
while (top < limit)
{
time(&top);
}
};
int main( int argc, char * argv[] )
{
time_t start, stop; time(&start); sleep( 5 ) ; time(&stop); printf("start :%ld\n",start ); printf("stop : %ld\n",stop ); printf("in seconds: %f\n",difftime(stop,start));
}