Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: pkg/intl/lib/bidi_utils.dart

Issue 143453011: pkg/intl: dartfmt (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/intl/lib/bidi_formatter.dart ('k') | pkg/intl/lib/date_time_patterns.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of intl; 5 part of intl;
6 6
7 /** 7 /**
8 * Bidi stands for Bi-directional text. 8 * Bidi stands for Bi-directional text.
9 * According to http://en.wikipedia.org/wiki/Bi-directional_text: 9 * According to http://en.wikipedia.org/wiki/Bi-directional_text:
10 * Bi-directional text is text containing text in both text directionalities, 10 * Bi-directional text is text containing text in both text directionalities,
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 // Start at 1 because we're looking for the patterns [\u0591-\u05f2])" or 356 // Start at 1 because we're looking for the patterns [\u0591-\u05f2])" or
357 // [\u0591-\u05f2]'. 357 // [\u0591-\u05f2]'.
358 for (int i = 1; i < str.length; i++) { 358 for (int i = 1; i < str.length; i++) {
359 if (str.substring(i, i+1) == '"' 359 if (str.substring(i, i+1) == '"'
360 && new RegExp('[\u0591-\u05f2]').hasMatch(str.substring(i-1, i))) { 360 && new RegExp('[\u0591-\u05f2]').hasMatch(str.substring(i-1, i))) {
361 buf.write('\u05f4'); 361 buf.write('\u05f4');
362 } else if (str.substring(i, i+1) == "'" 362 } else if (str.substring(i, i+1) == "'"
363 && new RegExp('[\u0591-\u05f2]').hasMatch(str.substring(i-1, i))) { 363 && new RegExp('[\u0591-\u05f2]').hasMatch(str.substring(i-1, i))) {
364 buf.write('\u05f3'); 364 buf.write('\u05f3');
365 } else { 365 } else {
366 buf.write(str.substring(i, i+1)); 366 buf.write(str.substring(i, i + 1));
367 } 367 }
368 } 368 }
369 return buf.toString(); 369 return buf.toString();
370 } 370 }
371 371
372 /** 372 /**
373 * Check the estimated directionality of [str], return true if the piece of 373 * Check the estimated directionality of [str], return true if the piece of
374 * text should be laid out in RTL direction. If [isHtml] is true, the string 374 * text should be laid out in RTL direction. If [isHtml] is true, the string
375 * is HTML or HTML-escaped. 375 * is HTML or HTML-escaped.
376 */ 376 */
377 static bool detectRtlDirectionality(String str, {bool isHtml: false}) => 377 static bool detectRtlDirectionality(String str, {bool isHtml: false}) =>
378 estimateDirectionOfText(str, isHtml: isHtml) == TextDirection.RTL; 378 estimateDirectionOfText(str, isHtml: isHtml) == TextDirection.RTL;
379 } 379 }
OLDNEW
« no previous file with comments | « pkg/intl/lib/bidi_formatter.dart ('k') | pkg/intl/lib/date_time_patterns.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698