Skip to content

Commit

Permalink
Do not print empty <dl></dl> tags when an option category is empty.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 641908436
Change-Id: I218d8a2df72818fd9dadb5cc272e4a3b3b73bfcf
  • Loading branch information
meisterT authored and copybara-github committed Jun 10, 2024
1 parent f6687ad commit 386744f
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,15 +535,13 @@ public String describeOptionsHtml(Escaper escaper, String productName) {

for (Map.Entry<OptionDocumentationCategory, List<OptionDefinition>> e :
optionsByCategory.entrySet()) {
desc.append("<dl>");
String categoryDescription = optionCategoryDescriptions.get(e.getKey());
List<OptionDefinition> categorizedOptionsList = e.getValue();

// Describe the category if we're going to end up using it at all.
if (!categorizedOptionsList.isEmpty()) {
desc.append(escaper.escape(categoryDescription)).append(":\n");
if (categorizedOptionsList.isEmpty()) {
continue;
}
// Describe the options in this category.
String categoryDescription = optionCategoryDescriptions.get(e.getKey());

desc.append("<dl>").append(escaper.escape(categoryDescription)).append(":\n");
for (OptionDefinition optionDef : categorizedOptionsList) {
OptionsUsage.getUsageHtml(optionDef, desc, escaper, impl.getOptionsData(), true);
}
Expand Down

0 comments on commit 386744f

Please sign in to comment.