RFR: JDK-8289332: Auto-generate ids for user-defined headings [v2]

Jonathan Gibbons jjg at openjdk.org
Wed Aug 17 16:50:12 UTC 2022


On Wed, 17 Aug 2022 14:27:05 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> This is a simple change to automatically generate `id` attributes for HTML headers in documentation comments. 
>> 
>> I decided to leave the functionality in `HtmlDocletWriter` rather than moving it to `HtmlIds` because it uses the same helper methods as`commentTagsToContent`.
>> 
>> The value of the `id` attribute id derived from the content of the header tag with spaces and other non-word characters replaced by `-`. A `-hdr` suffix is appended to avoid collisions with other ids. If there are duplicate values an int counter is appended to make them unique.
>
> Hannes Wallnöfer has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Remove trailing whitespace
>  - Address review feedback
>    
>     - Make sure hasIdAttribute is safe
>     - Move id generating code to HtmlIds
>     - Rename -hdr suffix to -heading
>     - Rename header to heading in code

yes, I like the change to move the code to allocate the `id` to `HtmlIds`

-------------

Marked as reviewed by jjg (Reviewer).

PR: https://git.openjdk.org/jdk/pull/9627


More information about the javadoc-dev mailing list