Skip to content

Commit 857f0e9

Browse files
srawlinscommit-bot@chromium.org
authored andcommitted
NNBD i13n: Re-introduce formatting
Change-Id: I88ebe8f1f0b8f9655bb7a9f9bc83545d6f068618 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121020 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 63d3012 commit 857f0e9

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

pkg/analysis_server/lib/src/edit/nnbd_migration/instrumentation_renderer.dart

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mustache.Template _template = mustache.Template(r'''
1414
<html>
1515
<head>
1616
<title>Non-nullable fix instrumentation report</title>
17-
<!-- <script src="{{ highlightJsPath }}"></script>-->
17+
<script src="{{ highlightJsPath }}"></script>
1818
<script>
1919
function getHash(location) {
2020
var index = location.lastIndexOf("#");
@@ -49,18 +49,22 @@ mustache.Template _template = mustache.Template(r'''
4949
document.addEventListener("DOMContentLoaded", highlightTarget);
5050
window.addEventListener("hashchange", highlightTarget);
5151
</script>
52-
<!-- <link rel="stylesheet" href="{{ highlightStylePath }}"> -->
52+
<link rel="stylesheet" href="{{ highlightStylePath }}">
5353
<style>
5454
a:link {
55-
color: #000000;
55+
color: inherit;
5656
text-decoration-line: none;
5757
}
5858
5959
a:visited {
60-
color: #000000;
60+
color: inherit;
6161
text-decoration-line: none;
6262
}
6363
64+
a:hover {
65+
text-decoration-line: underline;
66+
}
67+
6468
body {
6569
font-family: sans-serif;
6670
padding: 1em;
@@ -84,6 +88,7 @@ h2 {
8488
}
8589
8690
.regions {
91+
padding: 0.5em;
8792
position: absolute;
8893
left: 0.5em;
8994
top: 0.5em;
@@ -148,14 +153,7 @@ h2 {
148153
{{# units }}'''
149154
'<h2>{{{ path }}}</h2>'
150155
'<div class="content">'
151-
// '<div class="highlighting">'
152-
// '{{! These regions are written out, unmodified, as they need to be found }}'
153-
// '{{! in one simple text string for highlight.js to hightlight them. }}'
154-
// '{{# regions }}'
155-
// '{{ content }}'
156-
// '{{/ regions }}'
157-
// '</div>'
158-
'<div class ="code">'
156+
'<div class="code">'
159157
'{{! Write the file content, modified to include navigation information, }}'
160158
'{{! both anchors and links. }}'
161159
'{{{ navContent }}}'
@@ -185,7 +183,7 @@ h2 {
185183
{{/ units }}
186184
<script lang="javascript">
187185
document.addEventListener("DOMContentLoaded", (event) => {
188-
document.querySelectorAll(".highlighting").forEach((block) => {
186+
document.querySelectorAll(".code").forEach((block) => {
189187
hljs.highlightBlock(block);
190188
});
191189
});
@@ -369,14 +367,14 @@ class MigrationInfo {
369367
MigrationInfo(this.units, this.pathContext, this.includedRoot);
370368

371369
/// The path to the highlight.js script, relative to [unitInfo].
372-
String highlightJsPath(UnitInfo unitInfo) =>
373-
pathContext.relative(pathContext.join(includedRoot, 'highlight.pack.js'),
374-
from: pathContext.dirname(unitInfo.path));
370+
String highlightJsPath(UnitInfo unitInfo) => pathContext.relative(
371+
pathContext.join(includedRoot, '..', 'highlight.pack.js'),
372+
from: pathContext.dirname(unitInfo.path));
375373

376374
/// The path to the highlight.js stylesheet, relative to [unitInfo].
377-
String highlightStylePath(UnitInfo unitInfo) =>
378-
pathContext.relative(pathContext.join(includedRoot, 'androidstudio.css'),
379-
from: pathContext.dirname(unitInfo.path));
375+
String highlightStylePath(UnitInfo unitInfo) => pathContext.relative(
376+
pathContext.join(includedRoot, '..', 'androidstudio.css'),
377+
from: pathContext.dirname(unitInfo.path));
380378

381379
/// Generate mustache context for unit links, for navigation in the
382380
/// instrumentation document for [thisUnit].

0 commit comments

Comments
 (0)