CXX-3081 Keep API doc index pages up-to-date with each release #1180
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.
Summary
Resolves CXX-3081. Followup to #1169 and #1174.
This PR adds a new script which is invoked during API doc deployment which patches the index pages of all prior API docs to match that of the latest API doc. This permits each API doc to have an up-to-date list of C++ Driver releases, links to resources, and possibly other information (such as announcements).
Index Page Contents
Regardless of Doxygen version and API doc version, the following patterns were observed:
index.html
file at the top-level directory of each API doc directory corresponding to the "Main Page" for each API doc.index.html
file contains a<div class="contents">...</div>
corresponding to main page contents.Therefore, this PR proposes the "contents" element of each index page be directly substituted with that of the latest API doc with each deployment. This ensures a direct and targeted means of keeping the home page of old API docs up-to-date with the contents of
etc/apidocmenu.md
for each release while minimizing the risk of breaking old API doc pages due to Doxygen version inconsistencies/incompatibilities. Recommend examining the patch commit (not the format commit) in #1181 for a demonstration of expected ehavior.etc/patch-apidocs-index-pages.py
This script is now invoked as part of the
doxygen-deploy
command. AnAPIDOCSPATH
environment variable is used to specify theapi/
directory under which API docs are located. This env var may be used when manually invoking the script for testing purposes.This script is designed to fail fast, fail hard should it encounter any unexpected situations to avoid risk of unintentional modifications to unrelated files and avoid deploying broken pages.
The Beautiful Soup Python library is selected for purposes of formatting and editing HTML. In particular, its ability to easily find an HTML element by class and directly replace the contents of an HTML element perfectly fulfills the needs of this PR.
The script also ensures all index pages (including the latest) are formatted per
.prettify(formatter="html")
. This will make future patches to the index pages easier to inspect and review for correctness. Note: using thehtml5
formatter was considered but dropped due to it applying more changes to the HTML than what appeared to be minimally necessary.An example of the expected script output:
Drive-By Improvements
jira @ ...
withjira==3.5.2
which contains the required patch in prior comment.cpp/cpp-driver
, notcpp/drivers
; did this change at some point?).build/docs/api
in release instructions.doxygen-deploy
depends ondoxygen-latest
so it is easier to simply start with a clean slate after reviewing the correctness of generated API doc.