-
Notifications
You must be signed in to change notification settings - Fork 2.6k
improving docs generation by adding homepage to config #4702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mattsse
merged 6 commits into
foundry-rs:master
from
ethereumdegen:improve-docs-generation
May 12, 2023
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e5053ad
improving docs generation by adding homepage to config
ethereumdegen 6049d75
comments
ethereumdegen fc6531d
remove comments
ethereumdegen 2370e8c
chore: rizz up as per comments
Evalir d994eac
chore: skip serializing if empty
Evalir 2cc1b87
chore: fix if
Evalir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -231,19 +231,33 @@ impl DocBuilder { | |
| fs::create_dir_all(&out_dir_src)?; | ||
|
|
||
| // Write readme content if any | ||
| let readme_content = { | ||
| let homepage_content = { | ||
|
|
||
| let src_readme = self.sources.join(Self::README); | ||
| let root_readme = self.root.join(Self::README); | ||
| if src_readme.exists() { | ||
| fs::read_to_string(src_readme)? | ||
| } else if root_readme.exists() { | ||
| fs::read_to_string(root_readme)? | ||
| } else { | ||
| String::new() | ||
|
|
||
| //Check to see if there is a 'homepage' option specified in config. | ||
| //If not, fall back to src and root readme files. | ||
| let homepage_path = { | ||
| if self.config.homepage.is_file() { | ||
| Some(self.config.homepage.clone()) | ||
| } else if src_readme.exists() { | ||
| Some(src_readme) | ||
| }else if root_readme.exists() { | ||
| Some(root_readme) | ||
| }else { | ||
| None | ||
| } | ||
| }; | ||
|
|
||
| match homepage_path { | ||
| Some(path) => fs::read_to_string(path)?, | ||
| None => String::new(), | ||
| } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I read that correctly then these changes are not needed if we set the src_readme: let root_readme = self.homepage.as_ref().map(|homepage|self.root.join(homepage)).unwrap_or_else(||self.root.join(Self::README); |
||
| }; | ||
| let readme_path = out_dir_src.join(Self::README); | ||
| fs::write(&readme_path, readme_content)?; | ||
| fs::write(&readme_path, homepage_content)?; | ||
|
|
||
| // Write summary and section readmes | ||
| let mut summary = BufWriter::default(); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah so this is expected to be set in the toml file?
I think this should be an Option