Skip to content

Commit aede04b

Browse files
committed
merge proposed,orphaned and document plugin a bit
1 parent 0c98521 commit aede04b

File tree

10 files changed

+68
-11
lines changed

10 files changed

+68
-11
lines changed

mdbook-goals/src/mdbook_preprocessor.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,21 @@ impl<'c> GoalPreprocessorWithContext<'c> {
177177
return Ok(());
178178
};
179179
let range = m.get(0).unwrap().range();
180-
let status = Status::try_from(&m[1])?;
180+
let statuses = m[1]
181+
.split(',')
182+
.map(|s| s.trim())
183+
.map(Status::try_from)
184+
.collect::<anyhow::Result<Vec<Status>>>()?;
181185

182186
let Some(chapter_path) = &chapter.path else {
183187
anyhow::bail!("found `<!-- GOALS -->` but chapter has no path")
184188
};
185189

186190
// Extract out the list of goals with the given status.
187191
let goals = self.goal_documents(chapter_path)?;
188-
let mut goals_with_status: Vec<&GoalDocument> = goals
192+
let mut goals_with_status: Vec<&GoalDocument> = statuses
189193
.iter()
190-
.filter(|g| g.metadata.status == status)
194+
.flat_map(|&status| goals.iter().filter(move |g| g.metadata.status == status))
191195
.collect();
192196

193197
goals_with_status.sort_by_key(|g| &g.metadata.title);

mdbook-goals/src/re.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ lazy_static! {
66
}
77

88
lazy_static! {
9-
pub static ref GOAL_LIST: Regex = Regex::new(r"<!-- GOALS `(.*)` -->").unwrap();
9+
pub static ref GOAL_LIST: Regex = Regex::new(r"<!-- GOALS '(.*)' -->").unwrap();
1010
}
1111

1212
lazy_static! {

src/2024h2/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ The flagship goals proposed for this roadmap are as follows:
8787

8888
The slate of additional project goals are as follows. These goals all have identified owners who will drive the work forward as well as a viable work plan. The goals include asks from the listed Rust teams, which are cataloged in the [reference-level explanation](#reference-level-explanation) section below. Some goals are actively looking for volunteers; these goals are tagged with ![Help wanted][].
8989

90-
<!-- GOALS `Proposed` -->
90+
<!-- GOALS 'Proposed' -->
9191

9292
### Orphaned goals ![Help wanted][]
9393

9494
Goals in this section are "pre-approved" by the team but lack an owner. These indicate a place where we are looking for someone to step up and help drive the goal the goal to completion. Every orphaned goal has someone who is willing and able to serve as mentor, but lacks the time or resources to truly *own* the goal. If you are interested in serving as the owner for one of these orphaned goals, reach out to the listed mentor to discuss. Orphaned goals may also be used as the basis of applying for grants from the Rust Foundation or elsewhere.
9595

96-
<!-- GOALS `Orphaned` -->
96+
<!-- GOALS 'Orphaned' -->
9797

9898
# Reference-level explanation
9999
[reference-level-explanation]: #reference-level-explanation

src/2024h2/flagship.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Flagship goals
22

3-
<!-- GOALS `Flagship` -->
3+
<!-- GOALS 'Flagship' -->

src/2024h2/not_accepted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
This section contains goals that were proposed but ultimately not accepted, either for want of resources or consensus. In many cases, narrower versions of these goals were accepted.
44

5-
<!-- GOALS `Not accepted` -->
5+
<!-- GOALS 'Not accepted' -->

src/2024h2/orphaned.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Goals in this section are "pre-approved" by the team but lack an owner. These indicate a place where we are looking for someone to step up and help drive the goal the goal to completion. Every orphaned goal has someone who is willing and able to serve as mentor, but lacks the time or resources to truly *own* the goal. If you are interested in serving as the owner for one of these orphaned goals, reach out to the listed mentor to discuss. Orphaned goals may also be used as the basis of applying for grants from the Rust Foundation or elsewhere.
44

5-
<!-- GOALS `Orphaned` -->
5+
<!-- GOALS 'Orphaned' -->
66

77

src/2024h2/proposed.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This page lists the goals currently under consideration, with the exception of [flagship goals](./flagship.md), which are listed separately.
44

5-
<!-- GOALS `Proposed` -->
5+
Some goals here are listed without an owner (look for the ![Help wanted][] badge). These indicate a place where we are looking for someone to step up and help drive the goal the goal to completion. Every orphaned goal has someone who is willing and able to serve as mentor, but lacks the time or resources to truly *own* the goal. If you are interested in serving as the owner for one of these orphaned goals, reach out to the listed mentor to discuss.
6+
7+
<!-- GOALS 'Proposed,Orphaned' -->
68

79

src/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
- [RFC draft](./2024h2/README.md)
88
- [Flagship goals](./2024h2/flagship.md)
99
- [Proposed goals](./2024h2/proposed.md)
10-
- [Orphaned goals](./2024h2/orphaned.md)
1110
- [Goals not accepted](./2024h2/not_accepted.md)
1211
- [General notes](./2024h2/notes.md)
1312

src/admin/commands.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Commands
2+
3+
The `mdbook-goals` plugin can also be run with `cargo run --` and it has a number of useful commands:
4+
5+
* `cargo run -- --help`

src/admin/mdbook_plugin.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Mdbook Plugin
2+
3+
The mdbook is controlled by the `mdbook-goals` plugin in this repo.
4+
This plugin makes various edits to the source:
5+
6+
* Linking usernames like `@foo` to their github page and replacing them with their display name.
7+
* Linking GH references lke rust-lang/rust#123.
8+
* Collating goals, creating tables, etc.
9+
10+
The plugin can also be used [from the commmand line](./commands.md).
11+
12+
## Expected book structure
13+
14+
The plugin is designed for the book to have a directory per phase of the goal program, e.g., `src/2024h2`, `src/2025h1`, etc.
15+
Within this directory there should be:
16+
17+
* A `README.md` file that will contain the draft slate RFC.
18+
* One file per goal. Each goal file must follow the [TEMPLATE](../TEMPLATE.md) structure and in particular must have
19+
* a metadata table in its first section
20+
* a [Summary section](../TEMPLATE.md#summary)
21+
* a [Ownership and team asks](../TEMPLATE.md#ownership-and-team-asks) containing the subgoal table
22+
* One file per "phase" of the program, e.g., `proposed.md` etc. (These are not mandatory.)
23+
24+
## Plugin replacement text
25+
26+
The plugin will replace the following placeholder texts.
27+
Each placeholder is enclosed within an html comment `<!-- -->`.
28+
29+
### Goal count
30+
31+
The placeholder `<!-- #GOALS -->` will be replaced with the total number of goals under consideration
32+
(this count excludes goals with the status `Not accepted`).
33+
34+
### Goal listing
35+
36+
The placeholder `<!-- GOALS '$Status' -->` will insert a goal table listing goals of the given status `$Status`, e.g.:
37+
38+
```
39+
<!-- GOALS 'Flagship' -->
40+
<!-- GOALS 'Proposed' -->
41+
```
42+
43+
You can also list multiple status items, e.g.:
44+
45+
```
46+
<!-- GOALS 'Accepted,Orphaned' -->
47+
```

0 commit comments

Comments
 (0)