Skip to content

Commit

Permalink
Components Rendering: Support nested readmes (#609)
Browse files Browse the repository at this point in the history
* update component renderer

* update component renderer

* fix: names of child docs

* trigger build
  • Loading branch information
Benbentwo committed May 2, 2024
1 parent 2aec39f commit 47fa8b6
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 115 deletions.
156 changes: 44 additions & 112 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ Let's jump right in! Here's how to get started with our documentation.
---

This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
[<img align="right" title="Share via Email" src="https://docs.cloudposse.com/images/ionicons/ios-email-outline-2.0.1-16x16-999999.svg"/>][share_email]
[<img align="right" title="Share on Google+" src="https://docs.cloudposse.com/images/ionicons/social-googleplus-outline-2.0.1-16x16-999999.svg" />][share_googleplus]
[<img align="right" title="Share on Facebook" src="https://docs.cloudposse.com/images/ionicons/social-facebook-outline-2.0.1-16x16-999999.svg" />][share_facebook]
[<img align="right" title="Share on Reddit" src="https://docs.cloudposse.com/images/ionicons/social-reddit-outline-2.0.1-16x16-999999.svg" />][share_reddit]
[<img align="right" title="Share on LinkedIn" src="https://docs.cloudposse.com/images/ionicons/social-linkedin-outline-2.0.1-16x16-999999.svg" />][share_linkedin]
[<img align="right" title="Share on Twitter" src="https://docs.cloudposse.com/images/ionicons/social-twitter-outline-2.0.1-16x16-999999.svg" />][share_twitter]





Expand All @@ -64,8 +56,6 @@ It's 100% Open Source and licensed under the [Creative Commons Attribution-NonCo





## Usage


Expand Down Expand Up @@ -93,36 +83,66 @@ Available targets:
help Help screen
help/all Display help for all targets
help/short This help short screen
deps Install node modules
deps-production Install production only node modules
build Generate all static content (outputs to build/) using docker environment
start Start web server locally
real-clean Clean all dependencies and generated html files
all Run `clean`, `deps` and `build steps
```
<!-- markdownlint-restore -->


## Related Projects

## Share the Love
Check out these related projects.

Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/docs)! (it helps us **a lot**)
- [Geodesic](https://github.com/cloudposse/geodesic) - Geodesic is the fastest way to get up and running with a rock solid, production grade cloud platform

Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)
## ✨ Contributing

This project is under active development, and we encourage contributions from our community.
Many thanks to our outstanding contributors:

<a href="https://github.com/cloudposse/docs/graphs/contributors">
<img src="https://contrib.rocks/image?repo=cloudposse/docs&max=24" />
</a>

## Related Projects
### 🐛 Bug Reports & Feature Requests

