Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats committed Dec 13, 2024
1 parent 75f2016 commit c0f424e
Show file tree
Hide file tree
Showing 10 changed files with 1,674 additions and 451 deletions.
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ impl<'a> DocParser<'a> {
definition.symbol,
definition.symbol_decl.maybe_node(),
export.module.esm(),
module_info.specifier(),
export.module.specifier(),
Some(definition.symbol_decl),
Some(original_range),
);
Expand Down
9 changes: 9 additions & 0 deletions tests/html_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,18 @@ async fn html_doc_files_rewrite() {
"./~/Foobar.prototype.html",
"./~/Hello.html",
"./~/Hello.world.html",
"./~/Testing.html",
"./~/Testing.prototype.html",
"./~/Testing.t.html",
"./~/c.html",
"./~/d.html",
"./~/externalFunction.html",
"./~/qaz.html",
"./~/x.html",
"_d.ts/index.html",
"_d.ts/~/externalFunction.html",
"c.ts/index.html",
"c.ts/~/x.html",
"comrak.css",
"foo/index.html",
"foo/~/default.html",
Expand Down
14 changes: 7 additions & 7 deletions tests/snapshots/html_test__html_doc_files_rewrite-16.snap
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,19 @@ Variables</h2></div><div class="namespaceSection"><div id="namespace_default" cl
<span class="hover:bg-Function/15">x</span>
</a>
</li><li>
<a href="..&#x2F;.&#x2F;.&#x2F;~&#x2F;Bar.html" title="Bar"><div class="docNodeKindIcon"><div class="text-Class bg-Class/15" title="Class">c</div></div>
<span class="hover:bg-Class/15">Bar</span>
<a href="..&#x2F;.&#x2F;c.ts&#x2F;~&#x2F;x.html" title="x"><div class="docNodeKindIcon"><div class="text-Function bg-Function/15" title="Function">f</div></div>
<span class="hover:bg-Function/15">x</span>
</a>
</li><li>
<a href="..&#x2F;.&#x2F;.&#x2F;~&#x2F;Baz.html" title="Baz"><div class="docNodeKindIcon"><div class="text-TypeAlias bg-TypeAlias/15" title="Type Alias">T</div></div>
<span class="hover:bg-TypeAlias/15">Baz</span>
<a href="..&#x2F;.&#x2F;_d.ts&#x2F;~&#x2F;externalFunction.html" title="externalFunction"><div class="docNodeKindIcon"><div class="text-Function bg-Function/15" title="Function">f</div></div>
<span class="hover:bg-Function/15">externalFunction</span>
</a>
</li><li>
<a href="..&#x2F;.&#x2F;.&#x2F;~&#x2F;Foo.html" title="Foo"><div class="docNodeKindIcon"><div class="text-Class bg-Class/15" title="Class">c</div></div>
<span class="hover:bg-Class/15">Foo</span>
<a href="..&#x2F;.&#x2F;.&#x2F;~&#x2F;Bar.html" title="Bar"><div class="docNodeKindIcon"><div class="text-Class bg-Class/15" title="Class">c</div></div>
<span class="hover:bg-Class/15">Bar</span>
</a>
</li></ul><a class="flex items-center gap-0.5" href="..&#x2F;.&#x2F;all_symbols.html">
<span class="leading-none">view all 10 symbols</span><svg
<span class="leading-none">view all 16 symbols</span><svg
width="16"
height="16"
viewBox="0 0 16 16"
Expand Down
18 changes: 8 additions & 10 deletions tests/snapshots/html_test__html_doc_files_rewrite-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ expression: "files.get(\"./index.html\").unwrap()"
</nav>
<div id="searchResults"></div><div id="content">
<main><section >
<div class="space-y-2 flex-1 "><div class="space-y-7" id="module_doc"><div class="markdown"><p>Some docs
with a line break</p>
</div></div>
<div class="space-y-2 flex-1 "><div class="space-y-7" id="module_doc"></div>
</div>
</section>
</main><div class="toc">
Expand All @@ -48,19 +46,19 @@ with a line break</p>
<span class="hover:bg-Function/15">x</span>
</a>
</li><li>
<a href=".&#x2F;.&#x2F;~&#x2F;Bar.html" title="Bar"><div class="docNodeKindIcon"><div class="text-Class bg-Class/15" title="Class">c</div></div>
<span class="hover:bg-Class/15">Bar</span>
<a href=".&#x2F;c.ts&#x2F;~&#x2F;x.html" title="x"><div class="docNodeKindIcon"><div class="text-Function bg-Function/15" title="Function">f</div></div>
<span class="hover:bg-Function/15">x</span>
</a>
</li><li>
<a href=".&#x2F;.&#x2F;~&#x2F;Baz.html" title="Baz"><div class="docNodeKindIcon"><div class="text-TypeAlias bg-TypeAlias/15" title="Type Alias">T</div></div>
<span class="hover:bg-TypeAlias/15">Baz</span>
<a href=".&#x2F;_d.ts&#x2F;~&#x2F;externalFunction.html" title="externalFunction"><div class="docNodeKindIcon"><div class="text-Function bg-Function/15" title="Function">f</div></div>
<span class="hover:bg-Function/15">externalFunction</span>
</a>
</li><li>
<a href=".&#x2F;.&#x2F;~&#x2F;Foo.html" title="Foo"><div class="docNodeKindIcon"><div class="text-Class bg-Class/15" title="Class">c</div></div>
<span class="hover:bg-Class/15">Foo</span>
<a href=".&#x2F;.&#x2F;~&#x2F;Bar.html" title="Bar"><div class="docNodeKindIcon"><div class="text-Class bg-Class/15" title="Class">c</div></div>
<span class="hover:bg-Class/15">Bar</span>
</a>
</li></ul><a class="flex items-center gap-0.5" href=".&#x2F;all_symbols.html">
<span class="leading-none">view all 10 symbols</span><svg
<span class="leading-none">view all 16 symbols</span><svg
width="16"
height="16"
viewBox="0 0 16 16"
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/html_test__html_doc_files_rewrite-21.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source: tests/html_test.rs
expression: "files.get(\"search_index.js\").unwrap()"
---
(function () {
window.DENO_DOC_SEARCH_INDEX = {"nodes":[{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"A","file":".","doc":"","url":"././~/A.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"B","file":".","doc":"","url":"././~/B.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"Bar","file":".","doc":"> Some quote in bar docs\n> This quote part is ignored\n> when getting the title of this doc\n\nBar docs","url":"././~/Bar.html","deprecated":false},{"kind":[{"char":"T","kind":"TypeAlias","title":"Type Alias"}],"name":"Baz","file":".","doc":"","url":"././~/Baz.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Baz.foo","file":".","doc":"","url":"././~/Baz.foo.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"Foo","file":".","doc":"some Foo docs {@linkcode Bar}\n","url":"././~/Foo.html","deprecated":false},{"kind":[{"char":"m","kind":"Method","title":"Method"}],"name":"Foo.prototype.test","file":".","doc":"","url":"././~/Foo.prototype.test.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Foo.bar","file":".","doc":"","url":"././~/Foo.bar.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Foo.prototype.foo","file":".","doc":"","url":"././~/Foo.prototype.foo.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Foo.prototype.\"&gt;&lt;img src=x onerror=alert(1)&gt;","file":".","doc":"","url":"././~/Foo.prototype.\"><img src=x onerror=alert(1)>.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"Foobar","file":".","doc":"```ts\n// This code block is ignored when getting the title of this doc\nconst foobar = new Foobar();\n```\n\nFoobar docs\n","url":"././~/Foobar.html","deprecated":false},{"kind":[{"char":"I","kind":"Interface","title":"Interface"}],"name":"Hello","file":".","doc":"","url":"././~/Hello.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Hello.world","file":".","doc":"","url":"././~/Hello.world.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"}],"name":"c","file":".","doc":"","url":"././~/c.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"}],"name":"d","file":".","doc":"","url":"././~/d.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"},{"char":"f","kind":"Function","title":"Function"},{"char":"f","kind":"Function","title":"Function"}],"name":"qaz","file":".","doc":"","url":"././~/qaz.html","deprecated":false},{"kind":[{"char":"v","kind":"Variable","title":"Variable"}],"name":"default","file":"foo","doc":"The default export item.\n\nThis item reproduces the issue reported in {@link https://github.com/jsr-io/jsr/issues/459}","url":"./foo/~/default.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"}],"name":"x","file":"foo","doc":"","url":"./foo/~/x.html","deprecated":false}]};
window.DENO_DOC_SEARCH_INDEX = {"nodes":[{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"A","file":".","doc":"","url":"././~/A.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"B","file":".","doc":"","url":"././~/B.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"Bar","file":".","doc":"> Some quote in bar docs\n> This quote part is ignored\n> when getting the title of this doc\n\nBar docs","url":"././~/Bar.html","deprecated":false},{"kind":[{"char":"T","kind":"TypeAlias","title":"Type Alias"}],"name":"Baz","file":".","doc":"","url":"././~/Baz.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Baz.foo","file":".","doc":"","url":"././~/Baz.foo.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"Foo","file":".","doc":"some Foo docs {@linkcode Bar}\n","url":"././~/Foo.html","deprecated":false},{"kind":[{"char":"m","kind":"Method","title":"Method"}],"name":"Foo.prototype.test","file":".","doc":"","url":"././~/Foo.prototype.test.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Foo.bar","file":".","doc":"","url":"././~/Foo.bar.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Foo.prototype.foo","file":".","doc":"","url":"././~/Foo.prototype.foo.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Foo.prototype.\"&gt;&lt;img src=x onerror=alert(1)&gt;","file":".","doc":"","url":"././~/Foo.prototype.\"><img src=x onerror=alert(1)>.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"}],"name":"Foobar","file":".","doc":"```ts\n// This code block is ignored when getting the title of this doc\nconst foobar = new Foobar();\n```\n\nFoobar docs\n","url":"././~/Foobar.html","deprecated":false},{"kind":[{"char":"I","kind":"Interface","title":"Interface"}],"name":"Hello","file":".","doc":"","url":"././~/Hello.html","deprecated":false},{"kind":[{"char":"p","kind":"Property","title":"Property"}],"name":"Hello.world","file":".","doc":"","url":"././~/Hello.world.html","deprecated":false},{"kind":[{"char":"c","kind":"Class","title":"Class"},{"char":"N","kind":"Namespace","title":"Namespace"}],"name":"Testing","file":".","doc":"","url":"././~/Testing.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"}],"name":"Testing.t","file":".","doc":"","url":"././~/Testing.t.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"}],"name":"c","file":".","doc":"","url":"././~/c.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"}],"name":"d","file":".","doc":"","url":"././~/d.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"},{"char":"f","kind":"Function","title":"Function"},{"char":"f","kind":"Function","title":"Function"}],"name":"qaz","file":".","doc":"","url":"././~/qaz.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"},{"char":"f","kind":"Function","title":"Function"}],"name":"externalFunction","file":"_d.ts","doc":"","url":"./_d.ts/~/externalFunction.html","deprecated":false},{"kind":[{"char":"v","kind":"Variable","title":"Variable"}],"name":"default","file":"foo","doc":"The default export item.\n\nThis item reproduces the issue reported in {@link https://github.com/jsr-io/jsr/issues/459}","url":"./foo/~/default.html","deprecated":false},{"kind":[{"char":"f","kind":"Function","title":"Function"},{"char":"f","kind":"Function","title":"Function"},{"char":"f","kind":"Function","title":"Function"},{"char":"f","kind":"Function","title":"Function"}],"name":"x","file":"foo","doc":"","url":"./foo/~/x.html","deprecated":false}]};
})()
Loading

0 comments on commit c0f424e

Please sign in to comment.