Skip to content
This repository was archived by the owner on Jun 3, 2020. It is now read-only.

Commit 86b80c6

Browse files
committed
Updating the code and text that results in the /dart-vm/dart-by-example file on www.
1 parent 9cd3d3b commit 86b80c6

File tree

4 files changed

+51
-40
lines changed

4 files changed

+51
-40
lines changed

dart_io_mini_samples/README.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
## Dart I/O and Command Line Apps
1+
## Writing code for the Dart VM
2+
3+
### Dart I/O and Command Line Apps
24

35
* [Introduction](example/introduction.md)
46

5-
### Files, directories, and symlinks
7+
## Files, directories, and symlinks
8+
69
* [Deleting a file, directory, or symlink](example/files_directories_and_symlinks/deleting_a_file_directory_or_symlink.dart)
710
* [Renaming a file, directory, or symlink](example/files_directories_and_symlinks/renaming_a_file_directory_or_symlink.dart)
811
* [Finding the type of a filesystem object](example/files_directories_and_symlinks/finding_the_type_of_a_filesystem_object.dart)
@@ -11,7 +14,6 @@
1114
* [Reading a file as a string](example/files_directories_and_symlinks/files/reading_a_file_as_a_string.dart)
1215
* [Reading a file as lines](example/files_directories_and_symlinks/files/reading_a_file_as_lines.dart)
1316
* [Reading a file as bytes](example/files_directories_and_symlinks/files/reading_a_file_as_bytes.dart)
14-
* [Using a stream to read a file](example/files_directories_and_symlinks/files/reading_a_file_using_a_stream.dart)
1517
* [Handling errors when reading a file](example/files_directories_and_symlinks/files/handling_errors_when_reading_a_file.dart)
1618
* [Writing a string to a file](example/files_directories_and_symlinks/files/writing_a_string_to_a_file.dart)
1719
* [Writing bytes to a file](example/files_directories_and_symlinks/files/writing_bytes_to_a_file.dart)
@@ -23,7 +25,8 @@
2325
* [Checking if a path represents a symlink](example/files_directories_and_symlinks/symlinks/checking_if_a_path_represents_a_symlink.dart)
2426
* [Getting the target of a symlink](example/files_directories_and_symlinks/symlinks/getting_the_target_of_a_link.dart)
2527

26-
### HTTP requests and responses
28+
## HTTP requests and responses
29+
2730
* [Making a GET request](example/http/making_a_get_request.dart)
2831
* [Making a POST request](example/http/making_a_post_request.dart)
2932
* [Adding custom headers to a request](example/http/adding_custom_headers.dart)
@@ -34,37 +37,41 @@
3437
* [Getting the response content in binary format](example/http/getting_the_response_content_in_binary_format.dart)
3538
* [Getting the response headers](example/http/getting_the_response_headers.dart)
3639

37-
### HTTP server
40+
## HTTP server
41+
3842
* [Implementing a 'Hello world' HTTP server](example/http_server/implementing_a_hello_world_http_server.dart)
39-
* [Listing directory contents](example/http_server/listing_directory_contents.dart)
40-
* [Serving index.html](example/http_server/serving_index_html.dart)
41-
* [Serving a 404](example/http_server/serving_a_404.dart)
4243
* [Routing requests based on URL patterns](example/http_server/routing_requests_based_on_url_patterns.dart)
4344

44-
### Sockets
45+
## Sockets
46+
4547
* [Using serversockets server](example/sockets/using_serversockets_server.dart)
4648
* [Using serversockets client](example/sockets/using_serversockets_client.dart)
4749

48-
### Websockets
50+
## Websockets
51+
4952
* [Using websockets server](example/websockets/using_websockets_server.dart)
5053
* [Using websockets client](example/websockets/using_websockets_client.dart)
5154

52-
### OS and hardware information
55+
## OS and hardware information
56+
5357
* [Getting environment variables](example/platform/getting_environment_variables.dart)
5458
* [Identifying the operating system](example/platform/identifying_the_operating_system.dart)
5559
* [Getting information about the script being run](example/platform/getting_information_about_the_script_being_run.dart)
5660

57-
### Interacting with processes
61+
## Interacting with processes
62+
5863
* [Running a process](example/interacting_with_processes/running_a_process.dart)
5964
* [Obtaining the exit code when running a process](example/interacting_with_processes/obtaining_the_exit_code_when_running_a_process.dart)
6065

61-
### Working with paths
66+
## Working with paths
67+
6268
* [Joining paths](example/paths/joining_paths.dart)
6369
* [Parsing a path into components](example/paths/parsing_a_path_into_components.dart)
6470
* [Calculating relative paths](example/paths/calculating_relative_paths.dart)
6571
* [Converting between a URI and a path](example/paths/converting_between_a_uri_and_a_path.dart)
6672
* [Getting information about a file path](example/paths/getting_information_about_a_file_path.dart)
6773
* [Getting the path separator for the current platform](example/paths/getting_the_path_separator_for_the_current_platform.dart)
6874