Check out these related projects.
Please use the [issue tracker](https://github.com/cloudposse/docs/issues) to report any bugs or file feature requests.

- [Geodesic](https://github.com/cloudposse/geodesic) - Geodesic is the fastest way to get up and running with a rock solid, production grade cloud platform
### 💻 Developing

## Help
If you are interested in being a contributor and want to get involved in developing this project or [help out](https://cpco.io/help-out) with our other projects, we would love to hear from you! Shoot us an [email][email].

**Got a question?** We got answers.
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

File a GitHub [issue](https://github.com/cloudposse/docs/issues), send us an [email][email] or join our [Slack Community][slack].
1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Push** your work back up to your fork
5. Submit a **Pull Request** so that we can review your changes

[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]
**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request!

### 🌎 Slack Community

Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.

### 📰 Newsletter

Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.

### 📆 Office Hours <img src="https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png" align="right" />

## DevOps Accelerator for Startups
[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone!

## About

This project is maintained and funded by [Cloud Posse, LLC][website].
<a href="https://cpco.io/homepage"><img src="https://cloudposse.com/logo-300x69.svg" align="right" /></a>

We are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.

Expand All @@ -143,52 +163,7 @@ We deliver 10x the value for a fraction of the cost of a full-time engineer. Our
- **Code Reviews.** You'll receive constructive feedback on Pull Requests.
- **Bug Fixes.** We'll rapidly work with you to fix any bugs in our projects.

## Slack Community

Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.

## Discourse Forums

Participate in our [Discourse Forums][discourse]. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account.

## Newsletter

Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.

## Office Hours

[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone!

[![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png")][office_hours]

## Contributing

### Bug Reports & Feature Requests

Please use the [issue tracker](https://github.com/cloudposse/docs/issues) to report any bugs or file feature requests.

### Developing

If you are interested in being a contributor and want to get involved in developing this project or [help out](https://cpco.io/help-out) with our other projects, we would love to hear from you! Shoot us an [email][email].

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Push** your work back up to your fork
5. Submit a **Pull Request** so that we can review your changes

**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request!


## Copyright

Copyright © 2017-2023 [Cloud Posse, LLC](https://cpco.io/copyright)




[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]
## License

[![License](https://img.shields.io/badge/License-CC%20BY%20NC%20SA%204.0-blue.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
Expand All @@ -209,45 +184,11 @@ Distribution of substantively modified versions of this document is prohibited w

Distribution of the work or derivative of the work in any standard (paper) book form for commercial purposes is prohibited unless prior permission is obtained from the copyright holder.








## Trademarks

All other trademarks referenced herein are the property of their respective owners.

## About

This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know by [leaving a testimonial][testimonial]!

[![Cloud Posse][logo]][website]

We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We ❤️ [Open Source Software][we_love_open_source].

We offer [paid support][commercial_support] on all of our projects.

Check out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.



### Contributors

<!-- markdownlint-disable -->
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] |
|---|---|---|
<!-- markdownlint-restore -->

[osterman_homepage]: https://github.com/osterman
[osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png
[goruha_homepage]: https://github.com/goruha
[goruha_avatar]: https://img.cloudposse.com/150x150/https://github.com/goruha.png
[aknysh_homepage]: https://github.com/aknysh
[aknysh_avatar]: https://img.cloudposse.com/150x150/https://github.com/aknysh.png

---
Copyright © 2017-2024 [Cloud Posse, LLC](https://cpco.io/copyright)
[![README Footer][readme_footer_img]][readme_footer_link]
[![Beacon][beacon]][website]
<!-- markdownlint-disable -->
Expand All @@ -258,12 +199,9 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
[jobs]: https://cpco.io/jobs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=jobs
[hire]: https://cpco.io/hire?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=hire
[slack]: https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=slack
[linkedin]: https://cpco.io/linkedin?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=linkedin
[twitter]: https://cpco.io/twitter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=twitter
[testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=testimonial
[office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=office_hours
[newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=newsletter
[discourse]: https://ask.sweetops.com/?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=discourse
[email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=email
[commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=commercial_support
[we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=we_love_open_source
Expand All @@ -274,11 +212,5 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
[readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=readme_footer_link
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/docs&utm_content=readme_commercial_support_link
[share_twitter]: https://twitter.com/intent/tweet/?text=Developer+Documentation&url=https://github.com/cloudposse/docs
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=Developer+Documentation&url=https://github.com/cloudposse/docs
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/docs
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/docs
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/docs
[share_email]: mailto:?subject=Developer+Documentation&body=https://github.com/cloudposse/docs
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/docs?pixel&cs=github&cm=readme&an=docs
<!-- markdownlint-restore -->
2 changes: 2 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ contributors:
github: "goruha"
- name: "Andriy Knysh"
github: "aknysh"
- name: "Benjamin Smith"
github: "Benbentwo"
15 changes: 12 additions & 3 deletions scripts/docs-collator/ComponentRenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,18 @@ def render(self, component):
module_download_dir = os.path.join(self.download_dir, 'modules', component)

files = io.get_filenames_in_dir(module_download_dir, README_MD, True)
files += io.get_filenames_in_dir(module_download_dir, '*.md', True)

images = io.get_filenames_in_dir(module_download_dir, '*.png', True)

for file in files:
if file.endswith(CHANGELOG_MD):
continue
self.__render_doc(component, file)

for image in images:
io.copy_file(image, os.path.join(self.docs_dir, component, os.path.relpath(image, module_download_dir)))

def __render_doc(self, component, file):
module_download_dir = os.path.join(self.download_dir, 'modules')

Expand All @@ -43,11 +51,12 @@ def __render_doc(self, component, file):
relative_path = os.path.relpath(file, module_download_dir)
result_file = os.path.join(self.docs_dir, os.path.relpath(file, module_download_dir)) # <module-name>/README.md

label = component
title = component
name = component if os.path.basename(file) == "README.md" else os.path.basename(file).replace(".md", "")
label = name
title = name
github_edit_url = f"https://github.com/{GITHUB_REPO}/blob/master/modules/{relative_path}"

if len(relative_path.split('/')) > 2: # this is submodule
if len(relative_path.split('/')) > 2 and relative_path.split('/')[1] != 'docs' : # this is submodule
submodule_name = os.path.basename(os.path.dirname(result_file))

label = submodule_name
Expand Down

0 comments on commit 47fa8b6

Please sign in to comment.