Completed
Push — master ( 28eca9...4c6c1b )
by cam
04:41
created
ecrire/public/format_html.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -11,126 +11,126 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 function format_boucle_html($preaff, $avant, $nom, $type, $crit, $corps, $apres, $altern, $postaff, $prof) {
18
-	$preaff = $preaff ? "<BB$nom>$preaff" : "";
19
-	$avant = $avant ? "<B$nom>$avant" : "";
20
-	$apres = $apres ? "$apres</B$nom>" : "";
21
-	$altern = $altern ? "$altern<//B$nom>" : "";
22
-	$postaff = $postaff ? "$postaff</BB$nom>" : "";
23
-	if (!$corps) {
24
-		$corps = " />";
25
-	} else {
26
-		$corps = ">$corps</BOUCLE$nom>";
27
-	}
28
-
29
-	return "$preaff$avant<BOUCLE$nom($type)$crit$corps$apres$altern$postaff";
18
+    $preaff = $preaff ? "<BB$nom>$preaff" : "";
19
+    $avant = $avant ? "<B$nom>$avant" : "";
20
+    $apres = $apres ? "$apres</B$nom>" : "";
21
+    $altern = $altern ? "$altern<//B$nom>" : "";
22
+    $postaff = $postaff ? "$postaff</BB$nom>" : "";
23
+    if (!$corps) {
24
+        $corps = " />";
25
+    } else {
26
+        $corps = ">$corps</BOUCLE$nom>";
27
+    }
28
+
29
+    return "$preaff$avant<BOUCLE$nom($type)$crit$corps$apres$altern$postaff";
30 30
 }
31 31
 
32 32
 function format_inclure_html($file, $args, $prof) {
33
-	if (strpos($file, '#') === false) {
34
-		$t = $file ? ("(" . $file . ")") : "";
35
-	} else {
36
-		$t = "{fond=" . $file . '}';
37
-	}
38
-	$args = !$args ? '' : ("{" . join(", ", $args) . "}");
39
-
40
-	return ("<INCLURE" . $t . $args . ">");
33
+    if (strpos($file, '#') === false) {
34
+        $t = $file ? ("(" . $file . ")") : "";
35
+    } else {
36
+        $t = "{fond=" . $file . '}';
37
+    }
38
+    $args = !$args ? '' : ("{" . join(", ", $args) . "}");
39
+
40
+    return ("<INCLURE" . $t . $args . ">");
41 41
 }
42 42
 
43 43
 function format_polyglotte_html($args, $prof) {
44
-	$contenu = array();
45
-	foreach ($args as $l => $t) {
46
-		$contenu[] = ($l ? "[$l]" : '') . $t;
47
-	}
44
+    $contenu = array();
45
+    foreach ($args as $l => $t) {
46
+        $contenu[] = ($l ? "[$l]" : '') . $t;
47
+    }
48 48
 
49
-	return ("<multi>" . join(" ", $contenu) . "</multi>");
49
+    return ("<multi>" . join(" ", $contenu) . "</multi>");
50 50
 }
51 51
 
52 52
 function format_idiome_html($nom, $module, $args, $filtres, $prof) {
53
-	foreach ($args as $k => $v) {
54
-		$args[$k] = "$k=$v";
55
-	}
56
-	$args = (!$args ? '' : ('{' . join(',', $args) . '}'));
53
+    foreach ($args as $k => $v) {
54
+        $args[$k] = "$k=$v";
55
+    }
56
+    $args = (!$args ? '' : ('{' . join(',', $args) . '}'));
57 57
 
58
-	return ("<:" . ($module ? "$module:" : "") . $nom . $args . $filtres . ":>");
58
+    return ("<:" . ($module ? "$module:" : "") . $nom . $args . $filtres . ":>");
59 59
 }
60 60
 
61 61
 function format_champ_html($nom, $boucle, $etoile, $avant, $apres, $args, $filtres, $prof) {
62
-	$nom = "#"
63
-		. ($boucle ? ($boucle . ":") : "")
64
-		. $nom
65
-		. $etoile
66
-		. $args
67
-		. $filtres;
62
+    $nom = "#"
63
+        . ($boucle ? ($boucle . ":") : "")
64
+        . $nom
65
+        . $etoile
66
+        . $args
67
+        . $filtres;
68 68
 
69
-	// Determiner si c'est un champ etendu, 
69
+    // Determiner si c'est un champ etendu, 
70 70
 
71
-	$s = ($avant or $apres or $filtres
72
-		or (strpos($args, '(#') !== false));
71
+    $s = ($avant or $apres or $filtres
72
+        or (strpos($args, '(#') !== false));
73 73
 
74
-	return ($s ? "[$avant($nom)$apres]" : $nom);
74
+    return ($s ? "[$avant($nom)$apres]" : $nom);
75 75
 }
76 76
 
