Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
[![Test Docs](https://github.com/VectorInstitute/mdbook-github-authors/actions/workflows/test_docs.yml/badge.svg)](https://github.com/VectorInstitute/mdbook-github-authors/actions/workflows/test_docs.yml)
[![Test Lib](https://github.com/VectorInstitute/mdbook-github-authors/actions/workflows/test.yml/badge.svg)](https://github.com/VectorInstitute/mdbook-github-authors/actions/workflows/test.yml)
![GitHub License](https://img.shields.io/github/license/VectorInstitute/mdbook-github-authors)
![GitHub Release](https://img.shields.io/github/v/release/VectorInstitute/mdbook-github-authors)

An mdbook preprocessor for easily listing authors of a given page using their Github profiles.
13 changes: 1 addition & 12 deletions src/github_authors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,7 @@ impl Preprocessor for GithubAuthorsPreprocessor {
Self::NAME
}

#[allow(unused_variables)]
fn run(&self, ctx: &PreprocessorContext, mut book: Book) -> anyhow::Result<Book> {
// Gameplan:
// 1. Find all authors helper using reg-ex in chapter content, using `find_author_links`
// 2. Sequentially erase all authors helpers from the content
// 3. Use handlebar template `authors.hbs` and render the found authors
// 4. Take the rendered html string and add it to the end of the chapter content
// 5. Figure out if need to make a cli for this and use CmdPreprocessor
let src_dir = ctx.root.join(&ctx.config.book.src);

fn run(&self, _ctx: &PreprocessorContext, mut book: Book) -> anyhow::Result<Book> {
book.for_each_mut(|section: &mut BookItem| {
if let BookItem::Chapter(ref mut ch) = *section {
let (mut content, github_authors) = remove_all_links(&ch.content);
Expand Down Expand Up @@ -149,7 +140,6 @@ impl<'a> AuthorLink<'a> {
}
}

#[allow(dead_code)]
struct AuthorLinkIter<'a>(CaptureMatches<'a, 'a>);

impl<'a> Iterator for AuthorLinkIter<'a> {
Expand All @@ -164,7 +154,6 @@ impl<'a> Iterator for AuthorLinkIter<'a> {
}
}

#[allow(dead_code)]
fn find_author_links(contents: &str) -> AuthorLinkIter<'_> {
// lazily compute following regex
// r"\\\{\{#.*\}\}|\{\{#([a-zA-Z0-9]+)\s*([^}]+)\}\}")?;
Expand Down