Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java.Interop.Tools.JavaSource] Improve
<a>
parsing (#1126)
Parsing of `<a/>` elements would occasionally fail when they didn't match our expectations/requirements: * Unquoted URLs, a'la `android/database/sqlite/SQLiteDatabase.java`: * <p> See <a href=https://www.sqlite.org/pragma.html#pragma_journal_mode>here</a> for more Resulting in: System.Xml.XmlException: 'https' is an unexpected token. The expected token is '"' or '''. Line 1, position 11. or a'la `java/io/PipedOutputStream.java` * @exception IOException if the pipe is <a href=#BROKEN> broken</a>, resulting in: System.Xml.XmlException: '#' is an unexpected token. The expected token is '"' or '''. Line 1, position 11. * Improperly quoted attributes, a'la `android/telephony/PhoneNumberUtils.java`: * Matching is based on <a href="https://github.com/google/libphonenumber>libphonenumber</a>. Resulting in: System.Xml.XmlException: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 1, position 67. * Use of "raw" `&`, a'la `android/widget/ProgressBar.java`: * <a href="https://material.io/guidelines/components/progress-activity.html#progress-activity-types-of-indicators"> * Progress & activity</a>. Resulting in: System.Xml.XmlException: An error occurred while parsing EntityName. Line 2, position 11. Fix this by updating updating the `InlineHyperLinkOpenTerm` terminal to *not* require `href`, and updating the `InlineHyperLinkDeclaration` rule to better deal with whatever chaos is there. When we encounter an `<a/>` element that points to code or a local path we will now only include the element value in the javadoc, and not the full `href` attribute value. Replace the `IgnorableDeclaration` rule with an `IgnorableCharTerminal` terminal. This better supports `@` in the content stream when it's not part of a Javadoc inline tag, e.g. `<a href="mailto:nobody@google.com">nobody</a>`.
- Loading branch information