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

Hannes Wallnöfer hannesw at openjdk.org
Wed Aug 17 14:27:05 UTC 2022


> 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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9627/files
  - new: https://git.openjdk.org/jdk/pull/9627/files/eb410346..47f2371f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9627&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9627&range=00-01

  Stats: 62 lines in 4 files changed: 31 ins; 14 del; 17 mod
  Patch: https://git.openjdk.org/jdk/pull/9627.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9627/head:pull/9627

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


More information about the javadoc-dev mailing list