TL;DR
I just released javadoc-cleanup 1.3.7, a GitHub Action to Post-Process Javadoc-Generated Documentation in GitHub Actions Before Deploying to the Web. The javadoc-cleanup GitHub Action is implemented in Python, and its functionality includes inserting a viewport meta tag if not present (pre-Java 16); generating and inserting canonical URLs into the head of Javadoc pages; an option to insert a user-defined block into the head of Javadoc generated pages, which I use in my projects to insert my website's favicon and a referrer policy; and a few other things.
This release, javadoc-cleanup 1.3.7, primarily consists of minor bug fixes not likely encountered by users, all related to regular expressions used to check for things within Javadoc generated HTML, such as to check for presence of a viewport meta tag, or to check if a page was generated by Javadoc to begin with. The existing regular expressions worked correctly for all cases based upon actual Javadoc generated pages, but could fail for other validly formatted tags they were designed to detect. Bugs revealed by warning messages generated by Python 3.12 about the regular expressions that were not generated by Python 3.11 and earlier.
Changelog 1.3.7 - 2023-10-05
Fixed
- Fix minor bug in regex used to detect if an HTML file was generated by Javadoc.
- Fix minor bug in regex used to detect if an HTML file is a redirect, such as in javadocs for libraries that define a JPMS module.
- Fix minor bug in regex used to detect if a Javadoc page already specified a viewport directive, such as in Java 16+.
Dependencies
- Bump cicirello/pyaction from 4.11.1 to 4.25.0, including upgrading Python within the Docker container to 3.12.
CI/CD
- Bump Python to 3.12 in CI/CD workflows when running unit tests.
More Information
Please consider starring javadoc-cleanup's GitHub repository:
cicirello / javadoc-cleanup
Create mobile-friendly documentation sites by post-processing javadocs in GitHub Actions
javadoc-cleanup
Check out all of our GitHub Actions: https://actions.cicirello.org/
About
The javadoc-cleanup GitHub action is a utility to tidy up javadocs prior to deployment to an API documentation website, assumed hosted on GitHub Pages. It performs the following functions:
- Improves mobile browsing experience: It
inserts
<meta name="viewport" content="width=device-width, initial-scale=1">
within the<head>
of each html file that was generated by javadoc, if not already present. Beginning with Java 16, javadoc properly defines the viewport, whereas prior to Java 16, it does not. - Strips out any timestamps inserted by javadoc: The timestamps cause a variety of version control
issues for documentation sites maintained in git repositories. Javadoc has an option
-notimestamp
to direct javadoc not to insert timestamps (which we recommend that you also use). However, at the present time there appears to be a bug (in OpenJDK 11's javadoc, and possibly other versions)…
For more information, see my earlier post about javadoc-cleanup here on DEV, as well as its webpage.
Post-Process Javadoc-Generated Documentation in GitHub Actions Before Deploying to the Web
Vincent A. Cicirello ・ Nov 16 '22
If you'd like to see some examples of how this action can be used within GitHub Workflows, then also check out another earlier DEV post:
Deploy a Documentation Website for a Java Library Using GitHub Actions
Vincent A. Cicirello ・ Nov 30 '22
Where You Can Find Me
Follow me here on DEV and on GitHub:
Or visit my website:
Top comments (0)