From e27ad50eb080d8e370fc04a2a0e668b30c97bd34 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 7 Jun 2019 14:32:48 -0700 Subject: [PATCH] 8224257: fix issues in files generated by pandoc Reviewed-by: mchung --- .../classes/build/tools/fixuppandoc/Main.java | 47 ++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/make/jdk/src/classes/build/tools/fixuppandoc/Main.java b/make/jdk/src/classes/build/tools/fixuppandoc/Main.java index df41bbfed46..59d75eeb9e6 100644 --- a/make/jdk/src/classes/build/tools/fixuppandoc/Main.java +++ b/make/jdk/src/classes/build/tools/fixuppandoc/Main.java @@ -44,6 +44,7 @@ import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.regex.Matcher; import java.util.regex.Pattern; /** @@ -63,11 +64,18 @@ import java.util.regex.Pattern; * *

Tables: row headings

* - * {@code scope="row"} is added to the {@code } elements in the first - * column whose cell contents are all different and therefore which can be - * used to identify the row. In case of ambiguity, a column containing - * a {@code } whose contents begin name is preferred. + * For simple tables, as typically generated by _pandoc_, determine the column + * whose contents are unique, and convert the cells in that column to be header + * cells with {@code scope="row"}. In case of ambiguity, a column containing a + * {@code } whose contents begin with name is preferred. + * When converting the cell, the {@code style} attribute will be updated to + * specify {@code font-weight: normal}, and if there is not already an explicit + * setting for {@code text-align}, then the style will be updated to include + * {@code text-align:left;}. * + * These rules do not apply if the table contains any cells that include + * a setting for the {@code scope} attribute, or if the table contains + * spanning cells or nested tables. * *

{@code }

* @@ -533,12 +541,39 @@ public class Main { } index++; } + boolean updateEndTd = false; + Pattern styleAttr = Pattern.compile("(?.*style=\")(?