Index: trunk/extensions/Translate/scripts/pagetranslation-test-parser.php |
— | — | @@ -42,12 +42,12 @@ |
43 | 43 | $parse = $translatablePage->getParse(); |
44 | 44 | if ( $failureExpected ) { |
45 | 45 | $target = $parse->getTranslationPageText( new TestMessageCollection( "foo" ) ); |
46 | | - $this->output( "Testfile $filename should have failed... see $pattern.pttarget.fail" ); |
| 46 | + $this->output( "Testfile $filename should have failed... see $pattern.pttarget.fail\n" ); |
47 | 47 | file_put_contents( "$pattern.pttarget.fail", $target ); |
48 | 48 | } |
49 | 49 | } catch ( TPException $e ) { |
50 | 50 | if ( !$failureExpected ) { |
51 | | - $this->output( "Testfile $filename failed to parse... see $pattern.ptfile.fail" ); |
| 51 | + $this->output( "Testfile $filename failed to parse... see $pattern.ptfile.fail\n" ); |
52 | 52 | file_put_contents( "$pattern.ptfile.fail", $e->getMessage() ); |
53 | 53 | } |
54 | 54 | continue; |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | if ( file_exists( "$pattern.ptsource" ) ) { |
58 | 58 | $source = $parse->getSourcePageText(); |
59 | 59 | if ( $source !== file_get_contents( "$pattern.ptsource" ) ) { |
60 | | - $this->output( "Testfile $filename failed with source page output... writing $pattern.ptsource.fail" ); |
| 60 | + $this->output( "Testfile $filename failed with source page output... writing $pattern.ptsource.fail\n" ); |
61 | 61 | file_put_contents( "$pattern.ptsource.fail", $source ); |
62 | 62 | } |
63 | 63 | } |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | if ( file_exists( "$pattern.pttarget" ) ) { |
66 | 66 | $target = $parse->getTranslationPageText( new TestMessageCollection( "foo" ) ); |
67 | 67 | if ( $target !== file_get_contents( "$pattern.pttarget" ) ) { |
68 | | - $this->output( "Testfile $filename failed with target page output... writing $pattern.pttarget.fail" ); |
| 68 | + $this->output( "Testfile $filename failed with target page output... writing $pattern.pttarget.fail\n" ); |
69 | 69 | file_put_contents( "$pattern.pttarget.fail", $target ); |
70 | 70 | } |
71 | 71 | } |
Index: trunk/extensions/Translate/tests/pagetranslation/LoneHeader.ptfile |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +<translate> |
| 3 | +== One == |
| 4 | + |
| 5 | +A cat sleeps. |
| 6 | +</translate> |
Index: trunk/extensions/Translate/tests/pagetranslation/LoneHeader.ptsource |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +<translate> |
| 3 | +== One == <!--T:-1--> |
| 4 | + |
| 5 | +<!--T:-1--> |
| 6 | +A cat sleeps. |
| 7 | +</translate> |
Index: trunk/extensions/Translate/tag/TPParse.php |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | |
159 | 159 | // Remove translation markup |
160 | 160 | $cb = array( __CLASS__, 'replaceTagCb' ); |
161 | | - $text = preg_replace_callback( '~(<translate>\n?)(.*)(</translate>\n?)~sU', $cb, $text ); |
| 161 | + $text = preg_replace_callback( '~(<translate>\n??)(.*)(\n??</translate>)~sU', $cb, $text ); |
162 | 162 | $text = TranslatablePage::unArmourNowiki( $nph, $text ); |
163 | 163 | |
164 | 164 | return $text; |
Index: trunk/extensions/Translate/tag/TPSection.php |
— | — | @@ -22,8 +22,8 @@ |
23 | 23 | public function getMarkedText() { |
24 | 24 | $id = isset( $this->name ) ? $this->name : $this->id; |
25 | 25 | $header = "<!--T:{$id}-->"; |
26 | | - $re = '~^(=+.*?=+\s*?)\n~'; |
27 | | - $rep = "\\1 $header\n"; |
| 26 | + $re = '~^(=+.*?=+\s*?$)~m'; |
| 27 | + $rep = "\\1 $header"; |
28 | 28 | $count = 0; |
29 | 29 | |
30 | 30 | $text = preg_replace( $re, $rep, $this->text, 1, $count ); |