Michael Howell
4c183cd2d4
rustdoc: fix JS error when rendering parse error
2022-05-05 09:39:47 -07:00
Michael Howell
8b2147b497
rustdoc: fix keyboard shortcuts and console log on search page
2022-05-05 09:39:45 -07:00
Michael Howell
21a121332b
rustdoc: change the "In Function Signatures" to context-sensitive
...
* If it's just `-> a`, use "In Function Return Types"
* If it's just `a b`, use "In Function Parameters"
* Otherwise, still use "In Function Signatures"
2022-05-05 09:37:29 -07:00
Michael Howell
6c8a2d4715
rustdoc: when running a function-signature search, tweak the tab bar
2022-05-05 09:37:29 -07:00
Folyd
67ebeea7a0
Move callback to the () => {} syntax.
...
Fix lint
Fix main.js
Restore anonymous functions
Fix
Fix more
2022-05-04 11:10:48 +08:00
Guillaume Gomez
73688e4021
* Add documentation for settings page rendering functions.
...
* Improve code.
* Fix some documentation argument types.
* Make settings order the same as before this PR.
* Change timeout to 0 so that browser will render it as fast as possible.
2022-05-01 21:22:38 +02:00
Guillaume Gomez
9625ed8be7
Move settings into full JS
2022-04-30 13:12:41 +02:00
Dylan DPC
bfb13ec691
Rollup merge of #96390 - GuillaumeGomez:es6-part2, r=notriddle
...
Switch JS code to ES6 - part 2
Part of #93058 .
It's based on https://github.com/rust-lang/rust/pull/96361 so it needs to wait for it to be merged first.
r? `@notriddle`
2022-04-29 23:54:37 +02:00
Guillaume Gomez
4e0be6ddeb
Remove dead code in main.js
2022-04-26 20:59:33 +02:00
Guillaume Gomez
509b145744
Migrate scrape-examples.js to ES6
2022-04-26 20:59:33 +02:00
Guillaume Gomez
724c4bd9bb
Migrate storage.js to ES6
2022-04-26 20:59:32 +02:00
Guillaume Gomez
6faa40d406
Migrate source-script to ES6
2022-04-26 20:59:32 +02:00
Guillaume Gomez
016334a3ad
Migrate main.js to ES6
2022-04-26 20:59:32 +02:00
Guillaume Gomez
cb8da88c83
Migrate externs.js to ES6
2022-04-26 20:59:32 +02:00
Guillaume Gomez
ae93e6e3b8
Small JS code improvements
2022-04-26 20:59:32 +02:00
Guillaume Gomez
45cdb2be10
Update rustdoc search parser to handle ! correctly
2022-04-26 20:57:45 +02:00
Guillaume Gomez
52fefb0454
Rollup merge of #96361 - GuillaumeGomez:es6, r=notriddle
...
Switch JS code to ES6
Considering it's already quite big, I'll do the remaining files in another PR.
Part of #93058 .
r? ``@notriddle``
2022-04-26 13:22:28 +02:00
Dylan DPC
2381897f27
Rollup merge of #96279 - GuillaumeGomez:remove-woff-fonts, r=camelid,jsha
...
rustdoc: Remove .woff font files
Copying `@jsha's` great comment:
> Right now we ship 1.5MB of woff files in the rustdoc binary, and 1MB of woff2 files, for a total of 2.5MB.
>
> Per:
>
> https://caniuse.com/woff
> https://caniuse.com/woff2
>
> The only listed browser that supports woff and not woff2 is IE, which is not supported per https://github.com/rust-lang/rfcs/blob/master/text/1985-tiered-browser-support.md .
>
> I propose we stop shipping woff files and save 1.5MB from the rustdoc binary (and from each doc build).
r? `@jsha`
2022-04-26 01:21:21 +02:00
Guillaume Gomez
3c95c0bd62
Update settings.js to ES6
2022-04-24 15:36:15 +02:00
Guillaume Gomez
4280c816fa
Update search.js to ES6
2022-04-24 15:36:02 +02:00
Guillaume Gomez
718f93425c
Remove .woff font files
2022-04-21 13:07:21 +02:00
Guillaume Gomez
4d26bde4f0
Extend handleSingleArg documentation
2022-04-20 21:11:39 +02:00
Guillaume Gomez
8d0e10cfbe
Correctly handle single :
2022-04-18 23:11:42 +02:00
Guillaume Gomez
299e8ee25e
Add an extra check over filter type
2022-04-18 21:43:19 +02:00
Guillaume Gomez
d7d538a8c4
Fix some corner cases
2022-04-18 20:59:09 +02:00
Guillaume Gomez
6f35475ba5
Parse idents the same way in both quote string elements and "normal" elements
2022-04-18 20:59:09 +02:00
Guillaume Gomez
a6051c76db
Remove unnecessary elem.name.length === 0 since the rustdoc search eBNF does not allow elements without a name
2022-04-18 20:59:09 +02:00
Guillaume Gomez
51b4005003
Update the eBNF to allow generics bracket to not be closed if it's EOF
2022-04-18 20:59:09 +02:00
Guillaume Gomez
e03a950747
Handle separators in their own functions and fix missing handling of tabs
2022-04-18 20:59:09 +02:00
Guillaume Gomez
da829d8d9d
Improve the BNF description a bit and fix some issues
2022-04-18 20:59:09 +02:00
Guillaume Gomez
1f5c4c2b30
Forbid rustdoc search query to end with ->
2022-04-18 20:59:09 +02:00
Guillaume Gomez
8e29ed43d9
Add isIdentCharacter function to ensure that unexpected characters are handled correctly
2022-04-18 20:59:09 +02:00
Guillaume Gomez
f9251eef68
Replace unneeded use of regex with a simple if
2022-04-18 20:59:09 +02:00
Guillaume Gomez
699ae365df
Apply suggestions:
...
* Forbid generics without a path (so "<p>" is forbidden).
* Change `handleSingleArg` so that it takes `results_others`, `results_in_args` and `results_returned` as arguments instead of using the "global" variables.
* Change `createQueryElement` so that it returns the newly created element instead of taking `elems` as argument.
* Improve documentation
2022-04-18 20:59:09 +02:00
Guillaume Gomez
c7de1a16f8
Improve documentation and add some explanations in the code
2022-04-18 20:59:09 +02:00
Guillaume Gomez
49297337b4
Simplify parser syntax
2022-04-18 20:59:08 +02:00
Guillaume Gomez
99d552092c
Make query parser more strict and improve display of errors
2022-04-18 20:59:08 +02:00
Guillaume Gomez
264064df36
* Greatly improve the rustdoc search parser source code
...
* Move all functions outside parseQuery
2022-04-18 20:59:08 +02:00
Guillaume Gomez
99c5394ecc
Add query syntax for the parser
2022-04-18 20:59:08 +02:00
Guillaume Gomez
51de26cfd9
* If type filter is in quotes, throw an error.
...
* If there are generics, don't allow to have quotes.
2022-04-18 20:59:08 +02:00
Guillaume Gomez
bbcf1762dd
Improve naming of "val" field
2022-04-18 20:59:08 +02:00
Guillaume Gomez
3aeef67037
Update search engine and parser to error when quotes are used on queries with more than one element.
2022-04-18 20:59:08 +02:00
Guillaume Gomez
be41750a10
Greatly improve rustdoc search
2022-04-18 20:59:08 +02:00
Dylan DPC
db61452b7a
Rollup merge of #93217 - willcrichton:example-analyzer, r=GuillaumeGomez
...
Improve Rustdoc UI for scraped examples with multiline arguments, fix overflow in line numbers
This PR improves a few aspects of the scrape examples feature in Rustdoc.
* Only function names and not the full call expression are highlighted.
* For call-sites with multiline arguments, the minimized code viewer will scroll to the top of the call-site rather than the middle if the argument is larger than the viewer size, ensuring that the function name is visible.
* This fixes an issue where the line numbers column had a visible x-scroll bar.
r? `@GuillaumeGomez`
2022-04-13 17:35:32 +02:00
León Orell Valerian Liehr
8de453a8c6
rustdoc: discr. required+provided assoc consts+tys
2022-04-12 15:38:39 +02:00
Guillaume Gomez
d48a39a5e2
Switch item-info div to span to generate valid HTML
2022-04-06 20:41:44 +02:00
Will Crichton
d1416d528a
Add scrape examples help page
2022-03-27 18:11:57 -07:00
Will Crichton
bb3ed6f7d6
Improve styling on scrape examples help button
2022-03-27 18:11:56 -07:00
Will Crichton
ae5d0cbe74
Improve alignment of additional scraped examples, add scrape examples help page
2022-03-27 18:11:50 -07:00
Will Crichton
7e81b0a317
Improve Rustdoc UI for scraped examples with multiline arguments, fix
...
overflow in line numbers
2022-03-27 18:10:49 -07:00