@@ -159,13 +159,13 @@ Blockly.Generator.prototype.prefixLines = function(text, prefix) {
159159 var splitted = text . split ( '\n' ) ;
160160 if ( splitted . length == 1 ) return prefix + text ;
161161 var indented = splitted . map ( function ( line ) {
162- console . log ( line ) ;
163- if ( line . indexOf ( ' Alors' ) == 0 ) return "\n" + line ;
164- if ( line . indexOf ( ' Sinon' ) == 0 ) return "\n" + line ;
165- if ( line . indexOf ( ')' ) == 0 ) return "\n" + line ;
162+ // Désactivation de l’indentation.
163+ if ( line . indexOf ( ' Alors' ) == 0 ) return line ;
164+ if ( line . indexOf ( ' Sinon' ) == 0 ) return line ;
165+ if ( line . indexOf ( ')' ) == 0 ) return line ;
166166 return prefix + line ;
167167 } ) ;
168- return indented . join ( '' ) ;
168+ return indented . join ( '\n ' ) ;
169169} ;
170170
171171// Blocs et générateurs (groupés, pas comme dans l’original).
@@ -591,13 +591,13 @@ Blockly.Blocks['si_alors_sinon_sinon'] = {
591591Blockly . MicroAlg [ 'si' ] = function ( block ) {
592592 var cond = Blockly . MicroAlg . statementToCode ( block , 'COND' ) || '' ;
593593 var branch = Blockly . MicroAlg . statementToCode ( block , 'ALORS' ) || '' ;
594- branch = branch . replace ( / \) \( / gm, ')\n(' ) ;
594+ branch = branch . replace ( / \) \( / gm, ')\n' + Blockly . MicroAlg . INDENT + ' (') ;
595595 var code = '(Si ' + cond . substring ( Blockly . MicroAlg . INDENT . length ) +
596- '\n Alors\n' + Blockly . Generator . prototype . prefixLines ( branch , Blockly . MicroAlg . INDENT ) ;
596+ '\n Alors\n' + branch ;
597597 if ( block . elseCount_ ) {
598598 branch = Blockly . MicroAlg . statementToCode ( block , 'SINON' ) || '' ;
599- branch = branch . replace ( / \) \( / gm, ')\n(' ) ;
600- code += '\n Sinon\n' + Blockly . Generator . prototype . prefixLines ( branch , Blockly . MicroAlg . INDENT ) ;
599+ branch = branch . replace ( / \) \( / gm, ')\n' + Blockly . MicroAlg . INDENT + ' (') ;
600+ code += '\n Sinon\n' + branch ;
601601 }
602602 code += '\n)'
603603 return code ;
0 commit comments