Skip to content

Commit

Permalink
sort project goals by title
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Jul 11, 2024
1 parent f664438 commit 594244b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mdbook-goals/src/mdbook_preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ impl<'c> GoalPreprocessorWithContext<'c> {

// Extract out the list of goals with the given status.
let goals = self.goal_documents(chapter_path)?;
let goals_with_status: Vec<&GoalDocument> = goals
let mut goals_with_status: Vec<&GoalDocument> = goals
.iter()
.filter(|g| g.metadata.status == status)
.collect();

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

// Format the list of goals and replace the `<!-- -->` comment with that.
let output = goal::format_goal_table(&goals_with_status)?;
chapter.content.replace_range(range, &output);
Expand Down

0 comments on commit 594244b

Please sign in to comment.