|
Informatique, Hardware ,Software, Education, Echecs etc...
|
Rechercher
| Voir le sujet précédent :: Voir le sujet suivant |
| Auteur |
Message |
wouf Administrateur MI 16


Inscrit le: 14 Mai 2005 Messages: 3948 Localisation: ça dépend, mais pas loin de l'écran.
|
Posté le: Dim Mai 20, 2007 6:12 pm Sujet du message: BBcode pour écriture mathématique |
|
|
Je suis en train de pondre des BBCodes, pour créer des expressions simples mathématiques dans un forum mathématique de type PHPbb2.
En phase de développement pour l'instant, mon travail sera à terme sous licence libre.
\20 =\4x5=\4x\5=2x\5=2\5 _________________
Mon univers
|
|
| Revenir en haut de page |
|
 |
wouf Administrateur MI 16


Inscrit le: 14 Mai 2005 Messages: 3948 Localisation: ça dépend, mais pas loin de l'écran.
|
Posté le: Dim Mai 20, 2007 6:23 pm Sujet du message: |
|
|
(\3)2=\32=3 _________________
Mon univers
|
|
| Revenir en haut de page |
|
 |
wouf Administrateur MI 16


Inscrit le: 14 Mai 2005 Messages: 3948 Localisation: ça dépend, mais pas loin de l'écran.
|
Posté le: Lun Mai 21, 2007 6:41 pm Sujet du message: |
|
|
Les changement dans le code à titre indicatif.
posting.php
vers la ligne 1176
| Code: | 'L_BBCODE_R_HELP' => $lang['bbcode_r_help'],
'L_BBCODE_M_HELP' => $lang['bbcode_m_help'], |
include/bbcode.php
A la fin:
| Code: | function bbencode_second_pass_math($text, $uid, $bbcode_tpl)
{
global $lang;
$math_start_html = $bbcode_tpl['math_open'];
$math_end_html = $bbcode_tpl['math_close'];
$match_count = preg_match_all("#\[math:1:$uid\](.*?)\[/math:1:$uid\]#si", $text, $matches);
for ($i = 0; $i < $match_count; $i++)
{
$before_replace = $matches[1][$i];
$after_replace = $matches[1][$i];
$after_replace = str_replace("==", '≈', $after_replace); // environ
$after_replace = str_replace("<=", '≤', $after_replace); //inf
$after_replace = str_replace(">=", '≥', $after_replace); //sup
$after_replace = str_replace("<>", '≠', $after_replace); //diff
$after_replace = str_replace("*", '×', $after_replace); //fois
//$after_replace = ereg_replace("rac{(.^}+)}","racine", $after_replace);
$str_to_match = "[math:1:$uid]" . $before_replace . "[/math:1:$uid]";
$replacement = $diag_start_html;
$replacement .= $after_replace;
$replacement .= $diag_end_html;
$text = str_replace($str_to_match, $replacement, $text);
}
$text = str_replace("[math:$uid]", $diag_start_html, $text);
$text = str_replace("[/math:$uid]", $diag_end_html, $text);
return $text;}
|
Vers la ligne 100:
| Code: | $bbcode_tpl['rac_open'] = str_replace('{L_rac}', $lang['rac'], $bbcode_tpl['rac_open']);
$bbcode_tpl['math_open'] = str_replace('{L_math}', $lang['math'], $bbcode_tpl['math_open']); |
template/subsilver/bbcode.tpl
Vers ligne 50:
| Code: | <!-- BEGIN rac_open -->\<span style="border-top: 1px solid; border-left: 1px solid;"><!-- END rac_open -->
<!-- BEGIN rac_close --></span><!-- END rac_close -->
<!-- BEGIN math_open --><!-- END math_open --><!-- BEGIN math_close --><!-- END math_close -->
|
postin_body.tpl
| Code: |
<td><span class="genmed">
<input>
</span></td>
<td><span class="genmed">
<input>
</span></td></tr>
<tr>
<td colspan="9">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="genmed"> {L_FONT_COLOR}:
<select>
<option>{L_COLOR_DEFAULT}</option>
<option>{L_COLOR_DARK_RED}</option>
<option>{L_COLOR_RED}</option>
<option>{L_COLOR_ORANGE}</option>
<option>{L_COLOR_BROWN}</option>
<option>{L_COLOR_YELLOW}</option>
<option>{L_COLOR_GREEN}</option>
<option>{L_COLOR_OLIVE}</option>
<option>{L_COLOR_CYAN}</option>
<option>{L_COLOR_BLUE}</option>
<option>{L_COLOR_DARK_BLUE}</option>
<option>{L_COLOR_INDIGO}</option>
<option>{L_COLOR_VIOLET}</option>
<option>{L_COLOR_WHITE}</option>
<option>{L_COLOR_BLACK}</option>
</select> {L_FONT_SIZE}:<select>
<option>{L_FONT_SIZE}</option>
<option>{L_FONT_TINY}</option>
<option>{L_FONT_SMALL}</option>
<option>{L_FONT_NORMAL}</option>
<option>{L_FONT_LARGE}</option>
<option>{L_FONT_HUGE}</option>
</select> |
language/lang_main.php
lign 390
| Code: | $lang['bbcode_r_help'] = 'Insérer une racine carrée';
$lang['bbcode_m_help'] = 'Insérer une expression mathématique'; |
lang_bbcode.php
ligne 72
| Code: |
$faq[]= array("--","BBcode math");
$faq[] = array("Ils servent à appliquer un style mathématique à des expressions"); |
_________________
Mon univers
Dernière édition par wouf le Mar Oct 09, 2007 9:47 pm; édité 1 fois |
|
| Revenir en haut de page |
|
 |