77 77
 function format_critere_html($critere) {
78
-	foreach ($critere as $k => $crit) {
79
-		$crit_s = '';
80
-		foreach ($crit as $operande) {
81
-			list($type, $valeur) = $operande;
82
-			if ($type == 'champ' and $valeur[0] == '[') {
83
-				$valeur = substr($valeur, 1, -1);
84
-				if (preg_match(',^[(](#[^|]*)[)]$,sS', $valeur)) {
85
-					$valeur = substr($valeur, 1, -1);
86
-				}
87
-			}
88
-			$crit_s .= $valeur;
89
-		}
90
-		$critere[$k] = $crit_s;
91
-	}
92
-
93
-	return (!$critere ? "" : ("{" . join(",", $critere) . "}"));
78
+    foreach ($critere as $k => $crit) {
79
+        $crit_s = '';
80
+        foreach ($crit as $operande) {
81
+            list($type, $valeur) = $operande;
82
+            if ($type == 'champ' and $valeur[0] == '[') {
83
+                $valeur = substr($valeur, 1, -1);
84
+                if (preg_match(',^[(](#[^|]*)[)]$,sS', $valeur)) {
85
+                    $valeur = substr($valeur, 1, -1);
86
+                }
87
+            }
88
+            $crit_s .= $valeur;
89
+        }
90
+        $critere[$k] = $crit_s;
91
+    }
92
+
93
+    return (!$critere ? "" : ("{" . join(",", $critere) . "}"));
94 94
 }
95 95
 
96 96
 function format_liste_html($fonc, $args, $prof) {
97
-	return ((($fonc !== '') ? "|$fonc" : $fonc)
98
-		. (!$args ? "" : ("{" . join(",", $args) . "}")));
97
+    return ((($fonc !== '') ? "|$fonc" : $fonc)
98
+        . (!$args ? "" : ("{" . join(",", $args) . "}")));
99 99
 }
100 100
 
101 101
 // Concatenation sans separateur: verifier qu'on ne cree pas de faux lexemes
102 102
 function format_suite_html($args) {
103
-	for ($i = 0; $i < count($args) - 1; $i++) {
104
-		list($texte, $type) = $args[$i];
105
-		list($texte2, $type2) = $args[$i + 1];
106
-		if (!$texte or !$texte2) {
107
-			continue;
108
-		}
109
-		$c1 = substr($texte, -1);
110
-		if ($type2 !== 'texte') {
111
-			// si un texte se termine par ( et est suivi d'un champ
112
-			// ou assimiles, forcer la notation pleine
113
-			if ($c1 == '(' and substr($texte2, 0, 1) == '#') {
114
-				$args[$i + 1][0] = '[(' . $texte2 . ')]';
115
-			}
116
-		} else {
117
-			if ($type == 'texte') {
118
-				continue;
119
-			}
120
-			// si un champ ou assimiles est suivi d'un texte
121
-			// et si celui-ci commence par un caractere de champ
122
-			// forcer la notation pleine
123
-			if (($c1 == '}' and substr(ltrim($texte2), 0, 1) == '|')
124
-				or (preg_match('/[\w\d_*]/', $c1) and preg_match('/^[\w\d_*{|]/', $texte2))
125
-			) {
126
-				$args[$i][0] = '[(' . $texte . ')]';
127
-			}
128
-		}
129
-	}
130
-
131
-	return join("", array_map(function($arg) { return reset($arg); }, $args));
103
+    for ($i = 0; $i < count($args) - 1; $i++) {
104
+        list($texte, $type) = $args[$i];
105
+        list($texte2, $type2) = $args[$i + 1];
106
+        if (!$texte or !$texte2) {
107
+            continue;
108
+        }
109
+        $c1 = substr($texte, -1);
110
+        if ($type2 !== 'texte') {
111
+            // si un texte se termine par ( et est suivi d'un champ
112
+            // ou assimiles, forcer la notation pleine
113
+            if ($c1 == '(' and substr($texte2, 0, 1) == '#') {
114
+                $args[$i + 1][0] = '[(' . $texte2 . ')]';
115
+            }
116
+        } else {
117
+            if ($type == 'texte') {
118
+                continue;
119
+            }
120
+            // si un champ ou assimiles est suivi d'un texte
121
+            // et si celui-ci commence par un caractere de champ
122
+            // forcer la notation pleine
123
+            if (($c1 == '}' and substr(ltrim($texte2), 0, 1) == '|')
124
+                or (preg_match('/[\w\d_*]/', $c1) and preg_match('/^[\w\d_*{|]/', $texte2))
125
+            ) {
126
+                $args[$i][0] = '[(' . $texte . ')]';
127
+            }
128
+        }
129
+    }
130
+
131
+    return join("", array_map(function($arg) { return reset($arg); }, $args));
132 132
 }
133 133
 
134 134
 function format_texte_html($texte) {
135
-	return $texte;
135
+    return $texte;
136 136
 }
Please login to merge, or discard this patch.