Skip to content

Commit 0c40bb2

Browse files
hawkgspkozlowski-opensource
authored andcommitted
refactor(docs-infra): convert code-example-s that have only region param to @example-s (#59004)
Replace all <code-example>-s within TS files that contain only a path and a region with JSDoc @example-s. PR Close #59004
1 parent 6338c1b commit 0c40bb2

File tree

14 files changed

+57
-33
lines changed

14 files changed

+57
-33
lines changed

packages/common/src/location/location.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ export interface PopStateEvent {
4343
*
4444
* ### Example
4545
*
46-
* <code-example path='common/location/ts/path_location_component.ts'
47-
* region='LocationComponent'></code-example>
46+
* {@example common/location/ts/path_location_component.ts region='LocationComponent'}
4847
*
4948
* @publicApi
5049
*/

packages/common/src/pipes/case_conversion_pipes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
2020
* The following example defines a view that allows the user to enter
2121
* text, and then uses the pipe to convert the input text to all lower case.
2222
*
23-
* <code-example path="common/pipes/ts/lowerupper_pipe.ts" region='LowerUpperPipe'></code-example>
23+
* {@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe'}
2424
*
2525
* @ngModule CommonModule
2626
* @publicApi
@@ -68,7 +68,7 @@ const unicodeWordMatch =
6868
* @usageNotes
6969
* The following example shows the result of transforming various strings into title case.
7070
*
71-
* <code-example path="common/pipes/ts/titlecase_pipe.ts" region='TitleCasePipe'></code-example>
71+
* {@example common/pipes/ts/titlecase_pipe.ts region='TitleCasePipe'}
7272
*
7373
* @ngModule CommonModule
7474
* @publicApi

packages/common/src/pipes/number_pipe.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
7272
* according to various format specifications,
7373
* where the caller's default locale is `en-US`.
7474
*
75-
* <code-example path="common/pipes/ts/number_pipe.ts" region='NumberPipe'></code-example>
75+
* {@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
7676
*
7777
* @publicApi
7878
*/
@@ -130,7 +130,7 @@ export class DecimalPipe implements PipeTransform {
130130
* into text strings, according to various format specifications,
131131
* where the caller's default locale is `en-US`.
132132
*
133-
* <code-example path="common/pipes/ts/percent_pipe.ts" region='PercentPipe'></code-example>
133+
* {@example common/pipes/ts/percent_pipe.ts region='PercentPipe'}
134134
*
135135
* @publicApi
136136
*/
@@ -196,7 +196,7 @@ export class PercentPipe implements PipeTransform {
196196
* into text strings, according to various format specifications,
197197
* where the caller's default locale is `en-US`.
198198
*
199-
* <code-example path="common/pipes/ts/currency_pipe.ts" region='CurrencyPipe'></code-example>
199+
* {@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'}
200200
*
201201
* @publicApi
202202
*/

packages/core/src/change_detection/change_detector_ref.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ import {ViewRef} from '../render3/view_ref';
3535
* (`CheckOnce`, rather than the default `CheckAlways`), then forces a second check
3636
* after an interval.
3737
*
38-
* <code-example path="core/ts/change_detect/change-detection.ts"
39-
* region="mark-for-check"></code-example>
38+
* {@example core/ts/change_detect/change-detection.ts region='mark-for-check'}
4039
*
4140
* ### Detach change detector to limit how often check occurs
4241
*
@@ -46,7 +45,7 @@ import {ViewRef} from '../render3/view_ref';
4645
* less often than the changes actually occur. To do that, we detach
4746
* the component's change detector and perform an explicit local check every five seconds.
4847
*
49-
* <code-example path="core/ts/change_detect/change-detection.ts" region="detach"></code-example>
48+
* {@example core/ts/change_detect/change-detection.ts region='detach'}
5049
*
5150
*
5251
* ### Reattaching a detached component
@@ -56,7 +55,7 @@ import {ViewRef} from '../render3/view_ref';
5655
* when the `live` property is set to false, and reattaches it when the property
5756
* becomes true.
5857
*
59-
* <code-example path="core/ts/change_detect/change-detection.ts" region="reattach"></code-example>
58+
* {@example core/ts/change_detect/change-detection.ts region='reattach'}
6059
*
6160
* @publicApi
6261
*/

packages/core/src/di/injectable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface InjectableDecorator {
5656
* The following example shows how a service class is properly
5757
* marked so that a supporting service can be injected upon creation.
5858
*
59-
* <code-example path="core/di/ts/metadata_spec.ts" region="Injectable"></code-example>
59+
* {@example core/di/ts/metadata_spec.ts region='Injectable'}
6060
*
6161
*/
6262
(): TypeDecorator;

packages/core/src/di/injection_token.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ import {ɵɵdefineInjectable} from './interface/defs';
3030
*
3131
* </div>
3232
*
33-
* <code-example format="typescript" language="typescript" path="injection-token/src/main.ts"
34-
* region="InjectionToken"></code-example>
33+
* {@example injection-token/src/main.ts region='InjectionToken'}
3534
*
3635
* When creating an `InjectionToken`, you can optionally specify a factory function which returns
3736
* (possibly by creating) a default value of the parameterized type `T`. This sets up the

packages/core/src/di/metadata.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export interface InjectDecorator {
2828
* When `@Inject()` is not present, the injector uses the type annotation of the
2929
* parameter as the provider.
3030
*
31-
* <code-example path="core/di/ts/metadata_spec.ts" region="InjectWithoutDecorator">
32-
* </code-example>
31+
* {@example core/di/ts/metadata_spec.ts region='InjectWithoutDecorator'}
3332
*
3433
* @see [Dependency Injection Guide](guide/di/dependency-injection
3534
*
@@ -81,8 +80,7 @@ export interface OptionalDecorator {
8180
*
8281
* The following code allows the possibility of a `null` result:
8382
*
84-
* <code-example path="core/di/ts/metadata_spec.ts" region="Optional">
85-
* </code-example>
83+
* {@example core/di/ts/metadata_spec.ts region='Optional'}
8684
*
8785
* @see [Dependency Injection Guide](guide/di/dependency-injection.
8886
*/
@@ -127,8 +125,7 @@ export interface SelfDecorator {
127125
* by the local injector when instantiating the class itself, but not
128126
* when instantiating a child.
129127
*
130-
* <code-example path="core/di/ts/metadata_spec.ts" region="Self">
131-
* </code-example>
128+
* {@example core/di/ts/metadata_spec.ts region='Self'}
132129
*
133130
* @see {@link SkipSelf}
134131
* @see {@link Optional}
@@ -173,8 +170,7 @@ export interface SkipSelfDecorator {
173170
* In the following example, the dependency can be resolved when
174171
* instantiating a child, but not when instantiating the class itself.
175172
*
176-
* <code-example path="core/di/ts/metadata_spec.ts" region="SkipSelf">
177-
* </code-example>
173+
* {@example core/di/ts/metadata_spec.ts region='SkipSelf'}
178174
*
179175
* @see [Dependency Injection guide](guide/di/di-in-action#skip).
180176
* @see {@link Self}
@@ -218,8 +214,7 @@ export interface HostDecorator {
218214
*
219215
* The following shows use with the `@Optional` decorator, and allows for a `null` result.
220216
*
221-
* <code-example path="core/di/ts/metadata_spec.ts" region="Host">
222-
* </code-example>
217+
* {@example core/di/ts/metadata_spec.ts region='Host'}
223218
*
224219
* For an extended example, see ["Dependency Injection
225220
* Guide"](guide/di/di-in-action#optional).

packages/core/src/metadata/directives.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ export interface ComponentDecorator {
418418
* The following example creates a component with two data-bound properties,
419419
* specified by the `inputs` value.
420420
*
421-
* <code-example path="core/ts/metadata/directives.ts" region="component-input"></code-example>
421+
* {@example core/ts/metadata/directives.ts region='component-input'}
422422
*
423423
*
424424
* ### Setting component outputs

packages/examples/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ filegroup(
1313
"//packages/examples/core/di/ts/forward_ref:files_for_docgen",
1414
"//packages/examples/core/testing/ts:files_for_docgen",
1515
"//packages/examples/forms:files_for_docgen",
16+
"//packages/examples/injection-token:files_for_docgen",
1617
"//packages/examples/platform-browser:files_for_docgen",
1718
"//packages/examples/router:files_for_docgen",
1819
"//packages/examples/router/activated-route:files_for_docgen",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
filegroup(
4+
name = "files_for_docgen",
5+
srcs = glob([
6+
"**/*.ts",
7+
]),
8+
)

0 commit comments

Comments
 (0)