Skip to content

Commit c8ad7c7

Browse files
committed
Update customizations
1 parent 2df474d commit c8ad7c7

15 files changed

+582
-771
lines changed

app/lib/dartdoc/customization.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,18 @@ class DartdocCustomizer {
7474

7575
void _stripCanonicalUrl(Element elem) {
7676
if (elem == null) return;
77-
final href = elem.attributes['href'];
77+
String href = elem.attributes['href'];
7878
if (href != null && href.endsWith('/index.html')) {
79-
elem.attributes['href'] =
80-
href.substring(0, href.length - 'index.html'.length);
79+
href = href.substring(0, href.length - 'index.html'.length);
80+
}
81+
if (href != null) {
82+
// Since the <base /> tag removal, dartdoc calculates the canonical URL
83+
// with extra `../../` segments. Removing them as a temporary fix.
84+
// https://github.com/dart-lang/dartdoc/issues/2122
85+
// TODO: Remove this after the dartdoc issue is fixed
86+
href = href.replaceAll('../', '');
87+
88+
elem.attributes['href'] = href;
8189
}
8290
}
8391

app/test/dartdoc/golden/pana_0.12.2_index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
7-
<meta name="generator" content="made with love by dartdoc 0.29.3">
7+
<meta name="generator" content="made with love by dartdoc 0.30.0+1">
88
<meta name="description" content="pana API docs, for the Dart programming language.">
99
<title>pana - Dart API docs</title>
10-
<link rel="canonical" href="https://pub.dartlang.org/documentation/pana/0.12.2/index.html">
10+
<link rel="canonical" href="https://pub.dev/documentation/pana/0.12.2/index.html">
1111

12+
1213
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
1314
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
1415
<link rel="stylesheet" href="static-assets/github.css">
@@ -128,7 +129,7 @@ <h2>Libraries</h2>
128129
<script src="static-assets/typeahead.bundle.min.js"></script>
129130
<script src="static-assets/highlight.pack.js"></script>
130131
<script src="static-assets/URI.js"></script>
131-
<script src="static-assets/script.js"></script>
132+
<script id="dartdoc_script_js" src="static-assets/script.js"></script>
132133
<!-- footer placeholder -->
133134

134135
</body>

app/test/dartdoc/golden/pana_0.12.2_index.out.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<meta charset="utf-8"/>
77
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
88
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no"/>
9-
<meta name="generator" content="made with love by dartdoc 0.29.3"/>
9+
<meta name="generator" content="made with love by dartdoc 0.30.0+1"/>
1010
<meta name="description" content="pana API docs, for the Dart programming language."/>
1111
<title>pana - Dart API docs</title>
1212
<link rel="alternate" href="/documentation/pana/latest/"/>
13-
<link rel="canonical" href="https://pub.dartlang.org/documentation/pana/0.12.2/"/>
13+
<link rel="canonical" href="https://pub.dev/documentation/pana/0.12.2/"/>
1414
<link rel="stylesheet" type="text/css" href="/static/css/github-markdown.css?hash=t2ti0tfkd3q7dsh5njovil42c3bnhf5s"/>
1515
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet"/>
1616
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
@@ -144,7 +144,7 @@ <h2>Libraries</h2>
144144
<script src="static-assets/typeahead.bundle.min.js"/>
145145
<script src="static-assets/highlight.pack.js"/>
146146
<script src="static-assets/URI.js"/>
147-
<script src="static-assets/script.js"/>
147+
<script id="dartdoc_script_js" src="static-assets/script.js"/>
148148
<!-- footer placeholder -->
149149
</body>
150150
</html>

app/test/dartdoc/golden/pana_0.12.2_license_file_class.html

Lines changed: 94 additions & 144 deletions
Large diffs are not rendered by default.

app/test/dartdoc/golden/pana_0.12.2_license_file_class.latest.diff

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,5 @@
22
- <link rel="alternate" href="/documentation/pana/latest/"/>
33
- <a href="/packages/pana/versions/0.12.2">pana package</a>
44
+ <a href="/packages/pana">pana package</a>
5-
- <a href="/documentation/pana/0.12.2/">documentation</a>
6-
+ <a href="/documentation/pana/latest/">documentation</a>
75
- <a href="/packages/pana/versions/0.12.2">pana package</a>
86
+ <a href="/packages/pana">pana package</a>
9-
- <a href="/documentation/pana/0.12.2/">documentation</a>
10-
+ <a href="/documentation/pana/latest/">documentation</a>

0 commit comments

Comments
 (0)