Skip to content

Commit f74d942

Browse files
committed
update flutter 0.8.2
fix flutter html regexp error
1 parent 5f7ae3f commit f74d942

3 files changed

Lines changed: 72 additions & 41 deletions

File tree

‎ios/Runner.xcodeproj/project.pbxproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@
459459
inputPaths = (
460460
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
461461
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
462-
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
462+
"${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
463463
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
464464
"${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework",
465465
"${BUILT_PRODUCTS_DIR}/device_info/device_info.framework",

‎lib/common/utils/HtmlUtils.dart‎

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,57 @@ class HtmlUtils {
1717
if (mdData == null) {
1818
return "";
1919
}
20-
RegExp exp = new RegExp("<code(([\\s\\S])*?)<\/code>");
21-
Iterable<Match> tags = exp.allMatches(mdData);
2220
String mdDataCode = mdData;
23-
for (Match m in tags) {
24-
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
25-
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
26-
}
21+
String regExCode = "<[\\s]*?code[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?code[\\s]*?>";
22+
String regExPre = "<[\\s]*?pre[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?pre[\\s]*?>";
23+
2724

28-
exp = new RegExp("<pre(([\\s\\S])*?)<\/pre>");
29-
tags = exp.allMatches(mdDataCode);
30-
for (Match m in tags) {
31-
if (m.group(0).indexOf("<code>") < 0) {
25+
try {
26+
RegExp exp = new RegExp(regExCode);
27+
Iterable<Match> tags = exp.allMatches(mdData);
28+
for (Match m in tags) {
3229
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
3330
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
3431
}
32+
} catch (e) {
33+
print(e);
3534
}
36-
37-
exp = new RegExp("<pre>(([\\s\\S])*?)<\/pre>");
38-
tags = exp.allMatches(mdDataCode);
39-
for (Match m in tags) {
40-
if (m.group(0).indexOf("<code>") < 0) {
41-
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
42-
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
35+
try {
36+
RegExp exp = new RegExp(regExPre);
37+
Iterable<Match> tags = exp.allMatches(mdDataCode);
38+
for (Match m in tags) {
39+
if (m.group(0).indexOf("<code>") < 0) {
40+
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
41+
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
42+
}
4343
}
44+
} catch (e) {
45+
print(e);
4446
}
4547

46-
exp = new RegExp("href=\"(.*?)\"");
47-
tags = exp.allMatches(mdDataCode);
48-
for (Match m in tags) {
49-
String capture = m.group(0);
50-
if (capture.indexOf("http://") < 0 && capture.indexOf("https://") < 0 && capture.indexOf("#") != 0) {
51-
mdDataCode = mdDataCode.replaceAll(m.group(0), "gsygithub://" + capture);
48+
try {
49+
RegExp exp = new RegExp("<pre>(([\\s\\S])*?)<\/pre>");
50+
Iterable<Match> tags = exp.allMatches(mdDataCode);
51+
for (Match m in tags) {
52+
if (m.group(0).indexOf("<code>") < 0) {
53+
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
54+
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
55+
}
5256
}
57+
} catch (e) {
58+
print(e);
59+
}
60+
try {
61+
RegExp exp = new RegExp("href=\"(.*?)\"");
62+
Iterable<Match> tags = exp.allMatches(mdDataCode);
63+
for (Match m in tags) {
64+
String capture = m.group(0);
65+
if (capture.indexOf("http://") < 0 && capture.indexOf("https://") < 0 && capture.indexOf("#") != 0) {
66+
mdDataCode = mdDataCode.replaceAll(m.group(0), "gsygithub://" + capture);
67+
}
68+
}
69+
} catch (e) {
70+
print(e);
5371
}
5472

5573
return generateCodeHtml(mdDataCode, false, backgroundColor: backgroundColor, actionColor: GSYColors.actionBlueString, userBR: userBR);
@@ -203,7 +221,6 @@ class HtmlUtils {
203221
return builder;
204222
}
205223

206-
207224
static resolveHtmlFile(var res, String defaultLang) {
208225
if (res != null && res.result) {
209226
String startTag = "class=\"instapaper_body ";

‎pubspec.lock‎

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ packages:
1414
name: analyzer
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "0.32.4"
17+
version: "0.32.5"
1818
args:
1919
dependency: transitive
2020
description:
@@ -56,28 +56,28 @@ packages:
5656
name: build_runner
5757
url: "https://pub.dartlang.org"
5858
source: hosted
59-
version: "0.10.1+1"
59+
version: "0.10.2"
6060
build_runner_core:
6161
dependency: transitive
6262
description:
6363
name: build_runner_core
6464
url: "https://pub.dartlang.org"
6565
source: hosted
66-
version: "0.3.1+4"
66+
version: "0.3.1+5"
6767
built_collection:
6868
dependency: transitive
6969
description:
7070
name: built_collection
7171
url: "https://pub.dartlang.org"
7272
source: hosted
73-
version: "3.1.3"
73+
version: "4.0.0"
7474
built_value:
7575
dependency: transitive
7676
description:
7777
name: built_value
7878
url: "https://pub.dartlang.org"
7979
source: hosted
80-
version: "5.5.5"
80+
version: "6.1.3"
8181
charcode:
8282
dependency: transitive
8383
description:
@@ -98,7 +98,7 @@ packages:
9898
name: code_builder
9999
url: "https://pub.dartlang.org"
100100
source: hosted
101-
version: "3.1.2"
101+
version: "3.1.3"
102102
collection:
103103
dependency: transitive
104104
description:
@@ -168,7 +168,7 @@ packages:
168168
name: dio
169169
url: "https://pub.dartlang.org"
170170
source: hosted
171-
version: "1.0.1"
171+
version: "1.0.4"
172172
event_bus:
173173
dependency: "direct main"
174174
description:
@@ -213,14 +213,14 @@ packages:
213213
name: flutter_slidable
214214
url: "https://pub.dartlang.org"
215215
source: hosted
216-
version: "0.4.3"
216+
version: "0.4.6"
217217
flutter_spinkit:
218218
dependency: "direct main"
219219
description:
220220
name: flutter_spinkit
221221
url: "https://pub.dartlang.org"
222222
source: hosted
223-
version: "2.0.1"
223+
version: "2.1.0"
224224
flutter_statusbar:
225225
dependency: "direct main"
226226
description:
@@ -255,14 +255,14 @@ packages:
255255
name: front_end
256256
url: "https://pub.dartlang.org"
257257
source: hosted
258-
version: "0.1.4"
258+
version: "0.1.4+1"
259259
get_version:
260260
dependency: "direct main"
261261
description:
262262
name: get_version
263263
url: "https://pub.dartlang.org"
264264
source: hosted
265-
version: "0.0.5"
265+
version: "0.0.6"
266266
glob:
267267
dependency: transitive
268268
description:
@@ -312,6 +312,13 @@ packages:
312312
url: "https://pub.dartlang.org"
313313
source: hosted
314314
version: "0.3.3"
315+
js:
316+
dependency: transitive
317+
description:
318+
name: js
319+
url: "https://pub.dartlang.org"
320+
source: hosted
321+
version: "0.6.1+1"
315322
json_annotation:
316323
dependency: "direct main"
317324
description:
@@ -325,14 +332,14 @@ packages:
325332
name: json_serializable
326333
url: "https://pub.dartlang.org"
327334
source: hosted
328-
version: "1.1.0"
335+
version: "1.2.1"
329336
kernel:
330337
dependency: transitive
331338
description:
332339
name: kernel
333340
url: "https://pub.dartlang.org"
334341
source: hosted
335-
version: "0.3.4"
342+
version: "0.3.4+1"
336343
logging:
337344
dependency: transitive
338345
description:
@@ -403,6 +410,13 @@ packages:
403410
url: "https://pub.dartlang.org"
404411
source: hosted
405412
version: "0.1.2"
413+
pedantic:
414+
dependency: transitive
415+
description:
416+
name: pedantic
417+
url: "https://pub.dartlang.org"
418+
source: hosted
419+
version: "1.1.0"
406420
petitparser:
407421
dependency: transitive
408422
description:
@@ -498,7 +512,7 @@ packages:
498512
name: source_gen
499513
url: "https://pub.dartlang.org"
500514
source: hosted
501-
version: "0.9.0+1"
515+
version: "0.9.1"
502516
source_span:
503517
dependency: transitive
504518
description:
@@ -512,7 +526,7 @@ packages:
512526
name: sqflite
513527
url: "https://pub.dartlang.org"
514528
source: hosted
515-
version: "0.11.1"
529+
version: "0.11.2+4"
516530
stack_trace:
517531
dependency: transitive
518532
description:
@@ -547,7 +561,7 @@ packages:
547561
name: synchronized
548562
url: "https://pub.dartlang.org"
549563
source: hosted
550-
version: "1.5.1+1"
564+
version: "1.5.2"
551565
typed_data:
552566
dependency: transitive
553567
description:

0 commit comments

Comments
 (0)