69-
### Other resources
75+
## Other resources
76+
7077
* [Other resources](example/other_resources.md)

dart_io_mini_samples/example/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ See the
1818
[source on Github](https://github.com/dart-lang/dart-samples/tree/master/dart_io_mini_samples).
1919

2020
After looking at the following code examples, refer to
21-
[Writing Command-line Apps: A Programmer's Guide](/docs/serverguide.html)
22-
for additional information about I/O, command-line apps, and servers.
21+
[Write Command-line Apps](/tutorials/dart-vm/cmdline)
22+
for additional information about I/O and command-line apps.
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
Read the [dart:io library API docs](https://api.dartlang.org/docs/channels/stable/latest/dart_io.html).
1+
Read the [dart:io library API docs]({{site.dart_api}}/dart-io/dart-io-library.html).
22

3-
Here are links to the commonly used classes and packages in these
4-
examples:
3+
Here are links to the commonly used classes and packages in these examples:
54

6-
* Files, Directories, and Symlinks
5+
* Using files, directories, and symlinks
76

8-
* [FileSystemEntity class](https://api.dartlang.org/docs/channels/stable/latest/dart_io/FileSystemEntity.html)
9-
* [File class](https://api.dartlang.org/docs/channels/stable/latest/dart_io/File.html)
10-
* [Directory class](https://api.dartlang.org/docs/channels/stable/latest/dart_io/Directory.html)
11-
* [Link class (for symlinks)](https://api.dartlang.org/docs/channels/stable/latest/dart_io/Link.html)
12-
13-
* HTTP requests and responses
14-
* [http Pub package](https://api.dartlang.org/docs/channels/stable/latest/http.html)
7+
* [FileSystemEntity class]({{site.dart_api}}/dart-io/FileSystemEntity-class.html)
8+
* [File class]({{site.dart_api}}/dart-io/File-class.html)
9+
* [Directory class]({{site.dart_api}}/dart-io/Directory-class.html)
10+
* [Link class (for symlinks)]({{site.dart_api}}/dart-io/Link-class.html)
1511

1612
* HTTP server
17-
* [HttpServer class](https://api.dartlang.org/docs/channels/stable/latest/dart_io/HttpServer.html)
18-
* [http_server Pub package](https://api.dartlang.org/docs/channels/stable/latest/http_server.html)
13+
14+
* [HttpServer class]({{site.dart_api}}/dart-io/HttpServer-class.html)
15+
* [http_server Pub package](https://pub.dartlang.org/packages/http_server)
1916

2017
* OS and hardware information
21-
* [Platform class](https://api.dartlang.org/docs/channels/stable/latest/dart_io/Platform.html)
18+
19+
* [Platform class]({{site.dart_api}}/dart-io/Platform-class.html)
2220

2321
* Interacting with processes
24-
* [Process class](https://api.dartlang.org/docs/channels/stable/latest/dart_io/Process.html)
22+
23+
* [Process class]({{site.dart_api}}/dart-io/Process-class.html)
2524

2625
* Working with paths
27-
* [path Pub package](https://api.dartlang.org/docs/channels/stable/latest/path.html)
26+
27+
* [path Pub package](https://pub.dartlang.org/packages/path)

dart_io_mini_samples/generate_md_for_dartlang.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//
2+
// Run "dart generate_md_for_dartlang.dart > index.md".
3+
// Copy that file to /dart-vm/dart-by-example in the www repo.
4+
// This file uses fodder from README.md and example/* to generate
5+
// the final page.
6+
//
17
import 'dart:io';
28
import 'package:path/path.dart' as PATH;
39

@@ -26,9 +32,13 @@ printExample(List<String> lines) {
2632
const fileHeader = '''
2733
---
2834
layout: default
35+
title: "Cookbook: Dart by Example"
36+
short-title: "Cookbook"
37+
permalink: /dart-vm/dart-by-example
38+
description: "A cookbook, or set of examples, showing idiomatic Dart code."
39+
2940
header:
3041
css: ["index.css"]
31-
has-permalinks: true
3242
---
3343
3444
''';
@@ -49,7 +59,7 @@ main() {
4959
var file = new File(abspath);
5060

5161
if (PATH.extension(abspath) != '.md') {
52-
print('#### ${match.group(1)}');
62+
print('### ${match.group(1)}');
5363
print('');
5464
printExample(file.readAsLinesSync());
5565
} else {
@@ -59,12 +69,6 @@ main() {
5969
} else {
6070
// Print non-link lines from the README.
6171
print(line);
62-
// Title line.
63-
if (line.startsWith('## ')) {
64-
print('{:.no_toc}');
65-
print('');
66-
print('{% include default_toc.html %}');
67-
}
6872
}
6973
}
7074
}

0 commit comments

Comments
 (0)