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

Commit 8a11e48

Browse files
committed
Updated generator script for dartlang
1 parent 22ae12c commit 8a11e48

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

dart_io_mini_samples/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
## Dart I/O and Command Line Apps
1+
## Dart I/O and Command Line Apps
22

33
* [Introduction](example/introduction.md)
44

55
### Files, directories, and symlinks
6-
* [Deleting a file, directory, or * symlink](example/files_directories_and_symlinks/deleting_a_file_directory_or_symlink.dart)
6+
* [Deleting a file, directory, or symlink](example/files_directories_and_symlinks/deleting_a_file_directory_or_symlink.dart)
77
* [Renaming a file, directory, or symlink](example/files_directories_and_symlinks/renaming_a_file_directory_or_symlink.dart)
88
* [Finding the type of a filesystem object](example/files_directories_and_symlinks/finding_the_type_of_a_filesystem_object.dart)
99
* [Getting the parent directory](example/files_directories_and_symlinks/getting_the_parent_directory.dart)

dart_io_mini_samples/generate_md_for_dartlang.dart

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import 'dart:io';
22
import 'package:path/path.dart' as PATH;
33

4+
// text.gsub /\[([^\]]+)\]\(([^)]+)\)/, '<a href="\2">\1</a>'
5+
46
printExample(List<String> lines) {
5-
var i;
6-
for (i = 0; i < lines.length; i++) {
7+
var i = 0;
8+
for (; i < lines.length; i++) {
79
var line = lines[i].trim();
810
// Get the first non-empty, non-comment line.
911
if (line.startsWith('//') || (line.isEmpty)) {
@@ -29,7 +31,6 @@ header:
2931
has-permalinks: true
3032
---
3133
32-
{% include docs_toc.html %}
3334
''';
3435

3536
void main() {
@@ -58,6 +59,12 @@ void main() {
5859
} else {
5960
// Print non-link lines from the README.
6061
print(line);
62+
// Title line.
63+
if (line.startsWith('## ')) {
64+
print('{:.no_toc}');
65+
print('');
66+
print ('{% include default_toc.html %}');
67+
}
6168
}
6269
}
6370
}

0 commit comments

Comments
 (0)