wouf Administrateur MI 16


Inscrit le: 14 Mai 2005 Messages: 3948 Localisation: ça dépend, mais pas loin de l'écran.
|
Posté le: Sam Sep 15, 2007 10:10 am Sujet du message: Formule de Stirling |
|
|
Formule de Stirling
n!≈\2πn(n/e)n
| Code: | [math]n!==V{2pin}(n/e)<sup>n</sup>[/math]
|
_________________
Mon univers
|
|
| Revenir en haut de page |
|
 |
wouf Administrateur MI 16


Inscrit le: 14 Mai 2005 Messages: 3948 Localisation: ça dépend, mais pas loin de l'écran.
|
Posté le: Ven Oct 12, 2007 2:40 pm Sujet du message: |
|
|
Fractions :
| Code: | | [math]f{1;2}+f{3;4} = f{2;4}+f{3;4} = f{5;4}[/math] |
1 / 2 + 3 / 4 = 2 / 4 + 3 / 4 = 5 / 4 _________________
Mon univers
|
|
| Revenir en haut de page |
|
 |
wouf Administrateur MI 16


Inscrit le: 14 Mai 2005 Messages: 3948 Localisation: ça dépend, mais pas loin de l'écran.
|
Posté le: Ven Oct 12, 2007 2:42 pm Sujet du message: |
|
|
La fonction mise à jour pour les développeurs php:
| Code: | function bbencode_second_pass_math($text, $uid, $bbcode_tpl)
{
global $lang;
$math_start_html = $bbcode_tpl['math_open'];
$math_end_html = $bbcode_tpl['math_close'];
$match_count = preg_match_all("#\[math:1:$uid\](.*?)\[/math:1:$uid\]#si", $text, $matches);
for ($i = 0; $i < $match_count; $i++)
{
$before_replace = $matches[1][$i];
$after_replace = $matches[1][$i];
$after_replace = str_replace("pi", '<span style="font-family: cursive;">π</span>', $after_replace); // pi
$after_replace = str_replace("==", '≈', $after_replace); // environ
$after_replace = str_replace("<=", '≤', $after_replace); //inf
$after_replace = str_replace(">=", '≥', $after_replace); //sup
$after_replace = str_replace("<>", '≠', $after_replace); //diff
$after_replace = str_replace("*", '×', $after_replace); //fois
$after_replace = str_replace("alpha", 'α', $after_replace);
$after_replace = str_replace("phi", 'φ', $after_replace);
$after_replace = ereg_replace("V\{([^}]+)}","\<span style=\"border-top: 1px solid; border-left: 1px solid;\">\\1</span>", $after_replace);
$after_replace = ereg_replace("p\{([^}]+)}","<sup><span style=\"font-size:80%\">\\1</span></sup>", $after_replace);
$after_replace = ereg_replace("S2\{([^}]+)}","<table><tr><td><span style=\"font-size:240%\">{</span></td><td>\\1</td></tr></table>", $after_replace);
$after_replace = ereg_replace("f\{([^;]+);([^}]+)}"," <sup>\\1</sup> / <sub>\\2</sub> ", $after_replace);
$str_to_match = "[math:1:$uid]" . $before_replace . "[/math:1:$uid]";
$replacement = $diag_start_html;
$replacement .= $after_replace;
$replacement .= $diag_end_html;
$text = str_replace($str_to_match, $replacement, $text);
}
$text = str_replace("[math:$uid]", $diag_start_html, $text);
$text = str_replace("[/math:$uid]", $diag_end_html, $text);
return $text;} |
_________________
Mon univers
|
|
| Revenir en haut de page |
|
 |
|
|
Vous pouvez poster de nouveaux sujets dans ce forum Vous pouvez répondre aux sujets dans ce forum Vous ne pouvez pas éditer vos messages dans ce forum Vous ne pouvez pas supprimer vos messages dans ce forum Vous ne pouvez pas voter dans les sondages de ce forum
|
Merci de votre visite sur Wouf Forum!
phpBB SEO
Powered by phpBB © 2001, 2005 phpBB Group Traduction par : phpBB-fr.com
|