Skip to content

Commit 28dded2

Browse files
authored
Code excerpts: distribute site-global replace pattern to individual files (#1908)
No site content changes. Prep work so that we can actually show code excerpts using analyzer ignore directives. Contributes to #1803
1 parent a859882 commit 28dded2

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

src/_guides/language/language-tour.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: A tour of the Dart language
33
description: A tour of all of the major Dart language features.
44
short-title: Language tour
55
---
6-
<?code-excerpt replace="/([A-Z]\w*)\d\b/$1/g"?>
6+
<?code-excerpt replace="/ *\/\/\s+ignore_for_file:[^\n]+\n//g; / *\/\/\s+ignore:[^\n]+//g; /([A-Z]\w*)\d\b/$1/g"?>
77

88
This page shows you how to use each major Dart feature, from
99
variables and operators to classes and libraries, with the assumption
@@ -757,7 +757,7 @@ var list2 = [0, ...?list];
757757
assert(list2.length == 1);
758758
{% endprettify %}
759759

760-
For more details and examples of using the spread operator, see the
760+
For more details and examples of using the spread operator, see the
761761
[spread operator proposal.][spread proposal]
762762

763763
<a id="collection-operators"> </a>
@@ -792,7 +792,7 @@ var listOfStrings = [
792792
assert(listOfStrings[1] == '#1');
793793
{% endprettify %}
794794

795-
For more details and examples of using collection if and for, see the
795+
For more details and examples of using collection if and for, see the
796796
[control flow collections proposal.][collections proposal]
797797

798798
[collections proposal]: https://github.com/dart-lang/language/blob/master/accepted/2.3/control-flow-collections/feature-specification.md

src/_guides/language/sound-dart.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: The Dart type system
33
description: Why and how to write sound Dart code.
44
---
5-
<?code-excerpt replace="/([A-Z]\w*)\d\b/$1/g; /\b(main)\d\b/$1/g"?>
5+
<?code-excerpt replace="/ *\/\/\s+ignore_for_file:[^\n]+\n//g; /([A-Z]\w*)\d\b/$1/g; /\b(main)\d\b/$1/g"?>
66

77
The Dart language is type safe: it uses a combination of static type checking and
88
[runtime checks](#runtime-checks) to

src/_guides/language/sound-problems.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Fixing common type problems
33
description: Common type issues you may have and how to fix them.
44
---
55
{% comment %}Don't show exact file names in analyzer error output.{% endcomment %}
6-
<?code-excerpt replace="/ at (lib|test)\/\w+\.dart:\d+:\d+//g"?>
6+
<?code-excerpt replace="/ *\/\/\s+ignore_for_file:[^\n]+\n//g; / at (lib|test)\/\w+\.dart:\d+:\d+//g"?>
77
<?code-excerpt plaster="none"?>
88

99
If you're having problems with type checks,

src/_guides/libraries/library-tour.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: A tour of the core libraries
33
description: Learn about the major features in Dart's libraries.
44
short-title: Library tour
55
---
6+
<?code-excerpt replace="/ *\/\/\s+ignore_for_file:[^\n]+\n//g;"?>
67
<?code-excerpt plaster="none"?>
78

89
This page shows you how to use the major features in Dart’s core libraries.
@@ -989,7 +990,7 @@ class FooException implements Exception {
989990
{% endprettify %}
990991

991992
For more information, see
992-
[Exceptions](/guides/language/language-tour#exceptions)
993+
[Exceptions](/guides/language/language-tour#exceptions)
993994
(in the language tour) and the [Exception API reference.][Exception]
994995

995996

tool/refresh-code-excerpts.sh

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ ARGS+='/\/\*(\s*\.\.\.\s*)\*\//$1/g;' # /*...*/ --> ...
4747
ARGS+='/\{\/\*-(\s*\.\.\.\s*)-\*\/\}/$1/g;' # {/*-...-*/} --> ... (removed brackets too)
4848
# Replace "//!analysis-issue" by, say, "Analysis issue" (although once we can use embedded DPs this won't be needed)?
4949
ARGS+='/\/\/!(analysis-issue|runtime-error)[^\n]*//g;' # Removed warning/error marker
50-
ARGS+='/\x20*\/\/\s+ignore_for_file:[^\n]+\n//g;' # Remove analyzer ignore-issue marker
51-
ARGS+='/\x20*\/\/\s+ignore:[^\n]+//g;' # Remove analyzer ignore-issue marker
5250

5351
echo "Source: $SRC"
5452
echo "Fragments: $FRAG"

0 commit comments

Comments
 (0)