Skip to content

Fix sidebars via correct web API for anchor href values #3934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/resources/docs.dart.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/resources/docs.dart.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/src/model/directives/categorization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final RegExp _categoryRegExp =
/// Mixin parsing the `@category` directive for ModelElements.
mixin Categorization on DocumentationComment {
@override
String buildDocumentationAddition(String rawDocs) =>
_stripAndSetDartdocCategories(super.buildDocumentationAddition(rawDocs));
String buildDocumentationAddition(String docs) =>
_stripAndSetDartdocCategories(super.buildDocumentationAddition(docs));

/// Parse `{@category ...}` and related information in API comments, stripping
/// out that information from the given comments and returning the stripped
Expand Down
10 changes: 7 additions & 3 deletions web/sidebars.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,14 @@ void _loadSidebar(
/// if "base href" is not being used.
void _updateLinks(String baseHref, Node node) {
if (node.isA<HTMLAnchorElement>()) {
final hrefString = (node as HTMLAnchorElement).href;
final href = Uri.tryParse(hrefString);
final hrefValue =
(node as HTMLAnchorElement).attributes.getNamedItem('href')?.value;
if (hrefValue == null) {
return;
}
final href = Uri.tryParse(hrefValue);
if (href != null && !href.isAbsolute) {
node.href = '$baseHref$hrefString';
node.href = '$baseHref$hrefValue';
}
}

Expand Down
2 changes: 1 addition & 1 deletion web/sig.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45250896CEC08BF6C3F52F3320C7E033
22A0DF76266C40F6C6821F473937789F