Repository: flex-asjs Updated Branches: refs/heads/tlf 38d7d38a5 -> fcf36f6b9
Fixed RegExp Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/fcf36f6b Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/fcf36f6b Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/fcf36f6b Branch: refs/heads/tlf Commit: fcf36f6b9a8677bcfa463b94c17903f499e5074a Parents: 38d7d38 Author: Harbs <[email protected]> Authored: Fri Jun 30 10:16:59 2017 +0300 Committer: Harbs <[email protected]> Committed: Fri Jun 30 10:16:59 2017 +0300 ---------------------------------------------------------------------- .../conversion/BaseTextLayoutExporter.as | 4 +--- .../conversion/BaseTextLayoutImporter.as | 12 +++-------- .../textLayout/conversion/PlainTextImporter.as | 4 +--- .../conversion/TextFieldHtmlExporter.as | 4 +--- .../conversion/TextFieldHtmlImporter.as | 21 +++++++------------- .../flex/textLayout/elements/SpanElement.as | 10 +++------- 6 files changed, 16 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fcf36f6b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutExporter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutExporter.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutExporter.as index 5437104..f1ebff9 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutExporter.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutExporter.as @@ -212,9 +212,7 @@ package org.apache.flex.textLayout.conversion return output; } -//TODO regex - static private const brRegEx:RegExp = /foo/;// /\u2028/; - // static private const brRegEx:RegExp = /\u2028/; + static private const brRegEx:RegExp = /\u2028/; /** * Gets the regex that specifies characters in span text to be replaced with XML elements. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fcf36f6b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as index 55a3a9b..bf4bfbe 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/BaseTextLayoutImporter.as @@ -57,10 +57,7 @@ package org.apache.flex.textLayout.conversion // static private const anyPrintChar:RegExp = /[^\s]/g; // Consider only tab, line feed, carriage return, and space as characters used for pretty-printing. // While debatable, this is consistent with what CSS does. - static private const anyPrintChar:RegExp = /foo/;// = /[^\u0009\u000a\u000d\u0020]/g; - - // TODO - // static private const anyPrintChar:RegExp = /[^\u0009\u000a\u000d\u0020]/g; + static private const anyPrintChar:RegExp = /[^\u0009\u000a\u000d\u0020]/g; public function BaseTextLayoutImporter(nsValue:Namespace, config:ImportExportConfiguration) { _ns = nsValue; @@ -186,12 +183,9 @@ package org.apache.flex.textLayout.conversion // Remove double spaces, tabs, and newlines. // If I have a sequence of different sorts of spaces (e.g., en quad, hair space), would I want them converted down to one space? Probably not. // For now, u0020 is the only space character we consider for eliminating duplicates, though u00A0 (non-breaking space) is potentially eligible. - // static private const dblSpacePattern:RegExp = /[\u0020]{2,}/g; + static private const dblSpacePattern:RegExp = /[\u0020]{2,}/g; // Tab, line feed, and carriage return - // TODO regex - static private const tabNewLinePattern:RegExp = /foo/g; - - // static private const tabNewLinePattern:RegExp = /[\u0009\u000a\u000d]/g; + static private const tabNewLinePattern:RegExp = /[\u0009\u000a\u000d]/g; protected static function stripWhitespace(insertString:String):String { // Replace the newlines and tabs inside the element with spaces. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fcf36f6b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/PlainTextImporter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/PlainTextImporter.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/PlainTextImporter.as index f3ded70..1cd2d1b 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/PlainTextImporter.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/PlainTextImporter.as @@ -77,9 +77,7 @@ package org.apache.flex.textLayout.conversion { // LF or CR or CR+LF. Equivalently, LF or CR, the latter optionally followed by LF -//TODO regex - private static const _newLineRegex:RegExp = /foo/;// /\u000A|\u000D\u000A?/g; - // private static const _newLineRegex:RegExp = /\u000A|\u000D\u000A?/g; + private static const _newLineRegex:RegExp = /\u000A|\u000D\u000A?/g; /** Import text content, from an external source, and convert it into a ITextFlow. * @param source source data to convert http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fcf36f6b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlExporter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlExporter.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlExporter.as index 2587649..d6f94e3 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlExporter.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlExporter.as @@ -284,9 +284,7 @@ package org.apache.flex.textLayout.conversion } /** @private */ -//TODO regex - static public const brRegEx:RegExp = /foo/; - // static public const brRegEx:RegExp = /\u2028/; + static public const brRegEx:RegExp = /\u2028/; /** Gets the xml element used to represent a character in the export format * @private http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fcf36f6b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlImporter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlImporter.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlImporter.as index 9f67d20..e6eb3f6 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlImporter.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/conversion/TextFieldHtmlImporter.as @@ -1057,9 +1057,8 @@ package org.apache.flex.textLayout.conversion * @private */ /** @private */ - // TODO regex - public static const stripRegex:RegExp = /foo/; - // public static const stripRegex:RegExp = /<!--.*?-->|<\?(".*?"|'.*?'|[^>"']+)*>|<!(".*?"|'.*?'|[^>"']+)*>/sg; + // Multiline in Javascript can not be done using "s". Using "[^]" instead. + public static const stripRegex:RegExp = /<!--[^]*?-->|<\?("[^]*?"|'[^]*?'|[^>"']+)*>|<!("[^]*?"|'[^]*?'|[^>"']+)*>/g; /* Regular expression for an HTML tag * < - open * @@ -1083,16 +1082,13 @@ package org.apache.flex.textLayout.conversion * @private */ /** @private */ - // TODO regex - public static const tagRegex:RegExp = /foo/; - // public static const tagRegex:RegExp = /<(\/?)(\w+)((?:\s+\w+(?:\s*=\s*(?:".*?"|'.*?'|[\w\.]+))?)*)\s*(\/?)>/sg; + // Multiline in Javascript can not be done using "s". Using "[^]" instead. + public static const tagRegex:RegExp = /<(\/?)(\w+)((?:\s+\w+(?:\s*=\s*(?:"[^]*?"|'[^]*?'|[\w\.]+))?)*)\s*(\/?)>/g; /** Regular expression for an attribute. Except for grouping differences, this regex is the same as the one that appears in tagRegex * @private */ - // TODO regex - public static const attrRegex:RegExp = /foo/; - - // public static const attrRegex:RegExp = /\s+(\w+)(?:\s*=\s*(".*?"|'.*?'|[\w\.]+))?/sg; + // Multiline in Javascript can not be done using "s". Using "[^]" instead. + public static const attrRegex:RegExp = /\s+(\w+)(?:\s*=\s*("[^]*?"|'[^]*?'|[\w\.]+))?/g; /** Wrapper for core HTML parsing code that manages XML settings during the process * @private */ @@ -1293,10 +1289,7 @@ package org.apache.flex.textLayout.conversion } /** @private */ - // TODO regex - public static const anyPrintChar:RegExp = /foo/g; - - // public static const anyPrintChar:RegExp = /[^\u0009\u000a\u000d\u0020]/g; + public static const anyPrintChar:RegExp = /[^\u0009\u000a\u000d\u0020]/g; /** Adds text as a descendant of the specified XML element. Adds an intermediate <span> element is created if parent is not a <span> * No action is taken for whitespace-only text * @private http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fcf36f6b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as index 114c496..0862061 100644 --- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as +++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/SpanElement.as @@ -219,17 +219,13 @@ package org.apache.flex.textLayout.elements // For now, u0020 is the only space character we consider for eliminating duplicates, though u00A0 (non-breaking space) is potentially eligible. private static const _dblSpacePattern:RegExp = /[\u0020]{2,}/g; // Tab, line feed, and carriage return -//TODO regex - private static const _newLineTabPattern:RegExp = /foo/g; - // private static const _newLineTabPattern:RegExp = /[\u0009\u000a\u000d]/g; + private static const _newLineTabPattern:RegExp = /[\u0009\u000a\u000d]/g; private static const _tabPlaceholderPattern:RegExp = new RegExp("\\" + "uE000", "g"); - // static private const anyPrintChar:RegExp = /[^\s]/g; + // static private const anyPrintChar:RegExp = /[^\s]/g; // Consider only tab, line feed, carriage return, and space as characters used for pretty-printing. // While debatable, this is consistent with what CSS does. -//TODO regex - static private const anyPrintChar:RegExp = /foo/g; -// static private const anyPrintChar:RegExp = /[^\u0009\u000a\u000d\u0020]/g; + static private const anyPrintChar:RegExp = /[^\u0009\u000a\u000d\u0020]/g; /** @private */ public override function applyWhiteSpaceCollapse(collapse:String):void
