You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Java.Interop.Tools.JavaSource] Support html tags with attributes (#1286)
Context: dotnet/android#9647dotnet/android#9647 attempted to import API docs for API 35, and
produced the following warning:
The following issues were found, review the build log for more details:
> ## Unable to translate remarks for android/app/admin/DevicePolicyManager:
> JavadocImport-Error (31:39): Syntax error, expected: </p>, </P>, #PCDATA, <tt>, <TT>, <i>, <I>, <a attr=, <code>, {@code, {@docroot}, {@inheritdoc}, {@link, {@linkplain, {@literal, {@see, {@value}, {@value, IgnorableDeclaration, {@param, UnknownHtmlElementStart, <p>, <P>, <pre , @author, @apiSince, @deprecated, @deprecatedSince, @exception, @inheritdoc, @hide, @param, @return, @see, @Serialdata, @serialField, @SInCE, @throws, @[unknown], @Version
<li>A <i id="deviceowner">Device Owner</i>, which only ever exists on the
^
Parsing logic fails here because the `<i>` tag has an `id` attribute
_and_ is present in an open `<p>` tag.
Turns Out™ that HTML allows attributes on nearly *everything*; e.g.
from [§3.2.3 Global attributes][0]:
> The following attributes are common to and may be specified on all
> [HTML elements](https://dev.w3.org/html5/spec-LC/infrastructure.html#html-elements)
> (even those not defined in this specification):
> * …
> * `id`
Given this, it doesn't make sense for `CreateStartElement()` to not
allow any attributes. Update `CreateStartElement()` so that *all*
elements *ignore* any specified attributes (by default), which
allows `<i id="deviceowner">Device Owner</i>` to work.
The regex used has also been improved to include word boundaries
around the tag name to make sure that it does not match unexpected
elements.
[0]: https://dev.w3.org/html5/spec-LC/elements.html#global-attributes
Copy file name to clipboardExpand all lines: src/Java.Interop.Tools.JavaSource/Java.Interop.Tools.JavaSource/SourceJavadocToXmldocGrammar.HtmlBnfTerms.cs
0 commit comments