-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add ability to generate TOC file for testing links #2665
Conversation
The PR preview for f84f0e7 is available at theforeman-foreman-documentation-preview-pr-2665.surge.sh The following output files are affected by this PR: |
Thanks for your contribution. @ShimShtein Can you please update your PR? |
a8684b2
to
ace6488
Compare
Updated the PR, should be OK now.
This file translates book names into the first part of documentation link path. The translation is not trivial, so I can't actually use an algorithm to derive the book name from the link. |
ace6488
to
a9cbc27
Compare
@maximiliankolb ready for another round |
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.
Took me a little while to see that this only works for "foreman" as build target.
$ rm -fr guides/build && podman run --rm -v $(pwd):/foreman-documentation:Z tmp_review_2665 make toc
$ wc guides/build/toc.json
931 1028 43851 guides/build/toc.json
$ cat guides/build/toc.json | jq -e
$ echo $?
0
I've built the container image based on your branch. I generally run rm -fr guides/build && podman run --rm -v $(pwd):/foreman-documentation:Z foreman_documentation make html BUILD=katello
locally. With a build target, I get the following error message: scripts/extract_links_toc: warning: argument of top-level return is ignored
and the JSON file is empty like {}
.
two things: a) it would be nice to have a small section in guides/README.md how it works (maybe just copy my command?; maybe just say "run make toc"?) and why/when someone would want to do this.
b) it would be nice to make this work for all build targets, no?
I cannot comment on the ruby code tbh.
a9cbc27
to
bd37755
Compare
Added a paragraph into the README file. It actually explained why running build targets other than foreman resulted in an empty TOC. To get something in the TOC, we will need to modify the |
@ekohl I think it's ready for another round. |
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.
I've left you corrections for folder names of Satellite guides in 6.15.
They have to be precise, otherwise we would be getting 404s.
FYI The guide titles/folder names may and do differ between Satellite releases!
bd37755
to
d8521b9
Compare
@Lennonka Ready for another round |
896aca8
to
108eb9e
Compare
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.
A couple of suggestions.
I cannot comment on the ruby code.
The rest LGTM.
@ekohl Please have a look at the code. |
681a002
to
eaf760d
Compare
@ekohl Changed the files.
Would you like to call it |
Sounds good to me. Mostly raising it because we have 2 downstreams, so it's ambiguous. Satellite is explicit so 👍 |
@ekohl renamed the file and left comments on your questions. |
guides/Makefile
Outdated
@@ -24,3 +24,6 @@ linkchecker-tryer: | |||
find build -type f -name index\*html | xargs linkchecker -r1 -f common/linkchecker.ini --check-extern | ./scripts/linkchecker-tryer | |||
|
|||
ccutil: $(SUBDIRS) | |||
|
|||
toc: html | |||
F2L=upstream_filename_to_satellite_link.json ruby scripts/extract_links_toc build/**/index-*.html > build/toc.json |
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.
Since you're already doing this for Satellite only, you can limit it to just index-satellite.html
. And also use the shebang
F2L=upstream_filename_to_satellite_link.json ruby scripts/extract_links_toc build/**/index-*.html > build/toc.json | |
F2L=upstream_filename_to_satellite_link.json ./scripts/extract_links_toc build/**/index-satellite.html > build/toc.json |
Then for the mapping file you can map File.dirname($filename)
. In the JSON you'll only have a mapping of directory names:
{
"Administering_Project": "administering_red_hat_satellite"
}
Then you probably want to change the JSON filename to mention directory
instead of filename
.
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.
I prefer specifying the file names explicitly. Downstream the files and directories structure looks a bit different.
Once we unify the upstream and downstream - that would be an option.
"build/Upgrading_Project/index-katello.html": "upgrading_connected_red_hat_satellite_to_6.15", | ||
"build/Upgrading_Project_Disconnected/index-katello.html": "upgrading_disconnected_red_hat_satellite_to_6.15", |
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.
If this includes the version in the filename then we'll need to make sure that this is updated during Satellite version bumping.
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.
Yes, that would make sense. It will be detected on the first run of the tests against the new TOC, since the links to the next version will be missing.
@ekohl updated to use the shebang. |
guides/Makefile
Outdated
@@ -24,3 +24,6 @@ linkchecker-tryer: | |||
find build -type f -name index\*html | xargs linkchecker -r1 -f common/linkchecker.ini --check-extern | ./scripts/linkchecker-tryer | |||
|
|||
ccutil: $(SUBDIRS) | |||
|
|||
toc: html | |||
F2L=upstream_filename_to_satellite_link.json ./scripts/extract_links_toc build/**/index-*.html > build/toc.json |
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.
I instist you should only read index-satellite.html
because that's the only relevant guide. And please also update that in the JSON file.
F2L=upstream_filename_to_satellite_link.json ./scripts/extract_links_toc build/**/index-*.html > build/toc.json | |
F2L=upstream_filename_to_satellite_link.json ./scripts/extract_links_toc build/**/index-satellite.html > build/toc.json |
@ekohl Finally got it working and even without the |
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.
I think this is the last part, otherwise 👍. Thanks for iterating on it because I now think we have the correct version.
guides/README.md
Outdated
which can be used for validating `administering_red_hat_satellite/accessing_server_admin#Logging_in_admin` link. | ||
|
||
Note: The translation of book file names to root part of the link path is dependent on [`upstream_filename_to_satellite_link.json`](./upstream_filename_to_satellite_link.json) file. | ||
For example `build/Administering_Project/index-foreman-el.html` would be translated to `.../administering_red_hat_satellite/...` path in the TOC. |
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.
For example `build/Administering_Project/index-foreman-el.html` would be translated to `.../administering_red_hat_satellite/...` path in the TOC. | |
For example `build/Administering_Project/index-satellite.html` would be translated to `.../administering_red_hat_satellite/...` path in the TOC. |
@ekohl resolved the last issue. |
This commit adds the ability to generate a TOC file that can be used to test documentation links.
This is done in the theme PR: RedHatSatellite/foreman_theme_satellite#31
Please cherry-pick my commits into: